Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I use perl to do this?

Status
Not open for further replies.

stagebi

Programmer
May 18, 2009
10
FR
Hi!
I'm not really "programmer" but I have to do a script.
The purpose of this script is to have something like this on input :

Code:
CREATE TABLE : prg1;TAB1 AS
SELECT : prg1;COL1,COL2,COL3
FROM : prg1;TABLEFROM

CREATE TABLE : prg1;TAB2 AS
SELECT : prg1;ALIAS1.COL1,ALIAS2.COL2
FROM : prg1;TABLEFROM1 ALIAS1, TABLEFROM2 ALIAS2

and like this on output :

Code:
prg1;TAB1;TABLEFROM;COL1
prg1;TAB1;TABLEFROM;COL2
prg1;TAB1;TABLEFROM;COL3

prg1;TAB2;TABLEFROM1;COL1
prg1;TAB2;TABLEFROM2;COL2

Can I do this easily with perl?

The input file is an simplify exemple, I paste you a real data file :

Code:
CREATE TABLE : programme1.out;TABLE1 AS
SELECT : programme1.out; DISTINCT PERS.ID_PERS
FROM : programme1.out;TAB_GRP GRP , TAB_PERS PERS
CREATE TABLE : programme1.out;TABLE2 AS
SELECT : programme1.out;ID_PERS,
FROM : programme1.out;TABLE_FROM1

Regards
 
So with the real input file:

Code:
CREATE TABLE : programme1.out;TABLE1 AS
SELECT : programme1.out; DISTINCT PERS.ID_PERS
FROM : programme1.out;TAB_GRP GRP , TAB_PERS PERS
CREATE TABLE : programme1.out;TABLE2 AS
SELECT : programme1.out;ID_PERS,
FROM : programme1.out;TABLE_FROM1

What should the output be?

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Hi,
The output should be something like this :

Code:
programme1.out;TABLE1;TAB_PERS;DISTINCT ID_PERS (or just ID_PERS, DISTINCT only if it's possible but not essential)
programme1.out;TABLE2;TABLE_FROM1;ID_PERS
 
Sorry, but "something like this" is not good enough. Be specific.

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Soory, so the outpu should be :

Code:
programme1.out;TABLE1;TAB_PERS;ID_PERS
programme1.out;TABLE2;TABLE_FROM1;ID_PERS

Thanks
 
Can you explain why the output is like that? From just looking at your input and desired output I can't see any logical reason why it should be what you have posted.

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top