- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Command line arguement for SQLPlus
Operating System - HP-UX
1752579
Members
4244
Online
108788
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
тАО08-07-2002 10:10 PM
тАО08-07-2002 10:10 PM
Hi all,
Just wondering if it is possible to pass command line arguement to .sql file?
E.g. SQL> abc.sql 1 2
Just like shell script accepting paramter.
Thanks,
Chris,
Just wondering if it is possible to pass command line arguement to .sql file?
E.g. SQL> abc.sql 1 2
Just like shell script accepting paramter.
Thanks,
Chris,
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-07-2002 10:15 PM
тАО08-07-2002 10:15 PM
Solution
Yes, you can.
In the SQL script file, similar to shell scripts, instead of using "$1", "$2", ..., replace it with "&1", "&2", ...
If you do not want the &1 or &2 to be definded repeatedly in the subsequent reference inside the sql scripts, use &&1, &&2, ... instead.
Regards,
Kenneth
In the SQL script file, similar to shell scripts, instead of using "$1", "$2", ..., replace it with "&1", "&2", ...
If you do not want the &1 or &2 to be definded repeatedly in the subsequent reference inside the sql scripts, use &&1, &&2, ... instead.
Regards,
Kenneth
Always take care of your dearest before it is too late
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-07-2002 11:08 PM
тАО08-07-2002 11:08 PM
Re: Command line arguement for SQLPlus
You can also run this via a script
eg
#!/bin/ksh
MYVAR=10
sqlplus user/password << EOF
select count(1)
from mytable m
where m.myrow = $MYVAR
/
EOF
eg
#!/bin/ksh
MYVAR=10
sqlplus user/password << EOF
select count(1)
from mytable m
where m.myrow = $MYVAR
/
EOF
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-08-2002 12:39 PM
тАО08-08-2002 12:39 PM
Re: Command line arguement for SQLPlus
You can pass any no. of parameters. Example
!/bin/ksh
echo "Enter Database User Name : \c "
read username
echo "Enter Password : \c "
read password
echo "Enter Employee Name : \c "
read ename
sqlplus -s << SQLEOF
${username}/${password}
SELECT *
FROM EMPLOYEE
WHERE ENAME='${ename}';
SQLEOF
Thanks
Zafar
!/bin/ksh
echo "Enter Database User Name : \c "
read username
echo "Enter Password : \c "
read password
echo "Enter Employee Name : \c "
read ename
sqlplus -s << SQLEOF
${username}/${password}
SELECT *
FROM EMPLOYEE
WHERE ENAME='${ename}';
SQLEOF
Thanks
Zafar
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