Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as text by stim ( 18 years ago )
CREATE OR REPLACE FUNCTION insert_chattel(name character varying, addition character varying)
  RETURNS integer AS
$BODY$
DECLARE
	pi_id integer;
	o_id integer; --переменная для хранения идентификатора только что созданной записи в таблице objects
BEGIN
INSERT INTO objects VALUES(DEFAULT, 1) RETURNING object_id INTO o_id;
      INSERT INTO chattel (chattel_id, object_id, name, addition) VALUES (DEFAULT, o_id, name, addition) 
	RETURNING chattel_id INTO pi_id;
    RETURN pi_id;
END;
$BODY$
  LANGUAGE 'plpgsql' VOLATILE;
ALTER FUNCTION insert_chattel(name character varying, addition character varying) OWNER TO stim;




ERROR: syntax error at or near "$1"
SQL state: 42601
Context: SQL statement in PL/PgSQL function "insert_chattel" near line 7

 

Revise this Paste

Your Name: Code Language: