I have a table with multiple column. A column named address have value of multiple lines. Now i want to select the address only of the first line. How does it possible.
select * from test_1 IDNameTotal ----------- 1A100 2B100 3C100 4D100
test_2 table contains the concatination of ID's with comma seperated. Actually in this table ID column is of datatype varchar2. select * from test_2 ID ---- 1,2,3
My requirement is to select the data from test_1 table where the id values in this table exists in test_2 table. I tried with the belowselect statement, but could not get any data.
SELECT * FROM test_1 WHERE to_char(id) IN (SELECT id FROM test_2)
create table test_1 (id number, name varchar2(100), total number) create table test_2(id varchar2(100)) insert into test_1 values (1,'A',100) insert into test_1 values (2,'B',100) insert into test_1 values (3,'C',100) insert into test_1 values (4,'D',100)
I am new to oracle designer, forms. The requirement is to select a csv file in a form ,read the file and load selected columns from a csv file into a table.
I am using CLIENT_TEXT_IO. I want to know how to extract the data from selected columns from csv file and insert into a table if the lenth of the columns are of variable length.
Another condition is that if there are duplicate rows based on orderid then take the maximum order seq nbr.Do I need to use temp table for this logic?
I wanna have a form which has a list box which is including of all table names, by selecting the required table by user all column name and its related data should be retrieve.I have a cursor which give me all field names related to the table by I do not know how can I retrieve table data:
1. How to add item through block base on number of column which selected table has.
2. How to set value of table column in these mentioned column which added in the block.
Is it possible to hold the data from select statement without temp table or materialized view or view in oracle?
because my DBA does not give access to create temp table.but we are selecting the records from 3 different sql statement.
Example: inserting in temp table
a) insert into temp select empno,ename,sal from emp where sal>4000 b) insert into temp select empno,ename,sal from emp where dept=40 c) insert into temp select empno,ename,sal from emp where comm is null
BANNER Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production PL/SQL Release 11.2.0.2.0 - Production CORE 11.2.0.2.0 Production TNS for Solaris: Version 11.2.0.2.0 - Production NLSRTL Version 11.2.0.2.0 - Production
I have loaded into an Oracle table defined as XMLTYPE. I'm okay with PL-SQL and stored procedures, where I will ultimately do this processing once I get a handle on XML DB querying from an XMLTYPE table.
Based on reading the oracle documentation about XML DB, and more importantly, reading dozens of posts to this forum,I have been successful in loading the XML files into a SQL XMLTYPE table and doing simple queries against that table to retrieve some of its data so that I can then insert that data into other target oracle relational tables.
how to select parent/child data from XMLTYPE tables. I am able to follow the forum examples and can replicate the methods shown on the many example XML contents shown on this forum, but not against the XML that I have to process. I am wondering if my struggle is caused by my lack of knowledge, or by ill-formed XML content supplied to me by the educational vendor.The XML content has structured the XML content nodes in such a way that I do not seem to be able to apply the parent/child sql methods.I have been able to use for other XML examples I have tested against.
My XML file shown below represents High School Transcript data, for which I need to be able to parse out into my own oracle relational tables for that student, his personal info, and his course info, etc. i.e., for our example, which courses he has taken for which High School grade levels. The vendor-supplied XML seems to put the Courses and the High School grade level in "parallel nodes," instead of parent/child nodes, so I am struggling to be able to use SQL to differentiate which course the student took in NinthGrade versus TenthGrade.
-- WHat I would like to determine from a select statement:
LASTNAME GradeLevel COURSETITLE ============================= Smith NinthGrade PHYS ED 101 Smith TenthGrade CALCULUS 201 Smith TenthGrade ZOOLOGY 202
(The data has been simpliied and masked, but is true to the content and is queryable).
select * from V$VERSION
BANNER Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production PL/SQL Release 11.2.0.2.0 - Production CORE 11.2.0.2.0 Production TNS for Solaris: Version 11.2.0.2.0 - Production NLSRTL Version 11.2.0.2.0 - Production [code]....
I'm trying to select some data from table base on SYSDATE. The below query does not return any data.
My query is:
select count(TICKET_ID) "ECEMEA" from QTMT_TICKETS where STATUS_ID=1 and TEAM_ID=3 and RECEIVED_DATE=sysdate
why this does not work? Date format in my application is: DD-MMM-YY (16-AUG-12). In the database the dates are stored in this format: MM/DD/YYYY (08/25/2012). Does it mean, that I have to play with the format?
Insert into test values ('2/03/2011') Insert into test values ('02/03/2011') Insert into test values ('12/33/2011') Insert into test values ('xxx') Insert into test values ('33/33/2011') Insert into test values ('03/03/11')
Table Name PURCHASE exists in all above three schema with different data(according to date)
Like User09 ----> purchase ---- data date Jan09 to Dec09 User10 ----> purchase ---- data date Jan10 to Dec10 User11 ----> purchase ---- data date Jan11 to Dec11
I want to select * from purchase, from above all three user with select statement.I can select data one by one with union all
select * from user09.pruchase Union all select * from user10.pruchase Union all select * from user11.pruchase
after creating this query I add another User User12 and that User has same purchase table so I will have to add one another line IN Union all Query. when I see this query. It gives me the all owner name of User09,User10,User11......
SELECT * FROM ALL_ALL_TABLES WHERE OWNER LIKE 'USER%' and table_name ='PURCHASE'
I have an PL/SQL query which gives the data between the date interval submitted by the user.The problem is that i want all the date irrespective of it has data or not for eg: Let say date parameter is from 1-Jan-2012 to 5-Jan-2012
Now, in the database the available dates are:
1-Jan-2012 2-Jan-2012 5-Jan-2012
So as you can see here that dates 3-Jan-2012 and 4-Jan-2012 is not resulted out by the query. I want all the dates.
how to get the output in below format. Count how many times each file is selected in a month.
Output format should be like below.. ============================================== File_Name Jan Feb Mar Apr ---------- Dec ============================================== file1 2 1 3 0 ---------- 2 file2 1 0 2 1 ---------- 3 file-n 8 2 3 0 ---------- 2
I have an athletics participation table that only has the relevant emplid and effective date field. There is no term field on the table. I'm trying to only select those emplid's where the max( effdt) for the emplid is between the begin and end date of the current term. I only want to select current athletes. I would much rather it be for the current academic year but it seems impossible. Why can't I use max(effdt) here?
sql Code
AND h.emplid IN(SELECT b.emplid FROM PS_ATHL_PART_STAT b where max(b.effdt) between (SELECT term_begin_date AND term_end_date from PS_TERM_TBL
The description field in the item table has the single quote used as the symbol for feet. I have the same issue pulling from a last name field in other tables. (Like O'Connor)
select descrip into v_result from c_ship_hist where shipment_dtl_id = :SDID; exception when others then null;
The error I get is "Missing right quote". How do I code around this issue without having to change the data?
how to display REFS from within a REF. I've not used my exact code here as its quite a big file so i've made a similar scenario to get me point across. Here is the code first:
1 CREATE OR REPLACE TYPE object1 AS OBJECT ( 2 object_id NUMBER(5), 3 object_name varchar2(10), 4 object_added DATE); 5 / 6 CREATE TABLE object1_tab OF object1 (object_id PRIMARY KEY); 7 / 8 INSERT INTO object1_tab 9 VALUES (1,'Daniel',sysdate); 10 / 11 show errors; 12 / 13 CREATE OR REPLACE TYPE object2 AS OBJECT ( 14 object_id NUMBER(5), 15 object_job varchar2(10), 16 object1_ref REF object1 ); 17 / 18 CREATE TABLE object2_tab OF object2(object_id PRIMARY KEY); 19 / 20 INSERT INTO object2_tab 21 VALUES (1,'Developer',(SELECT REF(p) FROM object1_tab P 22 WHERE VALUE(p).object_id = &object_id)); 23 / 24 select DEREF(object1_ref) 25 FROM object2_tab; 26 / 27 CREATE OR REPLACE TYPE object3 AS OBJECT ( 28 object_id NUMBER(5), 29 object_location VARCHAR2(20), 30 object2_ref REF object2); 31 / 32 CREATE TABLE object3_tab OF object3 (object_id PRIMARY KEY); 33 / 34 INSERT INTO object3_tab 35 VALUES (1,'New York',(SELECT REF(p) FROM object2_tab P 36 WHERE VALUE(p).object_id = &object_id)); 37 / 38 show errors; 39 / 40 select object_id,object_location,DEREF(object2_ref) 41 FROM object3_tab; 42 /
As yot can see in the code each object refernces from the previous. When I view the DEREF in the third table (object3_tab) i get the following output:
OBJECT_ID OBJECT_LOCATION DEREF(OBJECT2_REF) --------- -------------------- ---------------------------------- 1 New York [SANTA.OBJECT2]
I wanted to select data which is inserted on the same time.
Is that possible? I am trying with below query but facing isses.
SQL> SELECT a,b,c,d FROM tb;
no rows selected
SQL> SELECT a,b,c,d FROM (INSERT INTO tb VALUES(1,1,1,1)); SELECT a,b,c,d FROM (INSERT INTO tb VALUES(1,1,1,1)) * ERROR at line 1: ORA-00903: invalid table name
I need to query an users name, manager,location and the manager's manager. Say the info for user A would be,
User : A Location : Bangalore
Manager : B Manager's Manager : C
I can get this in two step process.
select attribut,attribute_val from test_join where user_name = 'A'; select attribute_val from test_join where user_name = (select attribute_val from test_join where user_name = 'A' and ATTRIBUT = 'manager') and ATTRIBUT = 'manager';
But is there a way to get this in one single query ?
I am attempting to use the following select to get a specific emplid. However, the ps_names table contains some alphabetic characters. I want to only focus on the emplid's that contains numbers. Is there a way to modify the following select to do this?
bubbagumpshrimp "ORA-01722: invalid number" SELECT x.y from (select PERCENTILE_CONT(0.10) WITHIN GROUP (ORDER BY to_number(emplid)) over () y from PS_NAMES where emplid > '000000000' and emplid < '999999999') x where rownum = 1;
That�s generally the format the values would appear in the table if I just did a standard select. I want it displayed in a more hierarchical Parent � child way.
The format I need to get out is as follows: Lvl KeyParKey hasCh 1k101 2k34k10 2k22k11 3k56k220 3k109k221 4k61 k1090 3k67k220 2k24k10 1k200 1k301 2k13k30 2k52k30 2k35k30 2k13k30 1k401 2k11k40