Hi,
how do we find the value GZ120804 from the string "978/955086/GZ120804/10-FEB-12"
*Not to use like operator instead pointing the exact location of the string
*The length of the original value may differ.
Thanks & Regards,
Navin Kumar G
Moderator: Tim...
CREATE TABLE t1 (
col1 VARCHAR2(100)
);
INSERT INTO t1 VALUES ('978/955086/GZ120804/10-FEB-12');
INSERT INTO t1 VALUES ('97/95508/BANANA/10-FEB-12');
COMMIT;
SELECT SUBSTR(col1, INSTR(col1,'/',1,2)+1, INSTR(col1,'/',1,3)-INSTR(col1,'/',1,2)-1)
FROM t1;
SUBSTR(COL1,INSTR(COL1,'/',1,2)+1,INSTR(COL1,'/',1,3)-INSTR(COL1,'/',1,2)-1)
----------------------------------------------------------------------------------------------------
GZ120804
BANANA
2 rows selected.
test@db11g>SELECT REGEXP_SUBSTR(col1, '[^/"]*', 1, 5)
FROM t1;
REGEXP_SUBSTR(COL1,'[^/"]*',1,5)
----------------------------------------------------------------------------------------------------
GZ120804
BANANA
2 rows selected.
test@db11g>Return to Oracle PL/SQL Development
Users browsing this forum: No registered users and 1 guest