SQL9010 ? - IBM AS400

This is a discussion on SQL9010 ? - IBM AS400 ; Hello. i try to start within a CL one simply SQL command. CL RUNSQLSTM SRCFILE(LIB/QCLSRC) SRCMBR(MYSQL) COMMIT(*NONE) SRCMBR-MYSQL SELECT * LIB/TEST ; I have always the error SQL9010. I wont that, the results of the SQL command appears on the ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: SQL9010 ?

  1. SQL9010 ?

    Hello.

    i try to start within a CL one simply SQL command.

    CL

    RUNSQLSTM SRCFILE(LIB/QCLSRC) SRCMBR(MYSQL) COMMIT(*NONE)


    SRCMBR-MYSQL

    SELECT * LIB/TEST ;


    I have always the error SQL9010.

    I wont that, the results of the SQL command appears on the screen.

    What is wrong here?

    thanks.

  2. Re: SQL9010 ?

    marsias schrieb:
    > Hello.
    >
    > i try to start within a CL one simply SQL command.
    >
    > CL
    >
    > RUNSQLSTM SRCFILE(LIB/QCLSRC) SRCMBR(MYSQL) COMMIT(*NONE)
    >
    >
    > SRCMBR-MYSQL
    >
    > SELECT * LIB/TEST ;

    ^^
    "from" missing?

    --
    "Warum haben wir eigentlich nie Zeit, eine Sache richtig zu machen,
    aber immer Zeit, sie noch mal zu machen?"
    'Systemdenken und Softwarequalität', Gerald Weinberg

  3. Re: SQL9010 ?

    Can't be done. RUNSQLSTM cannot be used to return a result set to the
    calling CL program.

  4. Re: SQL9010 ?

    walker.l2 wrote:
    > Can't be done. RUNSQLSTM cannot be used to return a result set to the
    > calling CL program.


    This link shows which SQL statements are allowed:

    http://publib.boulder.ibm.com/infoce...73%74%6d%22%20

    --
    Karl Hanson

  5. Re: SQL9010 ?

    To effect a near equivalent of the SQL statement "SELECT * FROM
    Lib/File" appearing on the screen, issue the following request in the
    CLP: RUNQRY QRY(*NONE) QRYFILE((Lib/File *FIRST))

    Another option is to create a QMQRY from source which has the string
    "SELECT * FROM &LIBNM/&FILENM", and then issue the request in the CLP
    to: STRQMQRY TheLib/TheQMQRY SETVAR((LIBNM 'MYLIB') (FILENM 'MYFILE'))

    In a RUNSQLSTM the query can be effected using the actual SELECT
    statement embedded in a CREATE [GLOBAL TEMPOARY] TABLE request, followed
    by the aforementioned RUNQRY:

    CREATE TABLE QTEMP.TEMP AS SELECT * FROM Lib/File
    -- may require clause WITH DATA; or instead use of the
    -- CREATE GLOBAL TEMPORARY TABLE using WITH REPLACE
    ;
    CALL QSYS.QCMDEXC ('RUNQRY *N ((QTEMP/TEMP))', 0000000024.00000)
    ;

    Note: None of the syntax in any of the above is verified; look to the
    documentation for each feature, as required.

    Regards, Chuck

+ Reply to Thread