retrieving data from columns of user defined type
Abstract types, I learned the other day. So I created an abstract type and a table.Create the student_ty as an object type
(name varchar2 (20), number of roll);
create table result)
Student student_ty,
(total);
I also inserted data. But I'm having some trouble with the rretrieval of data. Suppose I want to choose only the roller and the name of the student as described in the type of studen. So I used the follwing query: -.
Select result student.name;
But it's not working. But when I use something like this: -.
Select r.total, r.student.name in result r;
This works perfectly. My question is that it is a rule that oracle needed to use an alias, whenever retrieve values for a user defined type data?. Help, please.
Thanks in advance.
Yes, you can use an alias when the type of object in a table like this.
select r.student.name, r.student.roll, r.total
from result r
Tags: Database
Similar Questions
-
to retrieve data from xml data type
Hello...
I have a doubt in the oracle database... Here's how to retrieve data from xml data type?Like this...
SQL> ed Wrote file afiedt.buf 1 with t as (select xmltype(' 2
3') as xml from dual) 12 -- 13 -- end of sample XMLDATA, use below query on your own table etc. as required 14 -- 15 select x.* 16 from t 17 ,xmltable('/DETAILS/FIELDS_VALUES/FIELD' 18 passing t.xml 19 columns name varchar2(30) path './NAME' 20 ,val varchar2(10) path './VALUE' 21* ) x SQL> / NAME VAL ------------------------------ ---------- toMonth 5 ctTestPan 1 costType 2 toYear 2012 fromMonth 12 fromYear 2011 6 rows selected.4 11 5toMonth 5 6ctTestPan 1 7costType 2 8toYear 2012 9fromMonth 12 10fromYear 2011 -
List of tables of objects or the user-defined type columns
Hello
SQL > select * from v version $;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11 g Enterprise Edition Release 11.2.0.2.0 - 64 bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE Production 11.2.0.2.0
AMT for Linux: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production
I have n number of tables in my db, since I have several
tables containing "user defined type columns.
so, how can I get/list db objects that contains the user-defined type columns only.
Please suggest me on this
Kind regards
FaizDear Sir
I have n number of tables in my db,from that i have several tables which contains"user defined type columns" so how could i get/list the db objects which contains user defined type columns only. Kindly suggest me on this
Use this
select tab.table_name , tab.column_name , tab.data_type from user_tab_columns tab , user_types typ where tab.data_type = typ.type_name order by tab.table_name ;
Best regards
Mohamed Houri
-
With the help of the socket object to retrieve data from web application without the html files
I tried to use the socket object to retrieve data from a web application (I just control script version vs version online). So all I want to do is access http://hyle.io/version that returns me the current version of the application (such as a simple string) in order to compare it in my script and then notifies the user accordingly. I have just a few problems using the socket object. I used this code from the Adobe Javascript Tools Guide:
reply = ""; conn = new Socket; // access Adobe’s home page if (conn.open ("www.adobe.com:80")) { // send a HTTP GET request conn.write ("GET /index.html HTTP/1.0\n\n"); // and read the server’s reply reply = conn.read(999999); conn.close(); }
... that I then adapted as:
reply = ""; conn = new Socket; if (conn.open ("hyle.io:80")) { conn.write ("GET /version HTTP/1.0\n\n"); reply = conn.read(999999); conn.close(); }
And here is what I get:
HTTP/1.1 400 Bad Request Content-Length: 225 Content-Type: text/html Server: Pagodabox-Routing-Mesh
Bad Request
Your browser sent a request that this server could not understand.
Résultat : trueI don't know a lot about HTTP requests, but I wondered if it was related to the fact that I am not pointing to a specific HTML file and the type of request was wrong or if I should rather check if there is something wrong with my host?
The site/app is PHP and is hosted on PagodaBox if it helps.
Thanks in advance!
Hi Sebastien Lavoie,
It should work
var HTTPFile = function (url, port) {}
If (arguments.length == 1) {}
URL = arguments [0];
port = 80;
};
This.url = url;
This.port = port;
this.httpPrefix = this.url.match(/http:\/\//);
This.Domain = this.httpPrefix is nothing? This.URL.Split("/") [0] + ":" + this.port: this .url .split ("/") [2] +":" + this.port;
This.Call = ' GET ' + (this.httpPrefix == null? ' "). " http://" (+ this.url: this.url) + "HTTP/1.0\r\nHost: ' + (this.httpPrefix is nothing? "This.URL.Split("/ ") [0]: this .url .split (" / ") [2]) +" \r\nConnection: close\r\n\r\n ";
This.Reply = new String();
This.Conn = new Socket();
This.Conn.Encoding = "binary";
HTTPFile.prototype.getFile = {function (f)}
var typeMatch = this.url.match(/(\.) (\w{3,4}\b)/g);
If (this.conn.open (this.domain, "binary")) {}
This.Conn.Write (this.) Call);
This.Reply = this.conn.read (9999999999);
This.Conn.Close ();
} else {}
This.Reply = "";
}
(Return this.reply.substr(this.reply.indexOf("\r\n\r\n")+4);
};
}
Hyle var = new HTTPFile ("http://hyle.io/version");
Alert (hyle. GetFile());
And by the way, I like the idea of 'http://hyle.io'. Can you give me your email address, I want to learn more about this Web site.
Please send me an email to [email protected]
-
Hi all
I have a function that returns a type defined by the user in my sql environment. The type consists of 5 different columns. I pass a ref_id to my function, on the basis of which he does some calculations and returns me the type.
create or replace type my_type
(
number of col1,
col2 varchar2 (100),
COL3 varchar2 (10),
number of COL4,
number of col5
)
create or replace function fun (number in_id) return my_type
as
Start
-code1
-code2
Return (my_type)
end;
In my sql environment, I have a table which is the following structure
create table tab1
(
number of emeline
upgvc varchar2 (100),
number of Ref_ID, - this ref_id when it is passed to the function above will return a populated user-defined type values.
number of col1,
col2 varchar2 (100),
COL3 varchar2 (10),
number of COL4,
number of col5
)
I have a table tab2, using which i will be filling of the columns of the table tab1, tab2 table structure is as below
create table tab2
(
number of emeline
upgvc varchar2 (100),
number of Ref_ID)
now I have to fill each column in table tab1, tab2 table and my pleasure to feature.
something like
Insert into tab1
Select emeline,
upgvc,
Ref_ID,
Rest of the values must be completed by calling the function using the ref_id and fill in the values. What would be the best way to do it? I have millions of records with it. I tried to use this with the function of REGAL and tried fill lines, but its slow. All of the suggestions.
Note: apologies for not sticking scripts and the original code since it will take days
Thank you
Rahul
PetervdZwan wrote:
Hello
I agree that you shouldn't calc function for each attribute. But you don't need an extra table for this type.
See below:
Not sure what you mean:
SQL > set serveroutput on
SQL > select a.deptno,.
2 a.f.col1 col1,
a.f.col2 3 col2,
4 a.f.col3 col3,
5 a.f.col4 col4,
6 a.f.col5 col5
7 of)
8. Select wagneur, f1 (deptno) f
scott.dept 9 d
10 ) a
11.DEPTNO COL1 COL2 COL3 COL4 COL5
---------- ---------- ---------- ---------- ---------- ----------
10 10 A B 2 3
20 20 A B 2 3
30 30 A B 2 3
40 40 A B 2 3Call to F1
Call to F1
Call to F1
Call to F1
Call to F1
Call to F1
Call to F1
Call to F1
Call to F1
Call to F1
Call to F1
Call to F1
Call to F1
Call to F1
Call to F1
Call to F1
Call to F1
Call to F1
Call to F1
Call to F1
SQL >As you can see, function runs again 5 times by each line. You need to materialize in line of sight. It can be done using NO_MERGE:
SQL > select a.deptno,.
2 a.f.col1 col1,
a.f.col2 3 col2,
4 a.f.col3 col3,
5 a.f.col4 col4,
6 a.f.col5 col5
7 of)
8 select / * + no_merge * /.
wagneur, f1 (deptno) 9 f
scott.dept 10 d
11 ) a
12.DEPTNO COL1 COL2 COL3 COL4 COL5
---------- ---------- ---------- ---------- ---------- ----------
10 10 A B 2 3
20 20 A B 2 3
30 30 A B 2 3
40 40 A B 2 3Call to F1
Call to F1
Call to F1
Call to F1
Call to F1
Call to F1
SQL >However, I have and I know not why, the function is called not 4 but 6 times, using the type of collection (as in my first response) causes function calls only 4 - one per each line.
SY.
-
Question of the user defined Type (UDT)
Hello
The attached file is NEITHER sample to call a VB6 vi.
The following is declared in the declaration section:
' Global declarations
Dim lvapp As LabVIEW.Application
Dim vi LabVIEW.VirtualInstrumentWhen I paste these statement in another project (that I'm working on), I get an error 'undefined user-defined type '.
Can someone point out to me were in the sample, these type definitions are declared?
Thank you
Rafi
PS the attachment is indeed xxx.rar and not xxx.zip. I changed the name because .rar has not been accepted. Please rename .rar
Thank you
I forgot to mark references to my project
Project--> references--> LabView. Type library of xxx
Thank you
-
create the http client to retrieve data from web service
Hello
I am newbie on our webworks. I need to retrieve data from web service. How to connect to this service and analyzed. There is a tutorial that can help me get started with it.
Can any one advice me how can I start working with webworks on blackberry 10
Thanks for any help
In general, you will need to use an AJAX call to the server
It really depends on what the server returns as to how the information is easy to digest
JQuery provides a simple interface, and returns information easy to use
If you deal with things gets complicated XML according to namespace
If you look at the raw XML data and it goes something like fred: name you will have questions requiring an implementation of SAX - JSON is simple if you don't get that even if (nothing too confusing here)
If using an external data source JSON go if you have the choice
As examples go - just look to the top of JQuery Ajax [JSON / XML] and you will get where you're going quickly
SAX is MUCH harder because of the namespace - Dublin is the most common and same XML without namespace is not simple to handle, so avoid it if you can
-
retrieve data from staging account
Hello
does anyone know how we can retrieve data from staging of account using 'Segmentation Wizard', "report analysis tool", model of fusion and mailing, etc.?
Seems that these tools connect only to the production instance...
Thanks, SabSAB,
for segmentation Wizard (and perhaps other office files), you will have to go file - properties - Custom and update the values for the name of pod, if you have a job you know what value it is as I am not "have a practice to watch.
see you soon
Alex -
Add the column to an existing table-based user-defined type
Hello guys,.
I am compiling my function that returns a type defined by the user based on an existing table. Throughout the process of initialization so my query returns an additional column - SCORE (1). Here is my package:
create or replace
PACKAGE STAFF_AGENCY_PKG AS
TYPE TYPE_SEEKER_TABLE IS TABLE OF THE DRAW. SEEKER % ROWTYPE;
FUNCTION GET_SEEKERS (IN_KEYWORD IN VARCHAR2)
TYPE_SEEKER_TABLE RETURN PIPELINE;
END STAFF_AGENCY_PKG;
-------
create or replace
STAFF_AGENCY_PKG PACKAGE BODY
AS
FUNCTION GET_SEEKERS (IN_KEYWORD IN VARCHAR2)
TYPE_SEEKER_TABLE RETURN PIPELINE
IS
R_TBL TYPE_SEEKER_TABLE; -to return
BEGIN
FOR R IN)
SELECT Seeker.SEEKER_ID,
Seeker.FIRSTNAME,
Seeker.LASTNAME,
Seeker.NATIONALITY,
Seeker.ISELIGIBLE,
Seeker.BIRTHDATE,
Seeker.ISRECIEVEEMAILS,
Seeker.HIGHESTDEGREE,
Seeker.ETHNICITY,
Seeker.GENDER,
Seeker.ISDISABILITY,
Seeker.DISABILITY,
Seeker.CV,
Seeker.PASSWORD,
Seeker.PREFFERED_CITY,
SEEKER. E-mail
SEEKER. JOB_PREFERENCES_ID,
SCORE (1)
THE APPLICANT Seeker
WHERE CONTAINS (CV, ' < query >)
< textquery lang 'grammar' = 'context' = > ' |
GET_RELATED_CATEGORIES (IN_KEYWORD) |
' < / textquery >
< score datatype = "INTEGER" / >
(< / query > ', 1) > 0
)
LOOP
PIPE ROW (R); -Error (38,10): PLS-00382: expression is of the wrong type
END LOOP;
RETURN;
END GET_SEEKERS;
END STAFF_AGENCY_PKG;
How do I change my user type to be sufficient?
Oracle version 11.2.0.1.0
Thanks in advance!>
How do I change my user type to be sufficient?
>
You will need to create two new TYPEs. The one who has all the columns of the draw. The REQUESTOR table and the new column SCORE, then a TYPE which is an array of the first type.See example 12-22 using a Pipelined Table function for a Transformation in the PL/SQl language reference
http://docs.Oracle.com/CD/B28359_01/AppDev.111/b28370/tuning.htm#i53120
Here's the first part
-- Define the ref cursor types and function CREATE OR REPLACE PACKAGE refcur_pkg IS TYPE refcur_t IS REF CURSOR RETURN employees%ROWTYPE; TYPE outrec_typ IS RECORD ( var_num NUMBER(6), var_char1 VARCHAR2(30), var_char2 VARCHAR2(30)); TYPE outrecset IS TABLE OF outrec_typ; FUNCTION f_trans(p refcur_t) RETURN outrecset PIPELINED; END refcur_pkg; / CREATE OR REPLACE PACKAGE BODY refcur_pkg IS FUNCTION f_trans(p refcur_t) RETURN outrecset PIPELINED IS out_rec outrec_typ; in_rec p%ROWTYPE; BEGIN
Change
TYPE outrec_typ IS RECORD ( var_num NUMBER(6), var_char1 VARCHAR2(30), var_char2 VARCHAR2(30)); TYPE outrecset IS TABLE OF outrec_typ;
to include all the columns you need. Unfortunately, you have to manually list all the columns in the draw. The REQUESTOR table. If you think you need this same structure in other places you must create them as SQL types instead of PL/SQL types.
This example should be enough to show you how to modify your code to do something similar.
-
Retrieve data from similar columns
With the help of Oracle 10 g, SQL Developer v1.5
I have a table with 200 columns.
I'm trying to get the data from all columns ending with "_DT".
I got the list of columns but impossible to incorporate into the SELECT stmt.
How can this be achieved?SELECT column_name FROM user_tab_columns WHERE table_name = 'XXX_STG_INST_DEBT' AND column_name LIKE '%_DT';
Thank you.Try the following pl/sql
serverout Set size 1000000
declare
ALL OTHERS INTEGER;
ignore the number;
cursor c is
Select column_name
of user_tab_columns
where column_name like '% _DT '.
and table_name = "XXX_STG_INST_DEBT";
SQLSTR varchar2 (20000): = "CREATE VIEW APPOVIEW_FORUM AS SELECT ';
Start
for r in c loop
sqlstr: = sqlstr. r.column_name | «, » ;
end loop;
sqlstr: = rtrim (sqlstr, ','). ' FROM XXX_STG_INST_DEBT';dbms_output.put_line ('Executing' | sqlstr);
CURSOR_NAME: = DBMS_SQL. OPEN_CURSOR;
DBMS_SQL. PARSE (all other cases, SQLSTR, DBMS_SQL.native);
ignore: = DBMS_SQL. EXECUTE (CURSOR_NAME);
DBMS_SQL. CLOSE_CURSOR (CURSOR_NAME);
end;
/Select * from appoview_forum;
Drop view appoview_forum;
Max
-
Querying the user-defined types
I have a chart in which one of the columns is a user-defined data type:
The type 'MYTYPE' is a simple object that contains a field: a CLOB called MESSAGE:SQL> describe my_table ... USER_DATA MYTYPE
When I do a "select *...» "in this table, the USER_DATA column appears as"MYTYPE (oracle.sql.CLOB@898c2d).SQL> describe mytype Name Null? Type ------ ----- ---- MESSAGE CLOB
I know that for CLOB and BLOB fields, Developer SQL let me double click on the value and display the content. But for type like this defined by the user that contains a field, I can't navigate the data members of type. I find myself wanting to do something like a 'select user_data.message from my_table", but this is not a valid syntax. Is there a way to query a given specific member of this type defined by the user with the rest of the columns in the table, I can display the CLOB member instead of a representation of the object? If not, is it possible to configure SQL Developer to allow me to browse the data members of types defined by the user? TOAD has a feature like that but I would only use SQL Developer and it is a table that I work with on a regular basis.csimons,
Try this:
select t1.user_data.message from eimgr.aq_rtv_docs_out_table t1 where rownum = 1;
See you soon
Edited by: Frenchwood on September 22, 2009 22:38
-
SQL to retrieve data from the day before
Hello
I am asked to collect intelligence data and generate a daily report to determine the success rate (to do daily data that determines success rate). I have a session_time of column (with the DATE data type) that I try to do the job. I've been using:
Select * from ABC
where session_time > = TRUNC (SYSDATE - 2)
Gives me data, but I get the data from 26/10/14 and 10/28/14 so when I only need data on 27-10-14 (as of the day 28/10/14). I tried a few variations and did not get the expected result. Could someone please help me understand this? Time is also displayed in my outings, maybe I shouldn't include the time?
I use: TOAD for Oracle 11.5.1.2.
Oracle Database 11g Enterprose 11.2.0.1.0 Edition
Thank you in advance.
Hello
2632048 wrote:
Hello
I am asked to collect intelligence data and generate a daily report to determine the success rate (to do daily data that determines success rate). I have a session_time of column (with the DATE data type) that I try to do the job. I've been using:
Select * from ABC
where session_time > = TRUNC (SYSDATE - 2)
Gives me data, but I get the data from 26/10/14 and 10/28/14 so when I only need data on 27-10-14 (as of the day 28/10/14). I tried a few variations and did not get the expected result. Could someone please help me understand this? Time is also displayed in my outings, maybe I shouldn't include the time?
I use: TOAD for Oracle 11.5.1.2.
Oracle Database 11g Enterprose 11.2.0.1.0 Edition
Thank you in advance.
Use:
SELECT *.
ABC
WHERE session_time > = TRUNC (SYSDATE) - 1
AND session_time< trunc=""> >
;
It's 09:15 on October 28, 2014, then TRUNC (SYSDATE - 2) is 00:00:00 October 26; The query you posted became data of October 26 and later. (You may not all future dates in your table.)
If it's 09:15 October 28, then TRUNC (SYSDATE) is 00:00:00 October 28 (i.e., midnight, at the beginning of October 28) and TRUNC (SYSDATE) - 1 is 00:00:00 October 27.
Do not be tempted to use
WHEN TRUNC (session_time) = TRUNC (SYSDATE) - 1 * INEFFECTIVE! ***
It will get the same results, but it is slower, you cannot use an index on session_time and requires a call to separate function for each row in the table, it is selected or not.
-
Help me with SQL Query to retrieve data from a view
Hello Guru,
I need help in my sql query.
I use SQL TeraData.
I want an Oracle result in the following form-
Open tickets
Open months failure / Repair Service s/o improvement request Total general
2009-01-2 4 4 5 15
2009-02 1 0 2 3 6
2009-03 4 1 2 2 9
Grand Total 7 5 8 10 30
I wrote the query as where - TIME_PERIOD, RQST_TYPE_DM and DEMAND_SUMMARY_FCT are the points of view and I extract the data from the views only.
Select NVL (CA. TIME_PERIOD. PERIOD_CD, 'Total') THAT year.
COUNT (CASE WHEN CA. RQST_TYPE_DM. RQSTTYP_DESC Like '% of Break' THEN 1 END) as BreakFix
COUNT (CASE WHEN CA. RQST_TYPE_DM. RQSTTYP_DESC as 'N/a', 1 END) by n/a
COUNT (CASE WHEN CA. RQST_TYPE_DM. RQSTTYP_DESC as 'Improvement' THEN 1 END) accessories
COUNT (CASE WHEN CA. RQST_TYPE_DM. RQSTTYP_DESC Like '% Service' THEN 1 END) as ServiceRequests
COUNT (CA. RQST_TYPE_DM. RQSTTYP_DESC) AS grand_total
FROM CA. TIME_PERIOD, CA. RQST_TYPE_DM, CA. DEMAND_SUMMARY_FCT
WHERE (CA. DEMAND_SUMMARY_FCT. RQSTTYP_ID = CA. RQST_TYPE_DM. RQSTTYP_ID)
AND (CASE
WHEN CA. DEMAND_SUMMARY_FCT. MONTH_ID = CA. TIME_PERIOD. PERIOD_ID, 1
WHEN {fn concat ({fn concat (SUBSTR (CA. TIME_PERIOD. {(PERIOD_CD, 3, 4),'-')}, SUBSTR (CA. TIME_PERIOD. PERIOD_CD, 7, 2))} BETWEEN ' 2009-01' AND ' 2009-03' THEN 1
WHEN CA. DEMAND_SUMMARY_FCT. RQSTTYP_ID = '1' then 1
END) = 1
GROUP BY ROLLUP (CA. TIME_PERIOD. PERIOD_CD)
After executing the query, I get the following error:
3076: syntax Error: Data Type 'Time' does not match a defined Type name.
:( Kindly help me with this and let me know where I'm wrong... Please.Messages indicates something wrong with your data... It would seem that the data does not match your format mask.
Thus, the data or the format mask.
-
Retrieve data from AddressBook for Webworks Smartphone
Hi all
I want to implement the address book API. Where can I get/retrieve data (phone number, address of E-mail etc) for my Application project.
Is it possible to invoke the address book to recover data?I go through this link, but it did not help me https://developer.blackberry.com/html5/apis/blackberry.invoke.addressbookarguments.html#view
I have searched several times but could not get a code to make it possible.
Please help me if someone know the solution or have any sample code.Thank you best regards &,.
CastilloIts seems quite surprising that no member of this forum suggests even a single code related to this problem...
However, I still have more research and find the alternative.
var contactResult = new Array(); var Fname = new blackberry.find.FilterExpression("firstName", "!=", ""); contactResult = blackberry.pim.Contact.find(Fname); for ( var i = 0; i < contactResult.length; i++) { var totalName = contactResult[i].title+ " "+ contactResult[i].firstName+ " "+ contactResult[i].lastName; }
This will retrieve all data or contacts from the address book. For which I have to do a custom address book.
-
With the help of a user defined type as a return type of function with a type of object
Hi, I created my own data type of table I want to use as data type back to a member function of an object type that I created.
I work in an environment of 10g.
The code I used looks like this:
create or replace
Dim p As Package as
type p_rec is (number of v1);
type p_tab is table of the p_rec;
end p;
/
CREATE or REPLACE TYPE p_ot () AS OBJECT
/ * some statements * /.
NO DEFINITIVE MEMBER FUNCTION p.p_tab RETURN foo
);
/
When I try to compile p_ot I get an error: Error (5.40): PLS-00201: identifier 'P.P_TAB' must be declared.
I don't know the syntax is correct so I must be missing something, amy hepl would be great.
See you soonYou can define types of objects
create type p_rec as object ( v1 number ); create type p_tab as table of p_rec;
They can be used inside the package (p) in your example) as well as defined in the package.
In this case, there will be no problems with create typeCREATE TYPE p_ot AS OBJECT ( /* some declarations*/ NOT FINAL MEMBER FUNCTION foo RETURN p_tab );
Maybe you are looking for
-
Satellite C650 - screen problem
Greetings! I have a laptop Toshiba C650. And I have a problem. Today, I went to the service because I had a problem with LCD display. But when today arriwal, I have a few problems. When I turn on the screen always include gel Please help me! Sorry my
-
Tecra M2: Can play a game of the graphics card?
It seems that play Flight Simulator could destroy the graphics card on the laptop! I never thought this would be possible. I gave a friend my old Tecra M2 (as a wedding gift) which he also uses to play FS9. A few years ago, he had to have the motherb
-
I don't know how to send skyp maseg
My
-
How to set the volume slider back to ding is the default beep?
Hi for some reason any my system set the slider to ding for the system beep. I tried for days and tried everything I could find online. Any ideas how to move the cursor back to ding is the default beep?
-
HP Deskjet 2540: sweep!
I have my printer related to eprint through the 'classic printer' set up, but how to scan so that it goes to the computer? I tried to understand this here and there for a few months, nothing done. Any help is greatly appreciated.