0
我對pgSQL很陌生。postgres查詢沒有結果數據的目的地
任何人都可以幫助解決這個錯誤?
ERROR: query has no destination for result data
HINT: If you want to discard the results of a SELECT, use PERFORM instead.
CONTEXT: PL/pgSQL function prac_data.document_get_document_title(integer) line 8 at SQL statement
的腳本...
CREATE OR REPLACE FUNCTION prac_data.document_get_document_title(documentid INTEGER) RETURNS TEXT
AS
$body$
DECLARE
xmlText XML;
rawText TEXT;
BEGIN
SELECT document into STRICT rawText FROM prac_data.document_table WHERE entity_id = documentid;
xmlText := XMLParse (DOCUMENT rawText);
SELECT xpath('/inps_flow_document/@title', xmlText) as titleText;
RETURN titleText;
EXCEPTION
WHEN NO_DATA_FOUND THEN
RAISE EXCEPTION 'document_id % not found', documentid;
END;
$body$ LANGUAGE PLPGSQL;
SELECT prac_data.document_get_document_title(1)
IM使用SELECT INTO(可被看到的),但也許我不使用它完全正確....
嘗試將此xpath('/ inps_flow_document/@ title',xmlText)更改爲titleText;將SELECT xpath('/ inps_flow_document/@ title',xmlText)作爲titleText存入yourVariable; – Satya