- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Error in script
Operating System - Linux
1756988
Members
2163
Online
108858
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-30-2006 09:29 PM
тАО07-30-2006 09:29 PM
Error in script
hi,
I wrote unix shell program(bash) which in turn executes two sql statements
TaBLE STRUCTURE
Employee
criteriano project
ctr2 update table1 set empname='arun' where empid=1
SCRIPT
#!bin/sh
/oraclepath username/password<
update employee
set sal=sal+2000;
commit;
DECLARE result employee.project%TYPE;
i NUMBER DEFAULT 0;
j NUMBER;
BEGIN
SELECT COUNT(*) INTO j FROM employee WHERE EXISTS(SELECT * FROM employeeWHERE CRITERIANO='Crt2');
IF(j>0) THEN
DECLARE CURSOR cursorname IS SELECT * FROM employee WHERE criteriano='Crt2';
BEGIN
FOR navcursor IN cursorname
LOOP
i:=i+1;
result:=navcursor.project;
EXECUTE IMMEDIATE result;
dbms_output.put_line('Look Ma, I can print from PL/SQL!!!');
COMMIT;
END LOOP;
END;
ELSE
dbms_output.put_line('Look Ma, I can print from PL/SQL!!!');
END IF;
END
EOF
Both query gets execute successfully in query analyser
But when used in unix script 1st query gets executed not the second(i.e) cursor.
Its not able to read the cursor
I need both the query to be executed when i run the script
How to solve this
Help me
I wrote unix shell program(bash) which in turn executes two sql statements
TaBLE STRUCTURE
Employee
criteriano project
ctr2 update table1 set empname='arun' where empid=1
SCRIPT
#!bin/sh
/oraclepath username/password<
update employee
set sal=sal+2000;
commit;
DECLARE result employee.project%TYPE;
i NUMBER DEFAULT 0;
j NUMBER;
BEGIN
SELECT COUNT(*) INTO j FROM employee WHERE EXISTS(SELECT * FROM employeeWHERE CRITERIANO='Crt2');
IF(j>0) THEN
DECLARE CURSOR cursorname IS SELECT * FROM employee WHERE criteriano='Crt2';
BEGIN
FOR navcursor IN cursorname
LOOP
i:=i+1;
result:=navcursor.project;
EXECUTE IMMEDIATE result;
dbms_output.put_line('Look Ma, I can print from PL/SQL!!!');
COMMIT;
END LOOP;
END;
ELSE
dbms_output.put_line('Look Ma, I can print from PL/SQL!!!');
END IF;
END
EOF
Both query gets execute successfully in query analyser
But when used in unix script 1st query gets executed not the second(i.e) cursor.
Its not able to read the cursor
I need both the query to be executed when i run the script
How to solve this
Help me
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-31-2006 02:27 AM
тАО07-31-2006 02:27 AM
Re: Error in script
What error is it giving you? How do you know it is "not able to read the cursor"?
Also, is that the actual contents of your script?
Also, is that the actual contents of your script?
Decay is inherent in all compounded things. Strive on with diligence
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-31-2006 04:08 PM
тАО07-31-2006 04:08 PM
Re: Error in script
hi
Any sql statements(insert or update or delete or cursor concept) which is placed after the update statement is not getting executed.
The concept is for given criteriano there can multiple project i need to navigate through the records for given criteria no
Help Please!!!
Any sql statements(insert or update or delete or cursor concept) which is placed after the update statement is not getting executed.
The concept is for given criteriano there can multiple project i need to navigate through the records for given criteria no
Help Please!!!
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP