ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

left outer join in an embedded SQL

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

  • left outer join in an embedded SQL

    I am doing a left outer join in an embedded SQL. Results are read into a data structure. Problem is that if join is not made, data structure gets null and blows up. Is there a way to avoid this?

    PHP Code:
    SELECT                                 
       char 
    (F2.USER,10),                
       
    F1.USER                         
    FROM INVH F1
    LEFT OUTER JOIN INVD F2
       on 
    (F2.DOC F1.DOC

    PHP Code:

    Message 
    . . . . :   Indicator variable required.                               
                                                                                   
    Cause . . . . . :   A FETCHembedded SELECTCALLGET DESCRIPTOR, or a SET   
      
    or VALUES INTO statement has resulted in a null valuebut an indicator      
      variable was not specified 
    for host variable USER.  The relative position of 
      the host variable in the INTO clause 
    or parameter list is 8. If the host     
      variable name is 
    *Na descriptor area was specified.                        
        If 
    this error occurs on a GET DESCRIPTOR statementthe null value is      
      being returned but the INDICATOR item was not specified on the GET           
      DESCRIPTOR statement


  • #2
    Re: left outer join in an embedded SQL

    Hi,
    Use the Coalesce function to always get a value, so you can avoid a null
    select coalesce(char (F2.USER,10),''), coalesce(F1.USER ,'')
    Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

    Comment


    • #3
      Re: left outer join in an embedded SQL

      yep, that worked.

      Comment

      Working...
      X