Hello, experts
When I try to make a simple query select and put the result into a variable on Federation Server using DS2 code, I get the following error
EG log:
ERROR: Function sequence error
ERROR: GETINTEGER for column 1 failed on result set of SQL Statement: select 1 from CDM.RTDMCDM1.CI_CAMPAIGN
Federation server log:
The code looks like this:
proc ds2;
data _NULL_;
method run();
dcl int output_var;
dcl package sqlstmt s('SELECT 1 FROM CDM.RTDMCDM1.CI_CAMPAIGN');
output_var = s.getInt(1);
end;
enddata;
run;
quit;
Can you tell me what this error might be related to?
This problem is observed with functions like getInt, getchar, etc.
I apologise, my mistake. The problem was that I used functions incorrectly.
To make my code work, you need to add additional lines:
proc ds2;
data _NULL_;
method run();
dcl int output_var;
dcl package sqlstmt s('SELECT 1 FROM CDM.RTDMCDM1.CI_CAMPAIGN');
s.execute();
s.fetch();
output_var = s.getInt(1);
end;
enddata;
run;
quit;
I apologise, my mistake. The problem was that I used functions incorrectly.
To make my code work, you need to add additional lines:
proc ds2;
data _NULL_;
method run();
dcl int output_var;
dcl package sqlstmt s('SELECT 1 FROM CDM.RTDMCDM1.CI_CAMPAIGN');
s.execute();
s.fetch();
output_var = s.getInt(1);
end;
enddata;
run;
quit;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.