Hello folks,
I have 2 files one( file1) contains the ddl for a view and file 2 contains the view defination/alias columns.
I want to merge the 2 into a third file using awk/sed as follows:
cheers !
FILE1
-----
PROMPT FIRST_VIEW
CREATE OR REPLACE FORCE VIEW FIRST_VIEW
AS
SELECT col1, col2, col3 from anytable1
where col1='X');
PROMPT SECOND_VIEW
CREATE OR REPLACE FORCE VIEW SECOND_VIEW
AS
SELECT test1, test2 from table2
where test2='TEST');
--------------------------------------------------------------
FILE2
-----
Create View TESTSCHEMA.FIRST_VIEW(
COL1,
col2,
col3)
Create View TESTSCHEMA.THIRD_VIEW(
dir1,
dir2,
dir3)
Create View TESTSCHEMA.SECOND_VIEW(
test1,
test2)
=================================================
Output file
output file:
-----------
PROMPT FIRST_VIEW
CREATE OR REPLACE FORCE VIEW FIRST_VIEW
(
COL1,
col2,
col3)
AS
SELECT col1, col2, col3 from anytable1
where col1='X');
PROMPT SECOND_VIEW
CREATE OR REPLACE FORCE VIEW SECOND_VIEW
(
test1,
test2)
AS
SELECT test1, test2 from table2
where test2='TEST');