![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| script for nested rlogin and telnet | mcburke38 | Shell Programming and Scripting | 5 | 03-06-2008 02:05 PM |
| sed in awk ? or nested awk ? | varungupta | UNIX for Advanced & Expert Users | 11 | 02-08-2008 06:34 AM |
| Nested Arrays | guysporty | Shell Programming and Scripting | 5 | 04-13-2005 04:44 AM |
| nested read | TioTony | Shell Programming and Scripting | 2 | 03-05-2004 11:11 AM |
| Nested calls | omran | Shell Programming and Scripting | 6 | 08-16-2002 01:18 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
can nested SQl be run in Unix Script?
can nested SQl be run in Unix Script?
I tried some and found only simply sql(one select) can work well in unix script. |
| Forum Sponsor | ||
|
|
|
|||
|
If you mean:
a) can this nested SQL be run in a shell script? Code:
{
sqlplus un/pw <<EOF
select col_a
, col_b
from table_a a
where exists (
select 1
from table_b b
where a.col_a = b.col_b
);
EOF
} | while read COL_A COL_B
do
echo $COL_A $COL_B
done
or b) can this nested SQL be run in a shell script? Code:
{
sqlplus un/pw <<EOF
select col_a
from table_a a;
EOF | while read COL_A
do
sqlplus un/pw <<EOF
select col_c
from table_b
where col_a = ${COL_A};
EOF
} | while read COL_B
do
echo ${COL_B}
done
done
Last edited by tmarikle; 09-20-2005 at 08:13 PM. |
|
|||
|
Code:
{
typeset IFS='
'
sqlplus -s un/pw <<EOF
select t.table_name, c.column_name
from
(select table_name
,column_name
from all_tab_columns) c
,(select table_name
from all_tables) t
where t.table_name = c.table_name
and t.table_name = 'PLAN_TABLE'
;
EOF
} | while read line
do
echo "$line"
done
TABLE_NAME COLUMN_NAME
------------------------------ ------------------------------
PLAN_TABLE STATEMENT_ID
PLAN_TABLE TIMESTAMP
PLAN_TABLE REMARKS
PLAN_TABLE OPERATION
PLAN_TABLE OPTIONS
PLAN_TABLE OBJECT_NODE
PLAN_TABLE OBJECT_OWNER
...
27 rows selected.
|
|
|||
|
Quote:
|
|||
| Google The UNIX and Linux Forums |