【发布时间】:2012-01-04 04:32:58
【问题描述】:
我正在编写一个存储过程。我知道如何将值从select 传递到insert。
但是,INSERT INTO 是否可以同时使用values 和Select?
Insert into table_1 (f1, f2, f3, f4, f5, f6, f7, f8, f9,
FL1, FL2, FL3)
Select :p_f1, :v_f2, :p_f3, :p_f4,
abs(:v_f5 * :p_f5),
abs(:v_f6 * :p_f6),
:v_f7, :v_f8, :v_9 from RDB$DATABASE
UNION
Select f_lookup_id from lookup_table where (f_res >= :v_res) And (f2_lookup_id = :p_id1)
UNION
Select f_lookup_id from lookup_table where (f_res >= :v_res) And (f2_lookup_id = :p_id2)
UNION
Select f_lookup_id from lookup_table where (f_res >= :v_res) And (f2_lookup_id = :p_id3);
【问题讨论】:
-
在这里很难说出你在问什么。你能举例说明你在做什么吗?你对你想要做什么的最佳猜测?
-
我可以在一个语句中使用 VALUES 和 Select with Insert into 吗?
标签: sql sql-insert firebird