REG:QUERY THE TABLE
Hi
I have table EMP(empid,empname,deptid) ,DEPT(depid,name) .When i query i want to fetch data eventhough depid is null in emp table.
thx in advance
That is what is called an outer join.
usually a left outer join. And instead of the old school oracle syntax you should use the newer fresh Ansi style syntax.
select *
from emp e
LEFT JOIN dept d on d.dept_id = e.dept_id;
Similar Messages
-
How can query the table MARD using the parameters
Hi,
I have inputs as material number , sales organization , distribution chanel and plant , using this i have query the table MARD . in MARD table material number and plant is available , how can i relate sales organization and distribution chanel to query the table, please help.
Regards,
RatheeshHi,
MVKE table contains the relationship between material, sales org. and distribution channel.
You can hence create a join between MARD and MVKE tables and create a query.
Regards,
Aditya -
Reg: Querying Nested table.
Hi,
I am facing a problem with querying the Nested table.
I have created a type
CREATE OR REPLACE TYPE TY_BOOKS OBJECT( VC_BOOK_NAME VARCHAR2(64) );
CREATE OR REPLACE TYPE NT_TY_BOOKS AS TABLE OF TY_BOOKS;
I have used this nested table in a table Student.
CREATE TABLE STUDENT
( SID NUMBER(10),
CL_NT_BOOKS NT_TY_BOOKS)
NESTED TABLE CL_NT_BOOKS STORE AS CL_NT_BOOKS_TAB;
The problem is one student can have more than one book. So if I need to select the students who have 'Science' books, i wrote this query.
SELECT S.SID,B.VC_BOOK_NAME FROM STUDENT S, TABLE(CL_NT_BOOKS) B WHERE B.VC_BOOK_NAME='Science';
suppose in the table
SID BOOK_NAME
1000 CL_NT_BOOKS('Science')
1001 CL_NT_BOOKS('Maths'),CL_NT_BOOKS('Science')
This query will return only those student-ids who have only "Science" book not those student-ids who have "Maths" & "Science" books.
RESULT
1000 Science
but not 1001....
Please can any one send me the select query which can select iteratively for books names which contains more than one value.Hmm, mysterious. It works for me on my 9.2.0.6 dB...
SQL> CREATE OR REPLACE TYPE TY_BOOKS AS OBJECT( VC_BOOK_NAME VARCHAR2(64) );
2 /
Type created.
SQL> CREATE OR REPLACE TYPE NT_TY_BOOKS AS TABLE OF TY_BOOKS;
2 /
Type created.
SQL> CREATE TABLE STUDENT
2 ( SID NUMBER(10),
3 CL_NT_BOOKS NT_TY_BOOKS)
4 NESTED TABLE CL_NT_BOOKS STORE AS CL_NT_BOOKS_TAB;
Table created.
SQL> INSERT INTO student VALUES (1000, NT_TY_BOOKS(TY_BOOKS('Science')))
2 /
1 row created.
SQL> INSERT INTO student VALUES (1001, NT_TY_BOOKS(TY_BOOKS('Science'),TY_BOOKS('Maths')))
2 /
1 row created.
SQL>
SQL> SELECT S.SID,B.VC_BOOK_NAME FROM STUDENT S, TABLE(CL_NT_BOOKS) B
2 WHERE B.VC_BOOK_NAME='Science'
3 /
SID VC_BOOK_NAME
1000 Science
1001 Science
SQL> What I suggest is most likely to have happened is that you have added a space or some other non-printing cahracter into the book name when you inserted row 1001. If this is not the case then you'll have to do it again in SQL*Plus, cut teh output and paste it here, so we can see what's going on.
Cheers, APC -
Hi,
I need to query the stellent content store( database) and get the values through my CIS application code.Is it possible ? if so how ?
For ex : if want to check the existence of a folder name , how can i query and check that from CIS Code.The Query is:-SELECT A.ID, A.NAME, A.COMB, B.C1,B.C2, B.C3 FROM NT_KFD_RFT_TEST_DATE A, TABLE(OB_KFD_RFT_DATA) B
Nested Table structure Example:-
ID NAME COMB OB_KFD_RFT_DATA
01 TEST ALL
The inner table (OB_KFD_RFT_DATA) structure is
C1 C2 C3
23.5 56.7 78.9
00.9 76.9 53.3
12.4 33.4 23.2
Here outer record is 01 TEST ALL, and inner record is the 3 row decimal numbers.
In Universe, I need to create Objects from C1, C2, C3 columns.
Currently i'm doing it with derived table (by running above query). Is there any other option to do it?
Thanks,
Anu -
hi all,
where to find the enterpraise manager url....i forgot it
i need to know the enterprasie manager url,how to check this one from table.
how to query this,from which table it will be fetch...
pl share ur updates;gk wrote:
hi all,
where to find the enterpraise manager url....i forgot it
i need to know the enterprasie manager url,how to check this one from table.
how to query this,from which table it will be fetch...What's the db version? AFAIK there is no table in which the EM's url is kept. You can see it from the command though emctl status dbconsole .
>
pl share ur updates;Please write proper words in a professional forum like this one.
Aman.... -
XML SQL - query the table with XML in column [urgent]
I have table which have to be query-ied with
oracle.xml.sql.query.OracleXMLQuery class to produce XML
document for web.
Problem is that in one column is already XML data (well formed
HTML) like this:
<font face="Arial">click</font>
and when I call OracleXMLQuery.getXMLString() it encode all's '<'
as ';lt' and so on.
Can I turn off that kind of encoding some way or is it better
sollution for this?
thanks in advance
Bojan
nullYou can use an XSLT Stylesheet to achieve what you are wanting to do.
Say the name of the column containing
the markup is named "DOC", then
transforming the output of OracleXMLQuery
by the following stylesheet using
the oracle.xml.parser.v2.XSLProcessor...
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl utput method="xml" omit-xml-declaration="yes"/>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="DOC">
<xsl:value-of select="." disable-output-escaping="yes"/>
</xsl:template>
</xsl:stylesheet>
Will give the results you are looking for.
You can use the XSQL Servlet to make this combination even easier if that is applicable to your situation. -
Hello,
I am going to drop some tables in production environment for the first time do i need to check the mode of the tablespace?
Thanks,
New_to_oracleThis is a forum, not a chat. Please read documentation before question.
Handle: Sunny4989
Status Level: Newbie
Registered: Jun 20, 2012
Total Posts: 29
Total Questions: 11 (9 unresolved)
Name Sunil
And mark answered the post to clean the forum when your question will be solved. -
Error when querying a table through the Query Window
I am running a query on the following table in the ODT Query window - for some reason I get the error below when trying to retrieve the data - I can query the table just fine through SQL Plus - it errors out whether I use grid or text window
ERROR
Arithmetic operation resulted in an overflow.
CREATE TABLE "RF3_PROD_1"."F_EXTRACTMETRICS" ("EXTRACT_NAME" VARCHAR2(50) NOT NULL,"RUN_START_DATE" DATE NOT NULL,"RUN_END_DATE" DATE NOT NULL,"DURATION" NUMBER DEFAULT 0 NOT NULL,"EXTRACT_START_DATE" DATE NULL,"EXTRACT_END_DATE" DATE NULL,"NUM_RECS_ADDED" NUMBER DEFAULT 0 NOT NULL,"NUM_RECS_DELETED" NUMBER DEFAULT 0 NOT NULL,"STATUS" VARCHAR2(50) NOT NULL,"COMMENTS" VARCHAR2(500) NULL) TABLESPACE "EXTRACT_TAB_01_TS" PCTFREE 15 PCTUSED 75 INITRANS 1 MAXTRANS 255 STORAGE ( FREELISTS 1 FREELIST GROUPS 1 INITIAL 8388608 NEXT 516096 MAXEXTENTS 2147483645 MINEXTENTS 1 PCTINCREASE 0 )
I would have formatted it nicer - but that is the way that ODT created it :)Christian,
I found that this happens when trying to query number fields that are reals with a large decimal value (26 decimal values and above seem to be the magic number). What is strange is that I don't get this problem when I retrieve data from the same table using the Retrieve data option (versus a query for all the data in the Query Window) so they don't seem to be utilizing the same basic code to grab and then display the data interestingly enough (I am sure you knew that). Does this allow you to replicate the issue?
Thanks,
Bryan -
Taking More Time while inserting into the table (With foriegn key)
Hi All,
I am facing problem while inserting the values into the master table.
The problem,
Table A -- User Master Table (Reg No, Name, etc)
Table B -- Transaction Table (Foreign key reference with Table A).
While inserting the data's in Table B, i need to insert the reg no also in table B which is mandatory. I followed the logic which is mentioned in the SRDemo.
While inserting we need to query the Table A first to have the values in TableABean.java.
final TableA tableA= (TableA )uow.executeQuery("findUser",TableA .class, regNo);
Then, we need to create the instance for TableB
TableB tableB= (TableB)uow.newInstance(TableB.class);
tableB.setID(bean.getID);
tableA.addTableB(tableB); --- this is for to insert the regNo of TableA in TableB.. This line is executing the query "select * from TableB where RegNo = <tableA.getRegNo>".
This query is taking too much time if values are more in the TableB for that particular registrationNo. Because of this its taking more time to insert into the TableB.
For Ex: TableA -- regNo : 101...having less entry in TableB means...inserting record is taking less than 1 sec
regNo : 102...having more entry in TableB means...inserting record is taking more than 2 sec
Time delay is there for different users when they enter transaction in TableB.
I need to avoid this since in future it will take more time...from 2 sec to 10 sec, if volume of data increases mean.
Please help me to resolve this issue...I am facing it now in production.
Thanks & Regards
VBHello,
Looks like you have a 1:M relationship from TableA to TableB, with a 1:1 back pointer from TableB to TableA. If triggering the 1:M relationship is causing you delays that you want to avoid there might be two quick ways I can see:
1) Don't map it. Leave the TableA->TableB 1:M unmapped, and instead just query for relationship when you do need it. This means you do not need to call tableA.addTableB(tableB), and instead only need to call tableB.setTableA(tableA), so that the TableB->TableA relation gets set. Might not be the best option, but it depends on your application's usage. It does allow you to potentially page the TableB results or add other query query performance options when you do need the data though.
2) You are currently using Lazy loading for the TableA->TableB relationship - if it is untriggered, don't bother calling tableA.addTableB(tableB), and instead only need to call tableB.setTableA(tableA). This of course requires using TopLink api to a) verify the collection is an IndirectCollection type, and b) that it is hasn't been triggered. If it has been triggered, you will still need to call tableA.addTableB(tableB), but it won't result in a query. Check out the oracle.toplink.indirection.IndirectContainer class and it's isInstantiated() method. This can cause problems though in highly concurrent environments, as other threads may have triggered the indirection before you commit your transaction, so that the A->B collection is not up to date - this might require refreshing the TableA if so.
Change tracking would probably be the best option to use here, and is described in the EclipseLink wiki:
http://wiki.eclipse.org/Introduction_to_EclipseLink_Transactions_(ELUG)#Attribute_Change_Tracking_Policy
Best Regards,
Chris -
Why compilation error--when trying to access the table from itcsi schema
Hi,
when querying the table from itcsi.app iam able to see the data but used in proc saying invalid table name. Whats the problem
when declared p_app_i_old app.app_i%type----It is throwing pls-00201 error
1 Create or replace procedure Test_insert(p_app_i_old integer,
2 p_app_i_new integer,
3 p_APP_ISAC_CPT_I varchar2)
4 is
5 cursor c1 is
6 select distinct table_name,owner
7 from all_tab_columns
8 where owner = 'ITCSI' and column_name='APP_I';
9 t_tablename varchar2(25);
10 t_string varchar2(300);
11 t_num number;
12 Begin
13 For c2 in c1 loop
14 t_num := 0;
15 t_string := 'SELECT count(*) FROM ' || c2.owner ||'.'||c2.table_name||' WHERE APP_I = '||p_
16 execute immediate t_string into t_num;
17 if t_num > 0 then
18 -- dbms_output.put_line('The table name is '||c1_rec.table_name);
19 if c2.Table_name = 'APP' Then
20 INSERT INTO itcsi.App
21 SELECT p_app_i_new,
22 app_acrnym_c,
23 app_x,
24 app_desc_t,
25 app_ipads_t,
26 app_prdcn_stat_t,
27 app_prdcn_stat_d,
28 app_isd_tier_c,
29 app_bus_cont_c,
30 app_extnl_cstm_c,
31 app-ecrpt_lvl_c,
32 app_isac_cpt_i,
33 dsw_gpn_i,
34 ed_cntnt_srce_t,
35 usr_upd_uunm_i,
36 ed_upd_m
37 FROM itcsi.APP
38 WHERE app_i = p_app_i_old;
39 elsif c2.Table_name = 'APP_CETRN' Then
40 Insert into itcsi.APP_CETRN
41 select p_app_i_new,
42 app_cetrn_i,
43 app-curr_cmplnc_t,
44 app_rqr_cmplnc_t,
45 dsw_gpn_i,
46 ed_cntnt_srce_t,
47 usr_upd_uunm_i,
48 ed_upd_m
49 FROM itcsi.APP_CETRN
50 WHERE app_i = p_app_i_old;
51 elsif c2.Table_name = 'APP_GPC' Then
52 Insert into itcsi.APP_GPC
53 select p_app_i_new,
54 gpc_dpnt_x,
55 gpc_elemy_x,
56 pro_i,
57 dsw_gpn_i,
58 ed_cntnt_srce_t,
59 usr_usr_upd_uunm
60 FROM itcsi.APP_GPC
61 WHERE app_i = p_app_i_old;
62 End if;
63 End if;
64 End loop;
65 --Commit;
66* End;
SQL> /
Warning: Procedure created with compilation errors.
SQL> show errors
Errors for PROCEDURE TEST_INSERT:
LINE/COL ERROR
20/2 PL/SQL: SQL Statement ignored
37/23 PL/SQL: ORA-00942: table or view does not exist
40/2 PL/SQL: SQL Statement ignored
Thankshow do i check the grant?
if am in my own schema,how do i connect to itcsi
schema?if you are using a schema other than the ITCSI schema, you need to login as ITCSI. or if you have dba user account you can grant a privilege of
GRANT ALL on ITCSI.APPS to <other SCHEMA>; -
SSIS question - Email the results of the table in pipe delimited format to the users
I am new to SSIS and I have a requirement. I have a sales table that has transactions for all months. I am trying to automate the process which involves following steps:
I need to query the table based on previous month.
Email the results of the table in pipe delimited format to the users.
What I am currently doing:
I created a temp table and load the query results in it every month by truncating the previous month’s data. Saved the query results in excel format. Open the excel and save it in csv format. Use SSIS package to convert csv to txt format and email
them manually with the txt file name as “Salesresults_<previousmonth>.
I just want to automate this process but the main challenge comes up with email with txt attached. Please help me out.First create a SSIS variable(@[User::Path]) that store folder path as "C:\Test".
Select the "Expression" tab in Send Mail Task Editor and select the appropriate property(FileAttachments) and assign the below expression.
@[User::Path] + "\\Salesresults_" + (DT_WSTR, 10) MONTH( GETDATE() ) + (DT_WSTR, 10) YEAR( GETDATE() ) + ".txt"
Regards, RSingh -
Why query against table(dbms_xplan.display) take too long?
the env is PROD, version is Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi.
Most of the time, when I do explain plan and query the table(dbms_xplan.display), it takes like 3-8 minutes to display the result.
So, I wonder what might go wrong here?
How a simple query would take this long?
Any thought or guess are welcome.
ThanksThat is not an option here. I only have query privilege on PROD.
All I can do is to figure out the reason for the slowness and advise the fix.
Thanks. -
Dear all,
I have a table containing blobs with only text in there. Now I would like to query the table for records where the blob contains a certain string. However I keep getting a ORA-00932 error message stating inconsistent datatype; expecting NUMBER got BLOB
This is the query I use where user_data is the BLOB.
select * from user_defined
where user_data like '%test_account_used%'
order by ENQ_TIME desc
Can anybody please explain what is wrong and what is the correct approach on querying a blob.Hello,
Look at this:
SQL> desc bin_docs
Name Null? Type
DOC_ID NOT NULL NUMBER(5)
NAME VARCHAR2(128)
DOC BLOB
SQL>
Declare
b_lob blob ;
Begin
b_lob := utl_raw.cast_to_raw('One two three yargla oumbala toto' || lpad( 'x', 20000,'x') ) ;
insert into bin_docs values (3, 'xx', b_lob ) ;
End ;
SQL> select doc_id, to_char( substr( utl_raw.cast_to_varchar2(doc), 1, 200 ) )
2 from bin_docs
3 where to_char( substr( utl_raw.cast_to_varchar2(doc), 1, 200 ) ) like '%yargla oumbala%'
4 /
DOC_ID TO_CHAR(SUBSTR(UTL_RAW.CAST_TO_VARCHAR2(DOC),1,200))
3 One two three yargla oumbala totoxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
SQL> Francois -
Search panel automatically queries the table
Hello Experts,
I have built a search page with query panel and the viewobject is of query based which we did it in 11.1.1.6
and we kept that page in webcenter portal and trying to run it
when I login into that portal and open that search page it opens the page with out querying the table then I search for something and click on search then it searches that and then I have project-id and company-id links in the table when i click on any of the table it goes to respective project.
and then when I click on side navigation for the search page it takes lot of time then we saw in back-end it triggers the table search everything and came back showing the page it self not the search results.
Note: I m not using any check box of query automatically..
I would like to know why is it querying the table unnecessarily
Thanks a lot in Advance!
Santosh.I m sorry when I run the project in standalone first time it runs properly and comes very fast
but when I go to some other project by clicking on project_id or company_id and then change the URl to run the search page again it does the same thing query the table and come up with the page w/0 any results
I don't know why it is behaving weird like first time it comes w/0 searching and next time it tries to search the table.. -
Basic question about querying georaster tables
hello all
i have a table with georaster column containing georeferenced images covering large area. can i query the table to get an image covering any user given cooordinates . the user given coordinates can span more than one image in the table. is this possible
thanksHi,
Yes this is possible to operate with several GeoRaster images in one or several tables. But before this you should create specific GeoRaster metadata structure to join those separate images. You can find information about this procedure in GeoRaster documentation.
Regards,
Andrejus
Maybe you are looking for
-
How do I rename many photos all at one time with one click?
I have got many photos of a sery and want to rename it all with one click only (instead of clicking through it all in single actions and wasting time). How can I rename many pictures/photos all together with one click only? - 1) I have OS X Yosemite
-
My new backbeat GO 2 headset is not recognized by bluetooth service of my new ipad mini with ios 7.0.4! It doesńt appear in the list of bluetooth devices. It was working on previous versions! What happens? Could someone help me? Thanks!
-
Satellite A660 How can i turn off the lighting of the power button?
Hello, I recently bought a new Toshiba A660-1FL. However bothers me is the lighting of the multimedia keys, if I work in the dark. In Bios I could turn off the led illumination, but the power on/off button is still lighting,that distracts me when i a
-
How to Import pictures in iphoto on ipad with original name
How to import pictures into iphoto on my ipad air with the original filenames. IT now Seems my pictures get a new name.
-
Lately when I have been using my Apple Wireless Aluminium Keyboard with my iPad, I have been noticing issues such as it typing two of the same letter, or lagging at plugging in the letters. It was really bad before I restarted the iPad, not sure that