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

G2 Grid Leader Spring 2025.png

 

 

 

 

Want to review SAS Customer Intelligence 360? Gartner and G2 are offering a gift card or charitable donation for each accepted review. Use this link for G2 to opt out of receiving anything of value for your review.

 

Gartner.jpg

 

SAS Customer Intelligence 360

Get started with CI 360

Review CI 360 Release Notes

Open a Technical Support case

Suggest software enhancements

Assess your marketing efforts with a free tool

 

Training Resources

SAS Customer Intelligence Learning Subscription (login required)

Access free tutorials

Refer to documentation

Latest hot fixes

Compatibility notice re: SAS 9.4M8 (TS1M8) or later

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.

G2 Grid Leader Spring 2025.png

 

 

 

 

Want to review SAS Customer Intelligence 360? Gartner and G2 are offering a gift card or charitable donation for each accepted review. Use this link for G2 to opt out of receiving anything of value for your review.

 

Gartner.jpg

 

SAS Customer Intelligence 360

Get started with CI 360

Review CI 360 Release Notes

Open a Technical Support case

Suggest software enhancements

Assess your marketing efforts with a free tool

 

Training Resources

SAS Customer Intelligence Learning Subscription (login required)

Access free tutorials

Refer to documentation

Latest hot fixes

Compatibility notice re: SAS 9.4M8 (TS1M8) or later

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