Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

DDL script

Hi

I have a DDL script that contains creation of tables & sequences. I want to create a job for it. Plz let me know what components can I use for the same

Labels (2)
9 Replies
TRF
Champion II
Champion II

Hi,

 

tXxxxxRow (where Xxxxx is the db name, like Oracle, Mysql, and so on) is what you expect.

Anonymous
Not applicable
Author

I already tried using tOracleRow however it takes only 1 SQL query. My requirement is to execute multiple SQL queries like running a script file containing DDL statements
TRF
Champion II
Champion II

did you try to enclose commands between ""?

"create table blablabla;
create sequence blablabla;"

 

Anonymous
Not applicable
Author

Yes; I already tried that enclosing between "" & separated by ; However the error which I get is 'SQL command not properly ended'.
Anonymous
Not applicable
Author

Try this.....

 

"begin
execute immediate 'CREATE TABLE customers
( customer_id number(10) NOT NULL,
  customer_name varchar2(50) NOT NULL,
  city varchar2(50)
)';
execute immediate 'CREATE TABLE address
( address_id number(10) NOT NULL,
  address_line_1 varchar2(50) NOT NULL,
  city varchar2(50)
)';
commit;
end;"
TRF
Champion II
Champion II

Is it a plain text script or a generated one using variables and concatenation?
Can you share it?
Anonymous
Not applicable
Author

It is a normal script generated by SQL developer. It does not have variables or concatenation.
Anonymous
Not applicable
Author

In which component should I give this?
Anonymous
Not applicable
Author

The code I gave was an example of how you should code your tOracleRow component. The "Begin" and "End" keywords are standard Oracle functionality to allow multiple statements to fired together. Here is a description of the "Execute immediate" statemement (https://docs.oracle.com/cd/B19306_01/appdev.102/b14261/executeimmediate_statement.htm).