Quick Pg/PLSQL question

Started by Envex Developmentsover 23 years ago1 messagesgeneral
Jump to latest
#1Envex Developments
mwagner@envex.net

Hey everyone,

Trying to run a VERY simple function. I've read through the Programmer's
Manual over and over, and continue to receive errors. First, I ran the
following to add the language to the database:

createlang plpgsql test

I then load the function using:

\i test_func.sql

I then run the function by simply executing:

select test_func() as answer;

The function I'm trying to execute is:

------------------------------------------

CREATE OR REPLACE FUNCTION test_func() RETURNS INTEGER AS '

DECLARE

BEGIN

INSERT INTO transaction_summary VALUES (61, 1, "now", 0, 0, 0, 0);

RETURN 1;

END;
' LANGUAGE 'plpgsql';

------------------------------------------

Very simple function, but I continue to receive errors, because of the "now"
part. However, in the Programmer's Manual, it specifically uses "now" with
double quotes in a couple examples. When executing the function, I continue
receiving the following errors:

NOTICE: Error occurred while executing PL/pgSQL function test_func
NOTICE: line 4 at SQL statement
ERROR: Attribute 'now' not found

Any help would be greatly appreciated.

Thank you,
Matt Wagner

Envex Developments
Your CGI Script Specialists
http://www.envex.net/