Difference
am 09.01.2006 07:18:49 von minalacThis is a multi-part message in MIME format.
------=_NextPart_000_001F_01C61512.A7A32780
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Can anyone tell me why the same function tried on POSTGRESQL 7.4 works =
but does nor work on POSTGRESQL 8.0. Is there any difference in the way =
POSTGRES handles functions in version 8.0
CREATE OR REPLACE FUNCTION sp_delete_course()
RETURNS text AS
'
Declare
COURSEID VARCHAR(20);=20
NEWCOURSEID VARCHAR(20);
SET NEWCOURSEID =3D ''ARC'' + COURSEID;
INSERT INTO ARCHIVE_ETL..COURSEMASTER SELECT * FROM COURSEMASTER WHERE =
COURSEID =3D COURSEID;
INSERT INTO ARCHIVE_ETL..TOPICS SELECT * FROM TOPICS WHERE COURSEID =3D =
COURSEID;
INSERT INTO ARCHIVE_ETL..COURSESENROLLED SELECT * FROM COURSESENROLLED =
WHERE COURSEID =3D COURSEID;
INSERT INTO ARCHIVE_ETL..SKILLS SELECT * FROM SKILLS WHERE COURSEID =3D =
COURSEID;
INSERT INTO ARCHIVE_ETL..REGISTER SELECT =
R.ID,R.STUDENTID,R.FNAME,R.MNAME,R.LNAME,R.ADDRESS,R.CITY,R. STATE,R.PINCO=
DE,R.TEL,R.EMAIL,R.DOB,R.SEX,R.RELIGION,R.NATIONALITY,R.LANG UAGEK,R.PROFE=
SSION,R.QUALIFICATION,R.EXPERIENCE,R.COMPANYNAME,R.SPECIALIT Y,R.PASSWORD,=
R.ENROLLDATE,R.CARDID FROM REGISTER R INNER JOIN COURSESENROLLED C ON =
R.STUDENTID=3DC.STUDENTID AND R.FNAME=3DC.STUDENTNAME WHERE =
C.COURSEID=3DCOURSEID
INSERT INTO ARCHIVE_ETL..TRAINERMASTER SELECT =
T.INSTRUCTORID,T.TITE,T.FIRSTNAME,T.LASTNAME,T.DESIGNATION,T .QUALIFICATIO=
N,T.ADDRESS,T.TEL,T.EMAILID,T.PASSWORD FROM TRAINERMASTER T INNER JOIN =
SKILLS S ON T.INSTRUCTORID=3DS.INSTRUCTORID WHERE S.COURSEID =3D =
COURSEID
UPDATE ARCHIVE_ETL..COURSEMASTER SET COURSEID =3D NEWCOURSEID WHERE =
COURSEID =3D COURSEID
UPDATE ARCHIVE_ETL..TOPICS SET COURSEID =3D NEWCOURSEID WHERE COURSEID =
=3D COURSEID
UPDATE ARCHIVE_ETL..COURSESENROLLED SET COURSEID =3D NEWCOURSEID WHERE =
COURSEID =3D COURSEID
UPDATE ARCHIVE_ETL..SKILLS SET COURSEID =3D NEWCOURSEID WHERE COURSEID =
=3D COURSEID
DELETE COURSEMASTER WHERE COURSEID =3D COURSEID
DELETE TOPICS WHERE COURSEID =3D COURSEID
DELETE COURSESENROLLED WHERE COURSEID =3D COURSEID
DELETE SKILLS WHERE COURSEID =3D COURSEID
'
LANGUAGE 'plpgsql' VOLATILE;
I get the following error...
ERROR: type "newcourseid" does not exist
CONTEXT: compile of PL/pgSQL function "sp_delete_course" near line 4
------=_NextPart_000_001F_01C61512.A7A32780
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
charset=3Diso-8859-1">
function tried on=20
POSTGRESQL 7.4 works but does nor work on POSTGRESQL 8.0. Is there any=20
difference in the way POSTGRES handles functions in version =
8.0
sp_delete_course()
RETURNS text AS
'
Declare
COURSEID =
VARCHAR(20);
NEWCOURSEID VARCHAR(20);
SET NEWCOURSEID =3D ''ARC'' =
+=20
COURSEID;
SELECT * FROM=20
COURSEMASTER WHERE COURSEID =3D COURSEID;
INSERT INTO =
ARCHIVE_ETL..TOPICS=20
SELECT * FROM TOPICS WHERE COURSEID =3D COURSEID;
INSERT INTO=20
ARCHIVE_ETL..COURSESENROLLED SELECT * FROM COURSESENROLLED WHERE =
COURSEID=20
=3D COURSEID;
INSERT INTO ARCHIVE_ETL..SKILLS SELECT * FROM SKILLS =
WHERE=20
COURSEID =3D COURSEID;
INSERT INTO ARCHIVE_ETL..REGISTER SELECT=20
R.ID,R.STUDENTID,R.FNAME,R.MNAME,R.LNAME,R.ADDRESS,R.CITY,R. STATE,R.PINCO=
DE,R.TEL,R.EMAIL,R.DOB,R.SEX,R.RELIGION,R.NATIONALITY,R.LANG UAGEK,R.PROFE=
SSION,R.QUALIFICATION,R.EXPERIENCE,R.COMPANYNAME,R.SPECIALIT Y,R.PASSWORD,=
R.ENROLLDATE,R.CARDID=20
FROM REGISTER R INNER JOIN COURSESENROLLED C ON =
R.STUDENTID=3DC.STUDENTID AND=20
R.FNAME=3DC.STUDENTNAME WHERE=20
C.COURSEID=3DCOURSEID
=
=20
INSERT INTO ARCHIVE_ETL..TRAINERMASTER SELECT=20
T.INSTRUCTORID,T.TITE,T.FIRSTNAME,T.LASTNAME,T.DESIGNATION,T .QUALIFICATIO=
N,T.ADDRESS,T.TEL,T.EMAILID,T.PASSWORD=20
FROM TRAINERMASTER T INNER JOIN SKILLS S ON =
T.INSTRUCTORID=3DS.INSTRUCTORID WHERE=20
S.COURSEID =3D COURSEID
UPDATE ARCHIVE_ETL..COURSEMASTER SET COURSEID =
=
NEWCOURSEID WHERE COURSEID =3D COURSEID
UPDATE ARCHIVE_ETL..TOPICS =
SET COURSEID=20
=3D NEWCOURSEID WHERE COURSEID =3D COURSEID
UPDATE =
ARCHIVE_ETL..COURSESENROLLED=20
SET COURSEID =3D NEWCOURSEID WHERE COURSEID =3D COURSEID
UPDATE=20
ARCHIVE_ETL..SKILLS SET COURSEID =3D NEWCOURSEID WHERE COURSEID =
COURSEID
DELETE COURSEMASTER WHERE COURSEID =3D COURSEID
DELETE =
TOPICS WHERE=20
COURSEID =3D COURSEID
DELETE COURSESENROLLED WHERE COURSEID =
COURSEID
DELETE SKILLS WHERE COURSEID =3D COURSEID
'
=
LANGUAGE=20
'plpgsql' VOLATILE;
error...
not=20
exist
CONTEXT: compile of PL/pgSQL function "sp_delete_course" =
near=20
line 4
------=_NextPart_000_001F_01C61512.A7A32780--