1

I am converting a few simple MySQL stored procedures to PostgreSQL Functions and for some reason when I execute the following function it throws an error when executed.

I created the function with the following code:

CREATE FUNCTION cc.fs_ivr_updatecalltransfer(_ParentContactID
int[11], _CalledID varchar[32])
RETURNS int AS $$
DECLARE 
pcID int;   
BEGIN
if _ParentContactID<>0 then 
update cc.tblcontacts set cc.tblcontacts.transferdest =
_CalledID where cc.tblcontacts.contactid =
_ParentContactID;
end if;
RETURN _ParentContactID;
END;
$$ LANGUAGE plpgsql;

I Execute it manually like this:

SELECT cc.fs_ivr_updatecalltransfer(3,"test")

It throws this error:

SQL error:

ERROR:  column "test" does not exist
LINE 1: SELECT cc.fs_ivr_updatecalltransfer(3,"test")
In statement: SELECT  cc.fs_ivr_updatecalltransfer(3,"test")

Any Suggestions?

1 Answer 1

8

Use single quotes to quote strings, not double quotes. 'test' means the string "test", whereas "test" means the identifier "test", which postgresql tries to resolve as a column, same as using backquotes in MySQL.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.