我在 test script window 中有以下查询
declare
-- Local variables here
p_StartDate date := to_date('10/15/2012');
p_EndDate date := to_date('10/16/2012');
p_ClientID integer := 000192;
begin
-- Test statements here
select d.r "R",
e.amount "Amount",
e.inv_da "InvoiceData",
e.product "ProductId",
d.system_time "Date",
d.action_code "Status",
e.term_rrn "IRRN",
d.commiount "Commission",
0 "CardStatus"
from docs d
inner join ext_inv e on d.id = e.or_document
inner join term t on t.id = d.term_id
where d.system_time >= p_StartDate
and d.system_time <= p_EndDate
and e.need_r = 1
and t.term_gr_id = p_ClientID;
end
这是 error :
ORA-06550:第9行,第3列:PLS-00428:此SELECT语句中应包含INTO子句
我've been using T-SQL for a long time and I'是PL / SQL的新手 .
这有什么不对?
3 回答
假设您真正想要的是使用一些参数查询数据库,那么您有一些选择:
1-使用sqlplus或plsql developer "command window"或"sql window"与这样的查询:
系统将提示您为参数赋值 .
2-你可以使用plsql(虽然我不明白为什么)但是你需要一个显式游标
例如,如果您使用"test window":
请注意,您需要在下表中添加一个名为“src”的变量并键入“cursor”,运行plsql块后它将保存结果集
这些列需要存储在某种类型的结构中 . 像这个例子中给出的那样
你可以尝试这个解决方案: