Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2009
    Posts
    73

    Unhappy Unanswered: Creating a simple select procedure

    Hi I am trying to create my first stored procedure on ISeries navigator but cant get it to work, transitioning from SQL server. I am trying to execute this inside ISERIES Navigator->stored procedures -> New stored procedure-> SQL Statement

    CREATE PROCEDURE sp_test
    AS
    select * from Customer.Table1
    go;

    Its throwing up an error every time.

    Do I have to declare a cursor for the result set ? I am following the guide from this link 4GuysFromRolla.com - Writing a Stored Procedure

    Thanks, Mike.

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Quote Originally Posted by asp_crazy_guy View Post
    I am following the guide from this link 4GuysFromRolla.com - Writing a Stored Procedure
    When programming for a particular platform, it might make sense to refer to the manuals for that platform:

    Contents

  3. #3
    Join Date
    Mar 2009
    Posts
    73

    Wink

    Sorry about that, I will have a read and keep you guys posted if I still cant get it to work.

    Thanks, Mike.

  4. #4
    Join Date
    Mar 2009
    Posts
    73
    Hi just came up with this

    Create procedure Customer.SelectCustomers
    LANGUAGE SQL READS SQL DATA
    SELECT * from Customer.Customers;

    It says A syntax error was detected at token SQL. Token SQL is not a valid token. A partial list of valid tokens is C CL COBOL COBOLLE FORTRAN PLI RPG RPGLE JAVA. This list assumes that the statement is correct up to the token. The error may be earlier in the statement, but the syntax of the statement appears to be valid up to this point.

    Is a trigger necessary ? Following tutorial from here iSeries Information Center

    Update---

    tried this one as well
    Create procedure Customer.SelectCustomers()
    LANGUAGE SQL
    READS SQL DATA
    main:BEGIN
    SELECT * from Customer.Customers;
    END main


    Thanks, Mike.
    Last edited by asp_crazy_guy; 04-23-10 at 04:26.

Posting Permissions

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