Hi out there,
I found this forums when studying Crystal reports, and had great deal og help here. And now I have started look into the great unknown (for me) called Oracle. And I am reading PL/SQL for the moment, and reading "teach yourself PL/SQL in 21 days".
When testing a program/prosedure from this book something stopped, and I wounder if someone can give me a tip.
The test was a program to demonstrate conversion functions, the code follows:
DECLARE
d1 DATE;
d2 DATE;
d3 DATE;
d4 DATE;
n1 NUMBER;
n2 NUMBER;
n3 NUMBER;
BEGIN
-- Some common dateformats
d1 := TO_DATE('1/1/02' , 'mm/dd/yy');
d2 := TO_DATE('1-1-1998', 'mm-dd-yyyy');
d3 := TO_DATE('Jan 1, 2000', 'mon dd, yyyy');
d4 := TO_DATE('1/1/02', 'mm/dd/rr');
DBMS_OUTPUT.PUT_LINE('d1 = ' || TO_CHAR(d1, 'dd-Mon-yyyy'));
DBMS_OUTPUT.PUT_LINE('d2 = ' || TO_CHAR(d2, 'mm/dd/yyyy'));
DBMS_OUTPUT.PUT_LINE('d3 = ' || TO_CHAR(d3, 'Day, Month dd, yyyy'));
DBMS_OUTPUT.PUT_LINE('d4 = ' || TO_CHAR(d4, 'Dy, Mon dd, yyyy'));
-- The dateformats runs perfect on my machine/database
-- Some examples of numberformats.
n1 := TO_NUMBER('123.99', '999D99');
n2 := TO_NUMBER('$1,235.95', '$9G999D99');
n3 := TO_NUMBER('7,235.95', '9G999D99');
DBMS_OUTPUT.PUT_LINE('n1 = ' || TO_CHAR(n1, '999D99'));
DBMS_OUTPUT.PUT_LINE('n2 = ' || TO_CHAR(n2, '$9G999D99'));
DBMS_OUTPUT.PUT_LINE('n2 = ' || TO_CHAR(n2, '9G999D99'));
-- The only bad thing here is that this numberformats generates an
-- error during program running.
END;
/
The dateformats wors fine, but the numberformats stopped.
I am using Oracle 8i personal edition on windows 98 norwegian editions.
This function works perfect, but here is no formats on the numbersection:
DECLARE
d1 DATE;
d2 DATE;
d3 DATE;
d4 DATE;
n1 NUMBER;
n2 NUMBER;
n3 NUMBER;
BEGIN
-- En del vanlige datoformater
d1 := TO_DATE('1/1/02' , 'mm/dd/yy');
d2 := TO_DATE('1-1-1998', 'mm-dd-yyyy');
d3 := TO_DATE('Jan 1, 2000', 'mon dd, yyyy');
d4 := TO_DATE('1/1/02', 'mm/dd/rr');
DBMS_OUTPUT.PUT_LINE('d1 = ' || TO_CHAR(d1, 'dd-Mon-yyyy'));
DBMS_OUTPUT.PUT_LINE('d2 = ' || TO_CHAR(d2, 'mm/dd/yyyy'));
DBMS_OUTPUT.PUT_LINE('d3 = ' || TO_CHAR(d3, 'Day, Month dd, yyyy'));
DBMS_OUTPUT.PUT_LINE('d4 = ' || TO_CHAR(d4, 'Dy, Mon dd, yyyy'));
n1 := 123.99;
n2 := 1235.95;
n3 := 7650.23;
DBMS_OUTPUT.PUT_LINE('n1 = ' || n1);
DBMS_OUTPUT.PUT_LINE('n2 = ' || n2);
DBMS_OUTPUT.PUT_LINE('n2 = ' || n2);
END;
/
Someon who can give me an explonation of what might be wrong?
Kind regard Stig
I found this forums when studying Crystal reports, and had great deal og help here. And now I have started look into the great unknown (for me) called Oracle. And I am reading PL/SQL for the moment, and reading "teach yourself PL/SQL in 21 days".
When testing a program/prosedure from this book something stopped, and I wounder if someone can give me a tip.
The test was a program to demonstrate conversion functions, the code follows:
DECLARE
d1 DATE;
d2 DATE;
d3 DATE;
d4 DATE;
n1 NUMBER;
n2 NUMBER;
n3 NUMBER;
BEGIN
-- Some common dateformats
d1 := TO_DATE('1/1/02' , 'mm/dd/yy');
d2 := TO_DATE('1-1-1998', 'mm-dd-yyyy');
d3 := TO_DATE('Jan 1, 2000', 'mon dd, yyyy');
d4 := TO_DATE('1/1/02', 'mm/dd/rr');
DBMS_OUTPUT.PUT_LINE('d1 = ' || TO_CHAR(d1, 'dd-Mon-yyyy'));
DBMS_OUTPUT.PUT_LINE('d2 = ' || TO_CHAR(d2, 'mm/dd/yyyy'));
DBMS_OUTPUT.PUT_LINE('d3 = ' || TO_CHAR(d3, 'Day, Month dd, yyyy'));
DBMS_OUTPUT.PUT_LINE('d4 = ' || TO_CHAR(d4, 'Dy, Mon dd, yyyy'));
-- The dateformats runs perfect on my machine/database
-- Some examples of numberformats.
n1 := TO_NUMBER('123.99', '999D99');
n2 := TO_NUMBER('$1,235.95', '$9G999D99');
n3 := TO_NUMBER('7,235.95', '9G999D99');
DBMS_OUTPUT.PUT_LINE('n1 = ' || TO_CHAR(n1, '999D99'));
DBMS_OUTPUT.PUT_LINE('n2 = ' || TO_CHAR(n2, '$9G999D99'));
DBMS_OUTPUT.PUT_LINE('n2 = ' || TO_CHAR(n2, '9G999D99'));
-- The only bad thing here is that this numberformats generates an
-- error during program running.
END;
/
The dateformats wors fine, but the numberformats stopped.
I am using Oracle 8i personal edition on windows 98 norwegian editions.
This function works perfect, but here is no formats on the numbersection:
DECLARE
d1 DATE;
d2 DATE;
d3 DATE;
d4 DATE;
n1 NUMBER;
n2 NUMBER;
n3 NUMBER;
BEGIN
-- En del vanlige datoformater
d1 := TO_DATE('1/1/02' , 'mm/dd/yy');
d2 := TO_DATE('1-1-1998', 'mm-dd-yyyy');
d3 := TO_DATE('Jan 1, 2000', 'mon dd, yyyy');
d4 := TO_DATE('1/1/02', 'mm/dd/rr');
DBMS_OUTPUT.PUT_LINE('d1 = ' || TO_CHAR(d1, 'dd-Mon-yyyy'));
DBMS_OUTPUT.PUT_LINE('d2 = ' || TO_CHAR(d2, 'mm/dd/yyyy'));
DBMS_OUTPUT.PUT_LINE('d3 = ' || TO_CHAR(d3, 'Day, Month dd, yyyy'));
DBMS_OUTPUT.PUT_LINE('d4 = ' || TO_CHAR(d4, 'Dy, Mon dd, yyyy'));
n1 := 123.99;
n2 := 1235.95;
n3 := 7650.23;
DBMS_OUTPUT.PUT_LINE('n1 = ' || n1);
DBMS_OUTPUT.PUT_LINE('n2 = ' || n2);
DBMS_OUTPUT.PUT_LINE('n2 = ' || n2);
END;
/
Someon who can give me an explonation of what might be wrong?
Kind regard Stig