Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.databases.postgresql > #558
| From | Sygma <sygmaprime@sygmacore.com> |
|---|---|
| Newsgroups | comp.databases.postgresql |
| Subject | ERROR: query has no destination for result data - What am I doing wrong here? |
| Date | 2014-05-09 13:44 -0600 |
| Organization | Wieslauf BBS |
| Message-ID | <lkjb74$4d4$1@wieslauf.sub.de> (permalink) |
I'm creating a commodity exchange, basically a place to swap one thing
for another.
For example, I have 10 USD and I would like to exchange them for 11 CAD.
Previous incarnations have used a series of SQL statements executed
sequentially to create and fullfill orders.
Unfortunately this can suffer from race conditions and other nastiness
in addition to being slow.
Thus we want to move the existing logic directly into the DB in the form
of stored procedures. Doing so has resulted in the breakage of many
formerly working queries.
Most of these queries now return
"ERROR: query has no destination for result data"
Here is my schema, and example function and the method I'm using to call
it. Any help is appreciated. I've searched google, stacktrace and many
others all to no avail.
CREATE TABLE transactions
(
id bigserial NOT NULL,
source character varying(255) NOT NULL,
symbol character varying(32) NOT NULL,
amount numeric(32,16) NOT NULL,
accountid bigint,
reference character varying(255),
comment character varying(255),
userid bigint,
"time" timestamp without time zone NOT NULL DEFAULT
);
-- Function: updatetxonorder(bigint, numeric, character varying)
-- DROP FUNCTION updatetxonorder(bigint, numeric, character varying);
CREATE OR REPLACE FUNCTION updatetxonorder(acctid bigint, amt numeric,
sym character varying)
RETURNS bigint AS
$BODY$
DECLARE
txid bigint;
BEGIN
INSERT INTO transactions (id,source,symbol,amount,accountid) VALUES
(DEFAULT,'ORDERHOLD',sym,amt,acctid) RETURNING id as txid;
return txid;
END
$BODY$
LANGUAGE plpgsql VOLATILE
COST 100;
ALTER FUNCTION updatetxonorder(bigint, numeric, character varying)
OWNER TO dev;
COMMENT ON FUNCTION updatetxonorder(bigint, numeric, character varying)
IS 'update transactions table when a new order is placed';
----Function giving me an error
SELECT updatetxonorder(
1,
100,
'USD'
);
---End
Any help here would be eternally appreciated. Thanks!
Back to comp.databases.postgresql | Previous | Next — Next in thread | Find similar
ERROR: query has no destination for result data - What am I doing wrong here? Sygma <sygmaprime@sygmacore.com> - 2014-05-09 13:44 -0600 Re: ERROR: query has no destination for result data - What am I doing wrong here? Jasen Betts <jasen@xnet.co.nz> - 2014-05-10 09:53 +0000
csiph-web