COGNOiSe.com - The IBM Cognos Community

ETL, App Development and other tools => COGNOS DecisionStream/Data Manager => Topic started by: LEO on 11 Aug 2010 03:55:13 AM

Title: How to insert user defined variable values using a SQL Node?
Post by: LEO on 11 Aug 2010 03:55:13 AM
I have created a job stream...it has certain condition as well..have placed a sql node to insert/capture that variable value into database table...but unable to read the variable values in insert statement

i have mentioned the insert as below:

insert into x_dbvalues
values($chkVar,'s');

the values $chkVar is a texttype of column in table.
Title: Re: How to insert user defined variable values using a SQL Node?
Post by: MFGF on 27 Aug 2010 04:31:35 AM
To use a variable in a SQL node, you will need to include it in a pair of braces {} - ie

insert into x_dbvalues
values({$chkVar},'s');

Alternatively, do this from a Procedure Node using a SQL() function.

Regards,

MF.
Title: Re: How to insert user defined variable values using a SQL Node?
Post by: LEO on 21 Jan 2011 12:44:23 AM
SQL() would help in such statements to run:

To run the below SQL statement
--------------
insert into x_dbvalues
values($chkVar,'s');
--------------
Use below code:

$QUERY := CONCAT('INSERT INTO x_dbvalues VALUES(','''',$chkVar,''',''s'')');
SQL('TARGET', $QUERY);

Use of {}, will result in substituting of default values assigned to the variable while inserting rahther than the changed value in variable.