I want to create table with Forms_DLL
when button press trigger showing error
ora-06502
PROCEDURE mycur2 IS
BEGIN
FORMS_DDL('drop table retreport');
declare
v_com varchar2(2000);
BEGIN
V_COM := ' create table retreport as
select code,ddate,stat,inv_co_code,com,inv_fnd_code,fund,units,bal unitbal,amount invAmount
--decode(stat,''I'',temp)temp
from(
select code,Ddate,Stat,inv_co_code,Com,inv_fnd_code,fund,Dist,Rem,Price,Amount,to_number(decode(stat,null,null,units)) Units,
Units Unit1, Bal , amount/units temp
from (
select code,ddate,inv_fnd_code,fund,Stat,inv_co_code,com,dist,rem,price,amount,
decode(stat,''R'',-1,1)*units Units,
sum(decode(stat,''I'',1,null,1,-1)*units) over (partition by inv_co_code,inv_fnd_code order by rno) bal
--(order by rno) bal
from (select code,ddate,inv_fnd_code,fund,inv_co_code,com,dist,rem,units,price,amount,stat,
row_number() over (order by ddate,
decode(stat, null, 0, 1)
-- ,ddate
,decode(stat, ''I'', 1, ''R'', 2), ddate
) rno
from
( -------------- Opening Balance ----------------
select null code,:dd1-1 dDate ,null inv_fnd_code,null Fund,null inv_co_code,null Com,null Dist ,null Rem, nvl(Qry1.Iunit,0) - nvl(qry2.runit,0) Units, null Price
,null Amount,null Stat from (
select null,null,sum(nvl(inv_nofu,0))IUnit, sum(inv_uprice),sum(inv_amount), null from investment
where inv_date < :dd1
-- and inv_fnd_code = :fnd
--and inv_co_code = :comp
) qry1,
(
select null,null,sum(nvl(red_nofu,0))RUnit, sum(red_uprice),sum(red_amount), null from redemption
where red_date < :dd1
-- and red_fnd_code = :fnd
-- and red_co_code = :comp
) qry2
union all
----------------------- Investment -----------------
select code,inv_date ddate,inv_fnd_code,inv_fnd_name fund,inv_co_code,inv_co_name com,inv_dist_name dist, inv_remarks rem, inv_nofu units, inv_uprice price,
inv_amount Amount, ''I'' STAT from investment
WHERE inv_date < :dd1
-- and inv_fnd_code = :fnd
-- and inv_co_code = :comp
union all
-------------------Redeumption --------------------
select code,red_date,red_fnd_code,red_fnd_name,red_co_code,red_co_name,red_dist_name, red_remarks, red_nofu, red_uprice,
null red_amount, ''R'' from redemption
WHERE red_date < :dd1
-- - and red_fnd_code = :fnd
-- and red_co_code = :comp
)))
order by inv_co_code,inv_fnd_code)
';
FORMS_DDL(V_COM);
end;
end;