Quantcast
Channel: SCN : All Content - PowerBuilder Developer Center
Viewing all articles
Browse latest Browse all 2935

How to do dynamic SQL in PB

$
0
0

To create a dynamic SQL statement in PB i did this:

 

SQLTEST = "select id,name  from ss_test where id = @i;";

DECLARE cursor_base DYNAMIC CURSOR FOR SQLSA;

PREPARE SQLSA FROM :SQLTEST;

OPEN DYNAMIC cursor_base USING :i;

FETCH cursor_base INTO :i2,:test2;

 

 

however i am getting the error "Mismatch between prepared number of substitution variables and execute parameters".. Which i don't understand? This same SQL runs on the database and the i is a int value just like in the database? What am i doing wrong?

 

I wanted to be able to do bind variables with the SQL. 


Viewing all articles
Browse latest Browse all 2935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>