Home » Developer & Programmer » Forms » create table from query with passing parameters (9i, form6i)
create table from query with passing parameters [message #527733] |
Thu, 20 October 2011 00:07 |
kame
Messages: 69 Registered: July 2009
|
Member |
|
|
I want to create table from query with passing parameters
create table as temp
select * from emp
where hiredate between :sdate and :edate
and deptno = :dpt
when I tried in Toad after passing parameters it gives me error
ORA-01036: illegal variable name/number
|
|
|
|
Re: create table from query with passing parameters [message #527745 is a reply to message #527735] |
Thu, 20 October 2011 01:16 |
kame
Messages: 69 Registered: July 2009
|
Member |
|
|
thank you for your reply. Actual I tried in TOAD. because it is easy to pass parameters there. And I want to create table for using Form 6i.
I want to create table in form
PROCEDURE TableView IS
BEGIN
FORMS_DDL('drop table test');
declare
v_com varchar2(4000);
BEGIN
V_COM := 'Create table test as
select * from emp
where hiredate between :sdate and :edate
and deptno = :dpt
';
FORMS_DDL(V_COM);
end;
[Updated on: Thu, 20 October 2011 01:17] Report message to a moderator
|
|
|
|
Re: create table from query with passing parameters [message #527750 is a reply to message #527748] |
Thu, 20 October 2011 01:43 |
kame
Messages: 69 Registered: July 2009
|
Member |
|
|
Actual I want selected data according to user input. and after that I will create report on the basis of that data.
this is my query, after save result in table of this query I will create some cursor in form for making report, because I am facing some problem to make report "moving weighted average"
select ddate,fnd_code,fund,co_code,com,dist,rem,units,dp_uprice price,nvl(dp_uprice,0)*units Amount,stat
from
(
select :sdate-1 dDate ,inv_fnd_code Fnd_code,null Fund, inv_co_code 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 inv_co_code,inv_fnd_code,sum(nvl(inv_nofu,0))IUnit, sum(inv_uprice),sum(inv_amount), null from investment
where inv_date < :sdate
and inv_fnd_code = :fnd
and inv_co_code = :co_code
group by inv_fnd_code,inv_co_code
) qry1,
(select red_co_code,red_fnd_code,sum(nvl(red_nofu,0))RUnit, sum(red_uprice),sum(red_amount), null from redemption
where red_date < :sdate
and red_fnd_code = :fnd
and red_co_code = :co_code group by red_co_code,red_fnd_code
) qry2
where qry1.inv_co_code = qry2.red_co_code (+)
and qry1.inv_fnd_code = qry2.red_fnd_code (+)
) Opn1,
--------------- Getting Dp_Uprice = :dd ----------------
(SELECT dp_fnd_code,
max(dp_date) keep (dense_rank last order by dp_date) Dp_date,
max(dp_uprice) keep (dense_rank last order by dp_date) dp_uprice
FROM dailyprice
where dp_date <= :sdate
and dp_uprice is not null
group by dp_fnd_code
) opn2
------------------------------------
where opn1.fnd_code = opn2.dp_fnd_code (+)
------------------------------------ -------------- End Opening Balance --------------------
union all
----------------------- Investment -----------------
select 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 BETWEEN :SDATE AND :EDATE
and inv_fnd_code = :fnd
and inv_co_code = :co_code
union all
-------------------Redeumption --------------------
select red_date,red_fnd_code,red_fnd_name,red_co_code,red_co_name,red_dist_name, red_remarks,
red_nofu - red_nofu - red_nofu red_nofu ,
red_uprice,
null red_amount, 'R' from redemption
WHERE red_date BETWEEN :SDATE AND :EDATE
and red_fnd_code = :fnd
and red_co_code = :co_code
|
|
|
|
Re: create table from query with passing parameters [message #527774 is a reply to message #527761] |
Thu, 20 October 2011 02:41 |
kame
Messages: 69 Registered: July 2009
|
Member |
|
|
Actual It is a sub query and I have to use parameters in this query if I will not use it will collect data according to current date . that will be false.
SELECT dp_fnd_code,
max(dp_date) keep (dense_rank last order by dp_date) Dp_date,
max(dp_uprice) keep (dense_rank last order by dp_date) dp_uprice
FROM dailyprice
where dp_date <= :sdate
and dp_uprice is not null
group by dp_fnd_code
|
|
|
Goto Forum:
Current Time: Mon Feb 03 07:56:38 CST 2025
|