Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
448 views
in Technique[技术] by (71.8m points)

postgresql - 在refcursor postgresql中设置别名(Setting alias names within refcursor postgresql)

I am converting oracle rest calls to postgres functions.

(我正在将oracle rest调用转换为postgres函数。)

I want to store column values in alias names and store data in a table using alias names.

(我想将列值存储在别名中,并将数据存储在使用别名的表中。)

Below is the code.

(下面是代码。)

 DECLARE 
 l_cursor_1    REFCURSOR;
BEGIN
testId :=0;
pack_id :=0;
newtestId :=0;
currrunId :=0;

select CURRENT_TIMESTAMP into nowtimestamp;

OPEN l_cursor_1 FOR
select 'copyof_'|| "NAME" AS testname,"DESCRIPTION" AS testdesc,"TARGET_DATE" AS target_date 
from "TEST_TABLE" where "ID"=testId;

fetch l_cursor_1 into  testname, testdesc, target_date;

insert into "TEST_TABLE" ("NAME","DESCRIPTION","TARGET_DATE", "CURR_TIMESTAMP") values 
(name, testdesc, target_date, nowtimestamp);
END;

The data is present in table, however while fetching values its returning me null values.

(数据存在于表中,但是在获取值时会返回空值。)

What is wrong with this code?

(此代码有什么问题?)

Thank you.

(谢谢。)

  ask by ariana777 translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...