Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: problems with select (oo)

Re: problems with select (oo)

From: Brice Ruth <Brice.Ruth_at_penguinboots.com>
Date: 2000/03/07
Message-ID: <38C58499.ABCABFEE@penguinboots.com>#1/1

One note (for completeness): you should always close your explicitly opened cursors:

SQL> create or replace procedure get_obj_info as   2 test_obj telnr_ty;
  3 cursor obj_cursor is
  4 select telefon from test;
  5 begin
  6 open obj_cursor;
  7 fetch obj_cursor into test_obj;
  ***8 close obj_cursor;***
  9 dbms_output.put_line(test_obj.vorwahl);  10 end;
 11 /

Cheers! :-)

Brice

Brice Ruth wrote:

> Hallo! Ich habe versucht in purem SQL den Inhalt des Objekt's
> rauszukriegen - das gelang mir aber leider nicht. So klappte es aber:
>
> SQL> create or replace procedure get_obj_info as
> 2 test_obj telnr_ty;
> 3 cursor obj_cursor is
> 4 select telefon from test;
> 5 begin
> 6 open obj_cursor;
> 7 fetch obj_cursor into test_obj;
> 8 dbms_output.put_line(test_obj.vorwahl);
> 9 end;
> 10 /
> Procedure created.
> SQL> set serveroutput on
> SQL> exec get_obj_info;
> 930248
> PL/SQL procedure successfully completed.
>
> Viel SpaĆŸ!
> -Brice
>
> <english>
> Hello. I tried to get the contents of the object column out using pure
> SQL, but I couldn't get that to work. However, it worked using the above
> SQL procedure. Have fun!
>
> lheber_at_my-deja.com wrote:
>
> > hi there,
> > i've got some trouble with oo-types and queries.
> > here's some code:
> >
> > create type telnr_ty as object(vorwahl number, rufnummer number);
> > /
> > create table test (land char, telefon telnr_ty);
> > insert into test values('D', telnr_ty(930248, 49536));
> > insert into test values('D', telnr_ty(956767, 67736));
> > insert into test values('P', telnr_ty(930248, 3536));
> >
> > select * from test; -- works perfectly...
> > select telefon from test; -- works as well...
> > select telefon.vorwahl from test; -- doesn't work!
> >
> > i got a message:
> >
> > select telefon.vorwahl from test
> > *
> > ERROR at line 1:
> > ORA-00904: invalid column name
> >
> > could anybody help me, please?
> >
> > is that just another bug, like the required "/" after "create type..."?
> > i also tried the samples from the oracle reference. i typed in them
> > _correctly_, they didn't work. do i have to set any special options in
> > sql*plus to tell them i want to just objects?
> >
> > i also tried
> > select telnr_ty.vorwahl from test;
> > without success!
> > Thanx for any hints, (possibly in German???)
> >
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
Received on Tue Mar 07 2000 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US