ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

substring

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

  • substring

    hi, help! i need to extract the branch name from field bankname using as400/sql commandline.

    select bankname from tbBank
    sample data

    citibank - head office
    citibank - philippines
    citibank - singapore
    citibank - hongkong

    i need to output the string after (-) dash
    example output

    head office
    philippines
    singapore
    hongkong
    FYI I'm new to RPGLE

  • #2
    Re: substring

    Hi,

    try the following:

    PHP Code:
    Select BankNamesubstr(BankNameposstr(BankName'-') + 2)  as Branch
      from tbBank 
    Birgitta

    Comment


    • #3
      Re: substring

      hi Birgitta,

      i just changed substr to substring and it worked.. thank you very much..
      FYI I'm new to RPGLE

      Comment

      Working...
      X