SUBSTR(string,<i>,<j>) i is start point joint is length from start point.
I have been reading on this and SUBSTR is supposed read from back of string when the <j> portion is negative as long as the <i> portion is not 0 or negative. My code:
set serveroutput on size 2000
DECLARE
s1 VARCHAR2(2000);
BEGIN
s1:='123456789';
DBMS_OUTPUT.PUT_LINE('name '||substr(s1,1,-3));
END;
The output I get is ::
name
When I expect ::
name 789
I can program around this from the front, I just don't like it when things don't work how they are explained. Am I wrong or have misinterpreted the directions? I don't think I have but it could be a possiblity. Please help.
Thanks
I have been reading on this and SUBSTR is supposed read from back of string when the <j> portion is negative as long as the <i> portion is not 0 or negative. My code:
set serveroutput on size 2000
DECLARE
s1 VARCHAR2(2000);
BEGIN
s1:='123456789';
DBMS_OUTPUT.PUT_LINE('name '||substr(s1,1,-3));
END;
The output I get is ::
name
When I expect ::
name 789
I can program around this from the front, I just don't like it when things don't work how they are explained. Am I wrong or have misinterpreted the directions? I don't think I have but it could be a possiblity. Please help.
Thanks