BookmarkSubscribeRSS Feed
Saranya_Sub
Obsidian | Level 7

Hi All,

 

   My requirement was to insert record into oracle table using DS2 code. and the below code runs in loop and insert record 

 

package _test /overwrite=yes;

dcl package SQLSTMT _slct1('INSERT INTO DSDATA."SCHEMANEME"."TAB_NAME" 

("A", "B", "C","D")
VALUES (?,?,?,?)');

 

method execute (varchar(32767) A,

varchar(32767) B,

varchar(32767) C,

varchar(32767) D);

 

_loop=sum(countc(A,','),1);


do i = 1 to _loop;

A1= scan(A,i,',');

B1= scan(B,i,',');

C1= scan(C,i,',');

D1= scan(D,i,',');

_slct1.setdouble(1,A1);
_slct1.setdouble(2,B1);
_slct1.setvarchar(3,C1);
_slct1.setvarchar(4,D1);

 rc=_slct1.execute();

 

end;

endpackage;run;

 

This was working fine and successfully inserted into oracle table.due to requirement change the Column 'C' is made as Number in oracle. So when i changed my DS2 code 

 

_slct1.setdouble(1,A1);
_slct1.setdouble(2,B1);
_slct1.setdouble(3,C1);
_slct1.setvarchar(4,D1);

 rc=_slct1.execute();

 

its inserting NULL . i tried converting the column to Number as below

 

declare int NUMERIC_C;

NUMERIC_C=inputn(C1,10.); (or) NUMERIC_C = compress(C1);

_slct1.setdouble(3,NUMERIC_C);

 

still no luck it inserted only NULL,but the remaining double values are inserting as expected.

 

Can someone pleases help me in this !!!

 

Thanks

1 REPLY 1
JamesAnderson
SAS Employee
Hi,
Have you tried explicitly declaring the data type of A1 - DC1 as double ?
Regards
James
How to improve email deliverability

SAS' Peter Ansbacher shows you how to use the dashboard in SAS Customer Intelligence 360 for better results.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 917 views
  • 0 likes
  • 2 in conversation