- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Executing set of query in shell script
Operating System - HP-UX
1752311
Members
5605
Online
108786
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
Go to solution
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
тАО01-11-2007 06:47 PM
тАО01-11-2007 06:47 PM
Hi all
Does anyone know executing plsql query In oracle?
I have sets of query in script but, it dose not run because system dose not recognize sets of query is sequential.
how can I set the script to run sets of query is sequential.
First. Login in oracle
Second. Run mutiple lines of query sequential
script is below..
===================
sqlplus /nolog << EOF > /oracle/x
connect / as sysdba
set linesize 200
select 'db_name ' || value from v$parameter where name = 'db_name';
disconnect
EOF
==========================
But the output is disappointed
SQL*Plus: Release 10.2.0.2.0 - Production on Fri Jan 12 16:35:19 2007
Copyright (c) 1982, 2005, Oracle. All Rights Reserved.
SQL> Connected.
SQL> SQL> select 'db_name ' || value from v where name = 'db_name'
*
ERROR at line 1:
ORA-00942: table or view does not exist
Does anyone know executing plsql query In oracle?
I have sets of query in script but, it dose not run because system dose not recognize sets of query is sequential.
how can I set the script to run sets of query is sequential.
First. Login in oracle
Second. Run mutiple lines of query sequential
script is below..
===================
sqlplus /nolog << EOF > /oracle/x
connect / as sysdba
set linesize 200
select 'db_name ' || value from v$parameter where name = 'db_name';
disconnect
EOF
==========================
But the output is disappointed
SQL*Plus: Release 10.2.0.2.0 - Production on Fri Jan 12 16:35:19 2007
Copyright (c) 1982, 2005, Oracle. All Rights Reserved.
SQL> Connected.
SQL> SQL> select 'db_name ' || value from v where name = 'db_name'
*
ERROR at line 1:
ORA-00942: table or view does not exist
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-11-2007 06:56 PM
тАО01-11-2007 06:56 PM
Solution
Your problem is caused by the $parameter, which is interpreted by the shell instead of being forwarded to the sqlplus command.
This can be solved by escaping the '$' character with a backslash.
Your line will become:
select 'db_name ' || value from v\$parameter where name = 'db_name'
Another solution, though a bit dirty: insert before the sqlplus command the following:
parameter='$parameter'
Good luck
This can be solved by escaping the '$' character with a backslash.
Your line will become:
select 'db_name ' || value from v\$parameter where name = 'db_name'
Another solution, though a bit dirty: insert before the sqlplus command the following:
parameter='$parameter'
Good luck
Every problem has at least one solution. Only some solutions are harder to find.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-11-2007 07:08 PM
тАО01-11-2007 07:08 PM
Re: Executing set of query in shell script
Hy
Try it like that:
sqlplus -s "/ as sysdba" < set heading off feedback off verify off
select 'db_name' || value from v\$parameter where name = 'db_name';
exit;
EOF
Regards
Try it like that:
sqlplus -s "/ as sysdba" <
select 'db_name' || value from v\$parameter where name = 'db_name';
exit;
EOF
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-11-2007 08:17 PM
тАО01-11-2007 08:17 PM
Re: Executing set of query in shell script
hi,
running PL/SQL is equally easy:
$ sqlplus -s "/ as sysdba" << EOF
> declare
> mvar date;
> begin
> select sysdate into mvar from dual;
> dbms_output.put_line(mvar);
> end;
> /
> exit
> EOF
12-JAN-07
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.03
$
or
$ sqlplus -s "/ as sysdba" << EOF
> declare
> mvar varchar2(30);
> begin
> from v\$parameter where name = 'db_name';
> dbms_output.put_line(mvar);
> end;
> /
> exit
> EOF
db_name mydb
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.05
$
hope this helps too!
kind regards
yogeeraj
running PL/SQL is equally easy:
$ sqlplus -s "/ as sysdba" << EOF
> declare
> mvar date;
> begin
> select sysdate into mvar from dual;
> dbms_output.put_line(mvar);
> end;
> /
> exit
> EOF
12-JAN-07
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.03
$
or
$ sqlplus -s "/ as sysdba" << EOF
> declare
> mvar varchar2(30);
> begin
> from v\$parameter where name = 'db_name';
> dbms_output.put_line(mvar);
> end;
> /
> exit
> EOF
db_name mydb
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.05
$
hope this helps too!
kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
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