我有以下代码:
FOR rw IN myCur(id) LOOP
BEGIN
SELECT DISTINCT ingredient, f_ing_descr(1, ingredient, 0), syntypepack.fGetSyn(ingredient, 700512) CAS, syntypepack.fGetSyn(ingredient, 700513) EC
INTO lnIngredient, lsIngredientDescription, lnCAS, lnEC
FROM ING
WHERE part = 'FSI'
AND rev = 1
ORDER BY quantity DESC;
我想用一个嵌套表填充从该语句返回的所有值,然后将所有行添加到表中。
我已经有了这个:
TYPE ingCasEc IS TABLE OF NUMBER;
lnTableSyns ingCasEc ;
lnTableSyns := ingCasEc(lnIngredient, lnCAS, lnEC);
任何人都可以帮我解决这个问题,我可以想出添加所有行,只是嵌套表是我的弱点。
感谢您的所有帮助和建议。
答案 0 :(得分:0)
DECLARE
TYPE int_rec IS RECORD
(
lnIngredient VARCHAR2(30)
, lsIngredientDescription VARCHAR2(30)
, lnCAS VARCHAR2(30)
, lnEC VARCHAR2(30)
);
TYPE ingCasEc IS TABLE OF int_rec;
lnTableSyns ingCasEc ;
BEGIN
SELECT DISTINCT ingredient, f_ing_descr(1, ingredient, 0), syntypepack.fGetSyn(ingredient, 700512) CAS, syntypepack.fGetSyn(ingredient, 700513) EC
BULK COLLECT INTO lnTableSyns
FROM ING
WHERE part = 'FSI'
AND rev = 1
ORDER BY quantity DESC;
END;