2

I am working in ASA 11 with store procedures. Example:

CREATE PROCEDURE "DBA"."pa_select_employ"(
        @cod nVARCHAR(10),
        @name nvarchar(15) OUTPUT)
BEGIN
    SELECT @name=name_employ FROM EMPLOY //the line 6
    WHERE COD_EMPLOY=@cod
END

Send the variable @cod and need result @name OUTPUT

Can't Save but shows message:

The procedure 'xxx' could not be modified in the database. Syntax error near '@name' on line 6 [Sybase][ODBC Driver][SQL Anywhere]Syntax error near '@name' on line 6 SQLCODE: -131 SQLSTATE: 42000

In the Interactive SQL the select is OK.

DECLARE @name varchar(15)
 SELECT @name=name_employ FROM EMPLOY
    WHERE COD_EMPLOY='333333' 

please help me find the syntax error? (I speak Spanish.)

hcovenas
  • 21
  • 1
  • 4

3 Answers3

1

Try changing the procedure definition to:

CREATE PROCEDURE "DBA"."pa_select_employ"(
    IN @cod nVARCHAR(10),
    OUT @name nvarchar(15))
BEGIN
    SELECT @name=name_employ FROM EMPLOY //the line 6
    WHERE COD_EMPLOY=@cod
END
Stephen
  • 2,027
  • 2
  • 22
  • 26
0

Yes how thw prodedure es ok, but in Powerbuilder show te error ERRORSQLSTATE = S1105
[Sybase][ODBC Driver]Invalid parameter type

DECLARE pa_find_name PROCEDURE FOR pa_select_employ
cod =:sle_cod.text, //input
name =: sle_name.text ; //out
EXECUTE pa_find_name;

IF SQLCA.sqlcode<>0 THEN
MESSAGEBOX("","ERROR" + SQLCA.sqlerrtext )
END IF

hcovenas
  • 21
  • 1
  • 4
0

thanks, it was solved. Try changing the procedure definition

hcovenas
  • 21
  • 1
  • 4