Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2003

    Unhappy Unanswered: Problem creating Store procedure

    Sorry, my english is not good.
    Recently my company bought an iSeries with OS/400 V5r2 and I am creating a Store Procedure with "Create Procedure ... Language SQL.." whith Client Acces and startsql and this happens:

    ID de mensajeQL0104

    Causa . . . . . : Se ha detectado un error de sintaxis en el símbolo SQL. El símbolo SQL no es un símbolo válido. Una lista parcial de símbolos válidos es C CL COBOL COBOLLE FORTRAN PLI RPG RPGLE JAVA. Esta lista asume que la sentencia es correcta hasta el símbolo. El error puede estar anteriormente en la sentencia, pero la sintaxis de la sentencia aparece como válida hasta este punto.Recuperación . : Efectúe una o más de las siguientes acciones y vuelva a intentar la petición:-- Verifique la sentencia SQL en el área del símbolo SQL. Corrija la sentencia. El error podría ser la omisión de una coma o comillas; podría tratarse de una palabra con errores ortográficos, o podría estar relacionado con el orden de las cláusulas.-- Si el símbolo de error es <FIN DE SENTENCIA>, corrija la sentencia SQL porque no finaliza con una cláusula válida.

    I do not understand, because I followed the following instructions (What happens? , what am I making bad?)

    Defining a stored procedure using iSeries Navigator <rbafymst02.htm>
    If you want to call a program as a procedure from an SQL program, you must first define the program as an external procedure. The program for which a procedure is defined does not need to exist at the time the procedure is defined.
    To define a program as a procedure, do the following:
    In the iSeries Navigator window, expand your server -> Databases -> the database that you want to work with-> Libraries.
    Right-click on the library in which you want to define the function and select New.
    Select Procedure.
    Select External to create an external stored procedure.
    Select SQL to create an SQL stored procedure.
    For more information about creating and defining SQL stored procedures, see Defining an SQL procedure <rbafymstsqlproc.htm>.
    The CREATE PROCEDURE statement for SQL procedures:
    Names the procedure
    Defines the parameters and their attributes
    Provides other information about the procedure which will be used when the procedure is called
    Defines the procedure body. The procedure body is the executable part of the procedure and is a single SQL statement.
    Consider the following simple example that takes as input an employee number and a rate and updates the employee's salary:
    This CREATE PROCEDURE statement:
    Names the procedure UPDATE_SALARY_1.
    Defines parameter EMPLOYEE_NUMBER which is an input parameter and is a character data type of length 6 and parameter RATE which is an input parameter and is a decimal data type.
    Indicates the procedure is an SQL procedure that modifies SQL data.
    Defines the procedure body as a single UPDATE statement. When the procedure is called, the UPDATE statement is executed using the values passed for EMPLOYEE_NUMBER and RATE.
    Instead of a single UPDATE statement, logic can be added to the SQL procedure using SQL control statements. SQL control statements consist of the following:
    an assignment statement
    a CALL statement
    a CASE statement
    a compound statement
    a FOR statement
    a GET DIAGNOSTICS statement
    a GOTO statement
    an IF statement
    an ITERATE statement
    a LEAVE statement
    a LOOP statement
    a REPEAT statement
    a RESIGNAL statement
    a RETURN statement
    a SIGNAL statement
    a WHILE statement

    Símbolo SQL no válido. Símbolos válidos: C CL COBOL COBOLLE FORTRAN PLI RPG RPGLE JAVA.

  2. #2
    Join Date
    Aug 2004
    "Se ha detectado un error de sintaxis en el símbolo SQL"

    You specified that the language was SQL, but your parser doesn't recognize that as a language. Either leave off that clause or switch it to the language specifier that matches the language used for the stored procedure text.

  3. #3
    Join Date
    Jan 2005
    Rio de Janeiro - Brazil
    Can you, please, post the CREATE PROCEDURE statement you issued and returned that error?

    I don´t know much about DB2 on AS/400, but, just out of curiosity, did you use the EXTERNAL clause on that statement?

    Other option would be to check if all statements within the procedure are valid on SQL Procedures or if they´re only supported on External Procedures.

    Fernando Ohana.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts