Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: How to write a sql query
Hi Magesh,
the message below is a posting from other oracle mail-list that has a
similar problem with yours. HIH
Hi Atul,
I think the only way to solve your problem is creating the select statement
on the fly. After then you can create a report based on the select
statement generated. So you must do a little bit coding here on creating
the select statement and the report displaying the select result. Here's an
example on how to create a select statement on the fly. Hope it helps.
Regards
Alex Wijoyo
declare
slctStmt varchar2(300);
cursor deptCur is
select * from dept;
deptRow deptCur%rowtype;
begin
slctStmt:='select empno "NO",ename "NAME"';
for deptRow in deptCur loop
slctStmt:=slctStmt||','||'decode(deptno,'||deptRow.deptno||',''X'','' '')
"'||deptRow.dname||'"';
end loop;
slctStmt:=slctStmt||' from emp';
dbms_output.put_line(slctStmt);
end;
/
At 18:50 26/11/2000 -0800, you wrote:
>Hi Ajay ..Thanks for your response but i need detail info, How can i solve
>by using decode ..can you give simple example.
>
>
>Regards
>Magesh
>
>----- Original Message -----
>To: "Multiple recipients of list ORACLE-L" <ORACLE-L_at_fatcity.com>
>Sent: Thursday, November 23, 2000 6:31 AM
>
>
> > use decode ...
> >
> > ----- Original Message -----
> > To: "Multiple recipients of list ORACLE-L" <ORACLE-L_at_fatcity.com>
> > Sent: Wednesday, November 22, 2000 5:56 AM
> >
> >
> > > Hi All
> > >
> > > How to write a sql query to print in the matrix report.
> > > Eg . Test table .
> > > a1 b1
> > > 1 2.3
> > > 1 3.5
> > > 1 7.0
> > > 2 1.7
> > > 2 2.6
> > > 2 2.9
> > > 3 1.3
> > > 3 2.9
> > > 3 3.0
> > >
> > >
> > > I need the output ,should be
> > >
> > > 1 2.3 3.5 7.0
> > > 2 1.7. 2.6 2.9
> > > 3 1.3 2.9 3.0
> > >
> > >
> > > Please , Any one suggest me how to write a sql query for this.
Received on Mon Nov 27 2000 - 02:32:11 CST