ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

SQL Select statement in SQLRPGLE

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • SQL Select statement in SQLRPGLE

    Hi All,

    How to Select without listing every field in the row.
    The record (Row) is moved to DS.

    Like Ex: Select * into :Myds from File1 where Field1 = DS1;

    But it is not working, Please help me.

    Thanks,
    Vishal

  • #2
    Re: SQL Select statement in SQLRPGLE

    Hi,

    to help we need more specific information.
    If you have some problems wiht embedded SQL please check the SQLCOD or SQLSTT immediately after each statement.

    Birgitta

    Comment


    • #3
      Re: SQL Select statement in SQLRPGLE

      replace the "*" with the column or field name. Separate with commas if you want multiple fields.

      Comment


      • #4
        Re: SQL Select statement in SQLRPGLE

        Define an external DS like :

        Code:
        D MyFile        e ds                  extname([I]MyFile[/I])   
        
        Exec SQL Select * into :MyFile from File1 where Field1 = :DS1;
        The result table can contain only one row. If more than one row is returned the result is unpredictable. The DECLARE CURSOR, OPEN, and FETCH statements must be used to process more than one result row.
        Philippe

        Comment

        Working...
        X