When using PL/SQL objects i get a weird output...?
-
using the code: DROP TABLE OOAIRPORTS / CREATE OR REPLACE TYPE airport_object AS OBJECT ( CITY VARCHAR2(150), STATE VARCHAR2(150), AIRPORT VARCHAR2(150), ABBREV VARCHAR2(150) ); / CREATE TABLE OOAIRPORTS (AIRPORT_INFO airport_object) / DECLARE cursor airportimport IS SELECT * FROM AIRPORTS; ap airport_object; ci VARCHAR2(150); st VARCHAR2(150); air VARCHAR2(150); abb VARCHAR2(150); BEGIN open airportimport; --EXECUTE IMMEDIATE 'CREATE TABLE OOAIRPORTS (AIRPORT airport_object)'; loop fetch airportimport into ci, st, air, abb; --fetch airportimport into ap; exit when airportimport%notfound; insert into OOAIRPORTS values (airport_object(ci, st, air, abb)); end loop; close airportimport; END; / SELECT * FROM OOAIRPORTS i get the following output... AIRPORT ------------------------- oracle.sql.STRUCT@9557e1 oracle.sql.STRUCT@bc8ba5 oracle.sql.STRUCT@73fe03 etc. how kind of output is this? how do i format the output into normal terms? I should get: AIRPORT ------------------------- Gustavas AK Gustavus Airport GST
-
Answer:
The only 'column' of OOAIRPORTS is of type airport_object. Since it's a structure instead of a regular vartype, Oracle doesn't know how to display it. What you'll probably have to do is create a UDF to format your structure for display by concatenating the various structure parts into one large string. Then instead of doing SELECT * (which is generally poor practice anyway), do something like SELECT display_airport_info_obj(airport_info) FROM ooairports
Palak at Yahoo! Answers Visit the source
Other answers
The only 'column' of OOAIRPORTS is of type airport_object. Since it's a structure instead of a regular vartype, Oracle doesn't know how to display it. What you'll probably have to do is create a UDF to format your structure for display by concatenating the various structure parts into one large string. Then instead of doing SELECT * (which is generally poor practice anyway), do something like SELECT display_airport_info_obj(airport_info) FROM ooairports
TheMadProfessor
Related Q & A:
- Why don't I get the little envelope in my taskbar in Outlook Express when I get a message?Best solution by Yahoo! Answers
- How can I get an audio alert when I get a new e-mail?Best solution by Yahoo! Answers
- How do I get my computer to notify me when I get a email?Best solution by Yahoo! Answers
- Where can I get a high output alternator?Best solution by powerbastards.com
- How can I get a text alert when I get an email?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.