This looks like you use DB2, so I will use examples for this database.
When a shell interprets commands, it consumes quotes to keep words together as a single token. The quotes will not be passed along to called programs. So the following two lines are identical:
If you want the single quotes preserved and passed to the db2 command, you have to protect them with double quotes or escape them with backslashes, like
Now, if you want the where clause to come from a variable, use this form:
Hope this helps.
Hi all,
$ echo $SHELL
/bin/bash
Requirement - How to pass oracle sql script as argument to unix shell script?
$ ./output.sh users.sql
Below are the shell scripts and the oracle sql file in the same folder.
Shell Script
$ cat output.sh
#!/bin/bash
.... (7 Replies)
Hi all
I am writing a shell script which will run a select query from a table . If the ouput is not 500 - then send a email to the team saying there is a error . But i am not sure how to redirect this output of the select query to the log file -
#!/bin/ksh
sqlplus /nolog
conect... (1 Reply)
I use below command to log in to oracle database
sqlplus username/passwordWhen i enter into sql prompt i press quitIf there are any errors it will show just below the output of sqlplus username/password. The errors generally start with keyword ORA can we do this by using a unix shell script.?... (4 Replies)
I need to compare a R$Timestamp field sql within a Unix Shell Script.
In straight SQL the following code works fine:
Table Name: LL_UNIT_TRANSACTION UT
Field: R$Timestamp
Where TRUNC(UT.R$Timestamp) >= TRUNC(SYSDATE -7)
the following returns no data within the Unix Shell Script... (2 Replies)
Hi,
I have basic knowledge on how to write pl/sql code inside shell script.
I am looking for more advance thing. Is there any book for that which can just talk about how to write more advance plsql code inside shell script.
Please help
Thanks!!!!!! (1 Reply)
I want to perform few post-session success tasks like update a status to 'true' in one of the sql database table, update date values to current system date in one of the configuration table in sql. How do i achieve this in a post session command?syntax with example will be helpful. (3 Replies)
Hi,
I need help urgently for following issue. Pls help me to resolve this issue.
I am calling sql script file(file1.sql) from UNIX Shell Script(script1.ksh) using sql plus and trying to create flat file that contains all records returned from SQL query in SQL script(file1.sql)
I given... (6 Replies)
Hi
I want to get the a field from a SQL query into unix shell script variable. the whole situation is like this.
1. Opened a cursor to a table in DB2 databse.
2. Fetching individual rows with the help of cursor.
3. Each row has 4 fields.
I want each of the field in individual shell... (1 Reply)