executing a set of sql queries in a job

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

pranay
Participant
Posts: 20
Joined: Mon Jan 09, 2006 3:34 pm

Post by pranay »

is ur problem resolved.
pranay wrote:you need to create the stored proc in the database first and then call it through datastage.
kirankota79 wrote:
pranay wrote:the first stage would be a ODBC stage with a user defined SQl. The SQL can be anything that returns atlest one row and can trigger teh job. Lets say it can be select 1 from Dual. The column defination can be a single column temp. Pass thsi column to the next stored procedure stage. in the stored proc use a input parameter whch can be mapped to thsi column. This parameter has to be used as a dummy. This stored proc can have all the sql scripts that u want to execute. The problem with this approch is that ur return value from teh database to datastage would be true always. and u have no way to verify from datastage that ur scripts ran fine.
Hope this explanation is clear to u.



do i need to create the procedure on the database first? Is it not possible to use the sql procedure directly in the stored procedure stage and run the job against the tables.
Pranay
Seatte, WA
kirankota79
Premium Member
Premium Member
Posts: 315
Joined: Tue Oct 31, 2006 3:38 pm

Post by kirankota79 »

i have to ask the database team if they allow me to create a procedure on their database. Once i do this, i will let you know.

Thanks for all your responses!
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Before you go too far, you've never said what kind of "queries" these sets are. Insert/Update DML? Then your sproc idea could work. Select type stuffs? Not so much.
-craig

"You can never have too many knives" -- Logan Nine Fingers
kirankota79
Premium Member
Premium Member
Posts: 315
Joined: Tue Oct 31, 2006 3:38 pm

Post by kirankota79 »

all the sql statements are update statements. each query update a "comments" column of long data type in different tables. Since datastage cannot handle lond datatypes and i have to use go with this process on all the tables that has a comments column with long type. Does this makes sense?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Yup. A LONG, eh? Yuck.
-craig

"You can never have too many knives" -- Logan Nine Fingers
kirankota79
Premium Member
Premium Member
Posts: 315
Joined: Tue Oct 31, 2006 3:38 pm

Post by kirankota79 »

Is it not possible to create the procedure if my userid has the privileges through a role instead of direct privileges for tables? Even after granting the privilege "create Procedure" i am getting into ORA-01031-insufficient privileges errors

I came to know in order to compile the procedure , you need to have direct privileges on the tables that you use in the block of the procedure instead through a role. Is it right?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Yup, you need a direct grant, something your DBA should be able to confirm for you.
-craig

"You can never have too many knives" -- Logan Nine Fingers
kirankota79
Premium Member
Premium Member
Posts: 315
Joined: Tue Oct 31, 2006 3:38 pm

Post by kirankota79 »

pranay wrote:the first stage would be a ODBC stage with a user defined SQl. The SQL can be anything that returns atlest one row and can trigger teh job. Lets say it can be select 1 from Dual. The column defination can be a single column temp. Pass thsi column to the next stored procedure stage. in the stored proc use a input parameter whch can be mapped to thsi column. This parameter has to be used as a dummy. This stored proc can have all the sql scripts that u want to execute. The problem with this approch is that ur return value from teh database to datastage would be true always. and u have no way to verify from datastage that ur scripts ran fine.
Hope this explanation is clear to u.
[/quote]

I have created the procedure...and can you be more specific how you mapped the input column. Do you need to declare a variable in procedure so that it can match the input column just to trigger the job?
kirankota79
Premium Member
Premium Member
Posts: 315
Joined: Tue Oct 31, 2006 3:38 pm

Post by kirankota79 »

can you let me know how the mapping is done.

i am getting the following errors:

ODBC: When checking operator: When binding output interface field "DUMMY" to field "DUMMY": Converting nullable source to non-nullable result; fatal runtime error could occur (use modify operator to specify value to which null should be converted)

ToUpdate,0: Info: ToUpdate: BEGIN SCOTT.MASKCOMMENTS(:1); END;
Info: ToUpdate: Using NLS map ISO-8859-1

ToUpdate,0: Warning: ToUpdate: The value of the row is: DUMMY = X

ToUpdate,0: Failure during execution of operator logic.

ToUpdate,0: Input 0 consumed 1 records.

APT_CombinedOperatorController,0: Fatal Error: Fatal: ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'MASKCOMMENTS' ORA-06550: line 1, column 7: PL/SQL: Statement ignored

node_node1: Player 1 terminated unexpectedly.
kirankota79
Premium Member
Premium Member
Posts: 315
Joined: Tue Oct 31, 2006 3:38 pm

Post by kirankota79 »

i have done this on my test database (on my PC). It is working and i have to test this on the real database...once once i am done with it , i will tag it as resolved!

thanks for all the suggestions.
Post Reply