Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Extract string until space or a new line character

KVBOct 8 2020 — edited Oct 8 2020

Hi All,
I struck up extracting of a string satisfying 2 conditions. I have a string and want to extract until a space or new line character is encountered.I m not able to represent the text here .I am able to achieve individual one's but not combinedly.
Here is the data.
e.g.I want to extract the view name, i am finding space between the view keyword and end of the view.sometimes there is a new line character as well.

CREATE TABLE V(DEFINITION VARCHAR2(100));
INSERT INTO V VALUES('CREATE OR REPLACE VIEW PRODUCER_V AS SELECT * FROM PRODUCER P LEFT JOIN PROD P1 ON P.ID=P1.ID');
INSERT INTO V VALUES('CREATE OR REPLACE VIEW PRODUCER_FTR_V'||/n||'AS SELECT * FROM PRODUCER_V P LEFT JOIN PROD P2 ON P.ID=P1.ID');
COMMIT;

SELECT * FROM V;

Appreciate any help on this.

This post has been answered by Frank Kulash on Oct 8 2020
Jump to Answer
Comments
Post Details
Added on Oct 8 2020
1 comment
4,248 views