![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | 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 and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to parse the result of "set" command | teodora | Shell Programming and Scripting | 7 | 07-02-2008 12:38 PM |
| Why generate "ash and bash" different output for same bash script? | s. murat | Shell Programming and Scripting | 0 | 05-26-2008 08:19 AM |
| Parse "masters" ip from named.conf | Citricut | Shell Programming and Scripting | 2 | 04-15-2008 05:05 AM |
| Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`" | Lokesha | UNIX for Dummies Questions & Answers | 4 | 12-20-2007 01:52 AM |
| Please help formatting bash "time" variable to HH:MM:SS format | vikingshelmut | Shell Programming and Scripting | 3 | 09-15-2005 09:54 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Hi! I've a text file programme1.out : Code:
CONNECT TO ORACLE (&CONXORA);
CREATE TABLE TABLE1 AS
SELECT ID_PERS
FROM CONNECTION TO ORACLE
(
SELECT DISTINCT PERS.ID_PERS
FROM TAB_GRP GRP , TAB_PERS PERS
WHERE DATE_DEB_GRP <= &DATE_QUOTE
AND (DATE_FIN_GRP IS NULL OR DATE_FIN_GRP > &DATE_QUOTE)
AND PERS.ID_PERS = GRP.ID_PERS
AND (PERS.DATE_SUPP_SI IS NULL OR PERS.DATE_SUPP_SI > &DATE_QUOTE)
ORDER BY ID_PERS
);
DISCONNECT FROM ORACLE;
CONNECT TO ORACLE (&CONXORA);
CREATE TABLE TABLE2 AS
SELECT ID_PERS,
ID_PRODUIT,
CODE_PRODUIT,
TOP_1
TOP_2
FROM CONNECTION TO ORACLE
(
SELECT ID_PERS,
ID_PRODUIT,
CODE_PRODUIT,
MAX (CASE WHEN (CODE ='01' ) THEN 1 ELSE 0 END) AS TOP_1
MAX (CASE WHEN (CODE='02' ) THEN 1 ELSE 0 END) AS TOP_2
FROM TABLE_FROM1
WHERE CODE IN ('01','02')
AND ID_MOIS <= &ID_MOIS
GROUP BY ID_PERS,ID_PRODUIT
);
DISCONNECT FROM ORACLE;
For each query (between connect to oracle and disconnect from oracle), I have to display the name of the create table, the name of tables used (real name of the table) and the name of the columns in the SELECT. At the end, I would like an output like this : table_create ; table_from ; column_name Example : table1;tab_grp; table1;tab_pers;ID_PERS table2;table_from1;ID_PRODUIT table2;table_from1;CODE_PRODUIT table2;table_from1;TOP_1 table2;table_from1;TOP_2 Is it possible to do this easily with a script in ksh or bash (UNIX AIX IBM)? (with sed, awk..) Regards |
| Bookmarks |
| Tags |
| ksh bash sed awk |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|