Re: calling stored procedures from 4GL
Posted in 1997
Ed, It seems that your problem lies within your SP. let buf_pattern = '*', pattern, '*'; Because this is a SP to concatenate values to a variable you need to use the SQL concatenation operator '||' instead of your commas. let buf_pattern = '*'||pattern||'*'; This should fix your problem. Joe ------------------------------------------------------------------------- Joseph Cullipher |E-mail: joseph@cannonexpress.com PO Box 364 |opinions express are those of my own and Springdale, AR 72764 USA |don't necessarily reflect those of my company ------------------------------------------------------------------------- On 10 Sep 1997, Ed Schaefer wrote: } } Greetings: } } Given: } Unix: SCO } Engine: 7.23 Online } 4GL: 6.04 } } I'm new to stored procedures and I'm trying to call a Stored Procedure } from } a 4GL program. I'm trying to call a stored procedure, sp_in_string, } which } checks if a substring is a string. Here's the 4GL stub: } } database "testdb" } } main } define x integer, } pattern char(20), } src char(80), } s1 char(80) } } let s1 = "execute procedure sp_in_string (?, ?)" } prepare stmt_s3 FROM s1 } declare proc_ptr cursor for stmt_s3 } } let pattern = "MM" } let src = "Its inMM here" } open proc_ptr using pattern, src } while true } fetch proc_ptr into x } if sqlca.sqlcode != 0 } then } exit while } end if } end while } } end main # End program } } The problem is I'm getting a runtime syntax error: 661 } } The number of variables on the left side of a LET statement does not } match the number of values on the right side. } } CAN ANYONE POINT OUT MY ERROR? Thanks! } } Here's the Stored Procedure. syntax appears correct: } } create procedure sp_in_string(pattern char(50), source_string } char(512)) } returning int; } define pat_len, source_len, i smallint; } define buf_pattern char(50); } } let pat_len = length(pattern); } if pat_len = 0 } then } return 1; } end if } let buf_pattern = '*', pattern, '*'; } if buf_pattern matches source_string } then } return 1; } end if } } return 0; } } end procedure -- sp_inst } document } 'return true if pattern within source_string'; }