Select substring from clob-field with sql

2555 pts.
Tags:
Embedded SQL
RPG
SQL
SUBSTR
Variable Length Subnet Mask
How do you copy substring from clob-field with SQL if substring from/to positions are varables? This works OK (RPG free w embedded sql): exec sql select substr(myclobfield, 25, 70)                 INTO :mystring                 FROM MYLIB/MYFILE; [/pre] Whereas this causes a compilation error: from = 25; to    = 70; exec sql select substr(myclobfield, :from, :to)                 INTO :mystring                 FROM MYLIB/MYFILE; [/pre] The compile error follows: MSG ID  SEV  RECORD  TEXT SQL0171  30      27  Position 1 Argument 2 of function SUBSTRING not valid. SQL0171  30      27  Position 1 Argument 3 of function SUBSTRING not valid. [/pre] Pls explain why this does not work, and please give hint on how to circomvent; - since the positions in the clob-field content are changing from record to record, the application need the from/to positions to be variables. DanF

Software/Hardware used:
Power System i, v6r1, ilerpg, sql

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • philpl1jb
    Try structuring the from and to variables 10I,0. It appears that this fuction requires interger type. Phil
    50,860 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following