BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
John_Wick
Obsidian | Level 7

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:

 

Spoiler

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:

Spoiler
2024-11-25T20:44:33,825 TRACE [00028094] App.Statement.Statement.GetDiagRecs 458:sasdmadm@saspw - IOM RETURN
0={compRef:7f0166c5e800}->Statement::GetDiagRecs():
sqlStates=[0…1]
[0]=HY000
[1]=HY010
nativeerror=[0.1]
[0]=-2038444017 [1]=-2130708356
message text=[0.1]
[[0]=GETINTEGER for column 1 failed on result set of SQL statement: select 1 as output_var from CDM.RTDMCDM1.CI_CAMPAIGN
[1]=Function sequence error
status=[0…1]
[0]=0 [1]=0

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.

 

1 ACCEPTED SOLUTION

Accepted Solutions
John_Wick
Obsidian | Level 7

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;

 

 

View solution in original post

1 REPLY 1
John_Wick
Obsidian | Level 7

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;

 

 

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 908 views
  • 0 likes
  • 1 in conversation