Hello all,
I'm very new to this and trying to write a stored procedure that will use the if/then/else control structure to check the single character field in my db and expand it to it's corresponding string for report viewing.
This is my code so far... which doesn't work:
CREATE OR REPLACE PROCEDURE replaceContact
AS
type CHAR;
CURSOR type_cursor IS
SELECT c.CONTACT_TYPE INTO type
FROM CONTACT c;
BEGIN
FOR row IN type_cursor LOOP
IF row.type = 'C' THEN
type := 'CELL';
IF row.type = 'W' THEN
type := 'WORK';
IF row.type = 'P' THEN
type := 'PAGER';
IF row.type = 'E' THEN
type := 'EMAIL';
IF row.type ='H' THEN
type := 'HOME';
END IF;
DBMS_OUTPUT.PUT_LINE(row.type);
END LOOP;
END replaceContact;
/
These are my error messsages:
Warning: Procedure created with compilation errors.
LINE/COL ERROR
-------- -----------------------------------------------------------------
26/5 PLS-00103: Encountered the symbol "LOOP" when expecting one of
the following:
if
28/19 PLS-00103: Encountered the symbol "end-of-file" when expecting
one of the following:
end not pragma final instantiable order overriding static
member constructor map
Any help is greatly appreciated =).
-lisa
I'm very new to this and trying to write a stored procedure that will use the if/then/else control structure to check the single character field in my db and expand it to it's corresponding string for report viewing.
This is my code so far... which doesn't work:
CREATE OR REPLACE PROCEDURE replaceContact
AS
type CHAR;
CURSOR type_cursor IS
SELECT c.CONTACT_TYPE INTO type
FROM CONTACT c;
BEGIN
FOR row IN type_cursor LOOP
IF row.type = 'C' THEN
type := 'CELL';
IF row.type = 'W' THEN
type := 'WORK';
IF row.type = 'P' THEN
type := 'PAGER';
IF row.type = 'E' THEN
type := 'EMAIL';
IF row.type ='H' THEN
type := 'HOME';
END IF;
DBMS_OUTPUT.PUT_LINE(row.type);
END LOOP;
END replaceContact;
/
These are my error messsages:
Warning: Procedure created with compilation errors.
LINE/COL ERROR
-------- -----------------------------------------------------------------
26/5 PLS-00103: Encountered the symbol "LOOP" when expecting one of
the following:
if
28/19 PLS-00103: Encountered the symbol "end-of-file" when expecting
one of the following:
end not pragma final instantiable order overriding static
member constructor map
Any help is greatly appreciated =).
-lisa