How do you use 3 Where Clauses in a query

Hi, i am trying to figure out how to use 3 Where Clauses in a Query where 2 of the Where Clauses uses a Sub query.
Display the OrderID of all orders that where placed after all orders placed by “Bottom-Dollar Markets”.
Order the result by OrderID in ascending order.
First WHERE clause checks for OrderDate and uses a sub query with ALL keyword.
Second WHERE clause use equals and sub query.
Third WHERE clause uses equal and company name.
This is what i have so far but i am pretty confused on how to do this.
My Code for NorthWind:
Select OrderID
From Orders o
Where o.OrderID IN (Select OrderDate From Orders Where Orders.OrderID > ALL
(Select CompanyName From Customers Where CompanyName = 'Bottom-Dollar Markets'));
The book shows how to use the ALL Keyword but not in a Sub query with Multiple Where Clauses.
Select VenderName, InvoiceNumber, InvoiceTotal
FROM Invoices JOIN Vendors ON Invoices.VendorID = Vendors.VendorID
WHERE InvoiceTotal > ALL (Select InvoiceTotal From Invoices Where VendorID = 34)
ORDER BY VendorName;

>Where Orders.OrderDate
> ALL  (Select
CompanyName
The comparison operator (>) requires compatible data types.
DATETIME is not compatible with VARCHAR string for comparison.
Here is your homework:
SELECT orderid
FROM orders o
WHERE o.orderdate > ALL (SELECT orderdate
FROM orders
WHERE shipvia = (SELECT Max(shipvia)
FROM orders o
INNER JOIN customers c
ON c.customerid =
o.customerid
WHERE
c.companyname = 'Bottom-Dollar Markets'));
11064
11065
11066
11067
11068
11069
11070
11071
11072
11073
11074
11075
11076
11077
Kalman Toth Database & OLAP Architect
SQL Server 2014 Database Design
New Book / Kindle: Beginner Database Design & SQL Programming Using Microsoft SQL Server 2014

Similar Messages

  • VPD - How to make the where clause a correlated query

    Hi,
    My VPD function has the following where clause:
    where_clause:= ' project_id in (select object_id from pa_project_classes p'||
    ' where p.class_category='||''''||l_cat||''''||
    ' and p.CLASS_CODE='||''''||l_class||''''||
    ' and p.OBJECT_TYPE=''PA_PROJECTS'''||
    The problem is that the subquery is not using the unique key defined on the table pa_project_classes. What I need is something as follows:
    where_clause:= ' project_id in (select object_id from pa_project_classes p'||
    ' where p.class_category='||''''||l_cat||''''||
    ' and p.CLASS_CODE='||''''||l_class||''''||
    ' and p.OBJECT_TYPE=''PA_PROJECTS'''||
    ' and p.object_id=mainquery.project_id ||
    The problem is that since the table pa_project_classes also has a column project_id, I have to prefix the column name by the alias of the main query like 'mainquery.project_id'. However this seems impossible as main query is not unknown .
    I would be grateful if you could suggest any workaround or solution.
    Thanks

    Just have a look over these two statements if it solves your problem
    one time where clause
    Set_Block_Property('BLOCK_NAME',ONETIME_WHERE,your form item);
    dynamic where clause
    set_block_property('BLOCK_NAME'default_where, your form itme)
    you can where clause at run time from any procedure or some triggers

  • Performance hit using "where" clause in the query

    Hi All,
    I am facing a huge performance hit in the java code when using "where" clause in queries. Following are the details:
    1. SELECT * FROM Employee
    2. SELECT * FROM Employee where employeeid in (26,200,330,571,618,945)
    There is no difference in Query Execution Time for both queries.
    Business Logic Time is huge in second case as compared to first one (ratio - 1:20).
    Rows returned are more in first case as compared to second case.(ratio - 1:4)
    Business Logic is same for both the cases where I iterate through the ResultSet, get the objects and set them in a data structure.
    Does anybody know the reason of unexpected time difference for the business logic in the second case?

    Since you're mentioning clustering your index, I'll assume you are using Oracle. Knowing what database you are using makes it a lot easier to suggest things.
    Since you are using Oracle, you can get the database to tell you what execution plan it is using for each of the 2 SQL statements, and figure out why they have similar times (if they do).
    First, you need to be able to run SQL*Plus; that comes as part of a standard database installation and as part of the Oracle client installation - getting it set up and running is outside the scope of this forum.
    Second, you may need your DBA to enable autotracing, if it's not already:
    http://asktom.oracle.com/~tkyte/article1/autotrace.html
    http://www.samoratech.com/tips/swenableautotrace.htm
    Once it's all set up, you can log in to your database using sql*plus, issue "SET AUTOTRACE ON", issue queries and get execution plan information back.
    For example:
    SQL> set autotrace on
    SQL> select count(*) from it.ticket where ticket_number between 10 and 20;
      COUNT(*)
            11
    Execution Plan
    Plan hash value: 2983758974
    | Id  | Operation         | Name       | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |            |     1 |     4 |     1   (0)| 00:00:01 |
    |   1 |  SORT AGGREGATE   |            |     1 |     4 |            |          |
    |*  2 |   INDEX RANGE SCAN| TICKET_N10 |    12 |    48 |     1   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - access("TICKET_NUMBER">=10 AND "TICKET_NUMBER"<=20)
    Statistics
              0  recursive calls
              0  db block gets
              1  consistent gets
              0  physical reads
              0  redo size
            515  bytes sent via SQL*Net to client
            469  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              1  rows processed
    SQL> This tells me that this query used an INDEX RANGE SCAN on index TICKET_N1; the query can't do much better than that logically... In fact, the statistic "1 consistent gets" tells me that Oracle had to examine only one data block to get the answer, also can't do better than that. the statistic, "0 physical reads" tells me that the 1 data block used was already cached in Oracle's memory.
    the above is from Oracle 10g; autotrace is available back to at least 8i, but they've been adding information to the output with each release.
    If you have questions about sql_plus, check the forums at asktom.oracle.com or http://forums.oracle.com/forums/category.jspa?categoryID=18
    since sql*plus is not a JDBC thing...
    Oh, and sql*plus can also give you easier access to timing information, with "set timing on".

  • How to use WHERE Clause in BPEL

    Hi ,
    i am trying to use where clause in DB adapter but its not working.
    my query is "select empname from employee where empid = &a"
    can any body tell me what is the reason its npt working?
    and how can i retrive data form DB?

    Hi,
    You are thinking perfectly fine. The solution what I suggested was
    select ename from emp where empno=?
    And the solution provided by you was
    SELECT first_name, last_name FROM per_all_people_f WHERE person_id = #p_person_id
    There is no problem with the above mentioned select statements.
    I just want to say that if you see closely, internal logic changes #parameter name to ?. So both the logics are right.
    Cheers,
    Abhi...

  • How to Get the required List Item values by using Where Clause

    I have two tables named "TAX_RULES","BILL"
    1. " Tax_Rules" (Sub_Head_Code,Tax_ID,Tax_Percentage)
    { While "Sub_Head_Code" field is unique,
    Tax_ID describes that there are two kinds of Tax_IDs based on Tax_percentage which is 6% for some Sub_Head_Codes and 3.5% for the remainng Sub_Head_Codes. I have given Tax_ID 1 for 6% and Tax_ID 2 for Sub_Head_codes having 3.5%. }
    2. "BILL" (Bill_ID,Sub_Head_Code,Tax_ID,Bill_Amount)
    {While "Bill_ID" describes unique Bill Identification Number,
    Sub_Head_Code and Tax_ID are behaving like composite foreign key from Tax_Rules table}
    I have design form for both tables.
    In BILL form i am trying to get values of Tax_ID from Tax_Rules table at run-time by using WHEN-NEW-FORM-INSTANCE.
    For this whenever i select a Sub_Head_Code in Bill Form, all the Tax_IDs that i have recorded against each Sub_Head_Code which is either 1 or 2 against 6% and 3.5% respectively.
    But I want that whenever i select a "Sub_Head_Code", Only that Tax_ID which is associated with that Sub_Head_Code ahould come in the LIST ITEM.
    I have used WHERE clause but that is useless.
    Following is the Code that i have applied in the WHE-NEW-ITEM-INSTANCE Trigger at FORM LEVEL
    <CODE>
    DECLARE
         rg_n1 VARCHAR2(40) :='TAX_ID';
         rg_idn1 RecordGroup;
         gc_idn1 GroupColumn;
         errcode NUMBER;
    BEGIN
         CLEAR_LIST('BILL.TAX_ID');
         rg_idn1 := Find_Group(rg_n1);
    IF      Id_Null(rg_idn1) then
              rg_idn1 := Create_Group(rg_n1);
         gc_idn1 := Add_Group_Column(rg_idn1,'EXPLAIN',CHAR_COLUMN,60);     
              gc_idn1 := Add_Group_Column(rg_idn1,'TAX_ID',CHAR_COLUMN,3);
         END IF;
         errcode := Populate_Group_With_Query(rg_idn1,'select TAX_ID,TAX_ID from TAX_RULES');
         POPULATE_LIST('BILL.TAX_ID',RG_IDn1);
    END;
    </CODE>

    In the Tax Rules table, you state:
    "Sub_Head_Code" field is unique
    In the Bill table, you state:
    Sub_Head_Code and Tax_ID are behaving like composite foreign key from Tax_Rules table
    If the Sub_Head_Code is unique, then it's acting as a primary key, so Sub_Head_Code and Tax_ID in the Bill table are not behaving like a composite foreign key. The Sub_Head_Code is a foreign key, and the Tax_ID is irrelevant as far as keys are concerned.
    It is not clear what it is you want to do.
    If you want to display the Tax_IDs from the Bill table when you select a Sub_Head_Code from the Tax_Rules table, then change your query to:
    select TAX_ID, TAX_ID from BILL where Sub_Head_Code = :Tax_Rules.Sub_Head_Code
    If you want to display the Tax_IDs from the Tax_Rules table when you select a Sub_Head_Code from the Bill table, then change your query to:
    select TAX_ID, TAX_ID from TAX_RULES where Sub_Head_Code = :Bill.Sub_Head_Code
    If this is not what you want, then clarify what it is you want to do. Don't say:
    "I want that whenever i select a "Sub_Head_Code", Only that Tax_ID which is associated with that Sub_Head_Code"
    because it is not clear what tables you are referring to.

  • How to set the where clause of a value set on the basis of a form field

    I am using a DFF(Descriptive FlexField), which needs to display the value of a certain column(say columnA) on the basis of the value of another column(say columnB).
    So i have created a value set which points to the table which has both these columns, and the DFF uses this value set. However, the problem is that I have not put any where clause in the value set, because of which i cannot handle the exact fetch returns more than one rows error.
    The query has to be as follows:
    select ColumnA from tbl where ColumnB = [ a form value ];
    What I want to know is how can i get the value of a certain field of a certain block of the form in the above query.
    Edited by: 981615 on Jan 14, 2013 12:48 AM
    Edited by: 981615 on Jan 14, 2013 12:48 AM

    Just have a look over these two statements if it solves your problem
    one time where clause
    Set_Block_Property('BLOCK_NAME',ONETIME_WHERE,your form item);
    dynamic where clause
    set_block_property('BLOCK_NAME'default_where, your form itme)
    you can where clause at run time from any procedure or some triggers

  • How do you use the Multiple Item Information dialog box ???

    How do you use the Multiple Item Information dialog box ???
    Where are the instructions on how the information in the Multiple Item Information dialog box equates to ...
    1. The way iTunes sorts tracks and albums
    2. The reason to select a leading check box
    3. Why there are Option selections (Yes /No) and leading check boxes.
    4. Why some changes remain in the track info, but do not "take effect" in iTunes (Part of a compilation is an example)
    Looked in Help, Support, went to the local Genius bar for an hour, even arrainged a call from apple support ...
    Thanks

    As Christopher says, it's a compilation. Different tracks are by different artists.
    Setting the *Album Artist* field to *Various Artists* and setting *Part of a compilation* to Yes should be all that is required. Depending on your *Group compilations when browsing* setting ( I recommend On ) either should suffice but I suggest doing both.
    Based on your commentary, I selected all the "O Brother" tracks, and checked the boxes for everything line that was blank in the Info and the Sort panes. Only exceptions were the album name and the disc number 1 of 1 and the artwork. I blanked and checked anything else.
    That's not what I meant. When you select multiple tracks, only those values which +are already common+ to all tracks are displayed. Typically these will include Artist, though not with compilation albums, Album Artist, Album, No. of Tracks, Genre plus various sort fields. A blank value may indicate that different tracks have different values or it may be that the value is blank for all tracks. For the drop down values on the Options tab the value shown may not reflect the information in every tag. If values you expect to be common, such as Album Artist or the Album title are not displayed you can simply type these in and click OK. This will often be enough to group the album.
    If you place a checkmark against the blank boxes and apply changes then you will clear those fields so you should only do this if that is the effect you want. Putting a checkmark next to an empty (representing different values) *Track No.* box, for example, will just clear the all the track numbers which is very rarely useful.
    Adding then removing extra text is for a specific problem where despite all common values being identical across the tracks of the album iTunes seems to "remember" that it should see two albums. A typical example would be when an album originally listed as *Album CD1* & *Album CD2* is given disc numbers X of Y and then has the Album name changed to Album. I've seen iTunes merge all but one track into the new album, but insist on listing one remaining track separately, despite both albums having the same title. In this case I've found overtyping the album title again has no effect whereas changing it to AlbumX and then back to Album does what I was trying to achieve in the first place.
    Don't forget that even properly organsied albums may still break up if you don't chose an album-friendly view. Sorting on the track name or track number columns can be useful in some circumstances but in general I revert to Album by Artist when browsing through my library.
    tt2

  • How do you use one managed session bean from another?

    Hello -
    I am a complete newbie to JSF coming from Struts 1. My question is how do you use one managed bean from the method of another one? I think this would be a common senario. For example I put a bean in session scope when a user logs in and in a different method within a different bean I want to get some of this user's information. What is the correct way to retireve one bean from a method in another with session scope?
    Also what would the code look like to retieve another bean from the method of a managed bean where the bean you want to retrieve has application scope?
    Thank you in advance.

    Sinplicity wrote:
    Could you be a bit more specific? If a bean is configured in the faces config file then all of it's properties are managed, correct?Not necessarily.
    What would the code look like to retireve the bean?You don't retrieve it, it has been injected.
    Can I retrieve the whole bean or just a property of the bean. I would be really interested in seeing how this is done in code? And would really love a bit more information on what it means to be a managed property?Time to consult a JSF tutorial.

  • How to avoid repeat where clause in oracle sql

    Hi,
    Please find my query below, I need a help to avoid duplication of **where** clause in my query.
    In my below query, **JOIN** condition is same for both the queries and **WHERE** condition also same except this clause "and code.code_name="transaction_1"
    In **IF ** condition only credit and debit is swapped on both queries, due to this **Credit and Debit** and this where clause "and code.code_name="transaction_1" I am duplicating the query. Can you please give some solution to avoid this duplication. I am using oracle 11g
    select DAY as business_date,sum(amount) as AMOUNT, type_amnt as amount_type,test_code as code_seg
    from
    select table1_alias.date as DAY,code.code_numb as test_code,
    CASE
    WHEN qnty_item > 0 THEN 'credit'
    ELSE 'debit'
    END as type_amnt,
    "25.55" as amount
    from
    code_table code,
    table1 table1_alias
    join table2 table2_alias on table1_alias.id = table2_alias.id
    where
    table1_alias.state="OK"
    and table1_alias.type="R"
    and code.code_type="Movie"
    and code.code_name="transaction_1"
    UNION ALL
    select table1_alias.date as DAY,code.code_numb as test_code,
    CASE
    WHEN qnty_item > 0 THEN 'debit'
    ELSE 'credit'
    END as type_amnt,
    "25.55" as amount
    from
    code_table code,
    table1 table1_alias
    join table2 table2_alias on table1_alias.id = table2_alias.id
    where
    table1_alias.state="OK"
    and table1_alias.type="R"
    and code.code_type="Movie"
    and code.code_name="transaction_2"
    group by DAY, test_code,type_amnt
    Thanks

    user10624672 wrote:
    Hi,
    Please find my query below, I need a help to avoid duplication of **where** clause in my query.
    In my below query, **JOIN** condition is same for both the queries and **WHERE** condition also same except this clause "and code.code_name="transaction_1"
    In **IF ** condition only credit and debit is swapped on both queries, due to this **Credit and Debit** and this where clause "and code.code_name="transaction_1" I am duplicating the query. Can you please give some solution to avoid this duplication. I am using oracle 11g
    select DAY as business_date,sum(amount) as AMOUNT, type_amnt as amount_type,test_code as code_seg
    from
    select table1_alias.date as DAY,code.code_numb as test_code,
    CASE
    WHEN qnty_item > 0 THEN 'credit'
    ELSE 'debit'
    END as type_amnt,
    "25.55" as amount
    from
    code_table code,
    table1 table1_alias
    join table2 table2_alias on table1_alias.id = table2_alias.id
    where
    table1_alias.state="OK"
    and table1_alias.type="R"
    and code.code_type="Movie"
    and code.code_name="transaction_1"
    UNION ALL
    select table1_alias.date as DAY,code.code_numb as test_code,
    CASE
    WHEN qnty_item > 0 THEN 'debit'
    ELSE 'credit'
    END as type_amnt,
    "25.55" as amount
    from
    code_table code,
    table1 table1_alias
    join table2 table2_alias on table1_alias.id = table2_alias.id
    where
    table1_alias.state="OK"
    and table1_alias.type="R"
    and code.code_type="Movie"
    and code.code_name="transaction_2"
    group by DAY, test_code,type_amnt
    ThanksA very brief glance and it looks to me like the only difference between the 2 queries are
    and code.code_name="transaction_1"In the first portion and
    and code.code_name="transaction_2"So if that's all that is difference, you'd just want to use a single query (no union's) with
    and code.code_name in ('transaction_1', 'transaction_2')Cheers,

  • Query using where clause

    I am not able to run a SQL query using where clause.
    the query is as follows:
    I extract the text input by the user in a text field say 'a' and
    store it in string 'y'.
    String y= a.getText();
    //running the query
    Select A from B where B.x=y;
    how do we run a where clause when y is a string variable instead of value?

    Use the following :
    String y = a.getText();
    String query ="select A.CODE from Port A where A.NAME=" + "'" + y + "'" ;
    ResultSet rs= stmt.executeQuery(query);

  • How do you use imessages on "Mountain Lion"

    How do you use i-messages on Mountain Lion, Several analysis of the new operating system seem to say you can do that but  I tried to send a message to my Ipod, Iphone and I-Pad from the new operating system " Mountain Lion"  But I guess I got things set up wrong it did not work.  I got no messages from the I-Mac.
    Since I am a new I-Mac used ( Have a ipod, ipad & Iphone) would like to be able to send Imessages from my I-Mac and can't figure out how to do that. I keeps wanting to send AIM messages and when I go to change it to I Cloud mesages I don't see I-Cloud on the list???

    Joe thanks for the reply but I am still confused here is the problem:
    I opened The accounts window and went to my ME.com account but it wants me to set up an AIM account , what is that all about . I was sure I was sending the messages thru the apple server .
    Second I am a PC person and this is my wifes I-Mac,  so I am new to MACS but I have used PC's for 35 years. 
    She wants to be able to send me I-Messages for her MAC that is why I am trying to set this up for her.   She is NOT a Techie and so she depends on me.  I am very confused by the MAC as I have buily trouble shoot and fixed PS (not as a profession but as a hobby) I am trying to get used to the MAC so I can help my wife. As I have an IPOD and an 4S I-Phone. Now you know the whole story.  Sorry to bore you with the details but I was sure it would help you give me a better Idea of where to go to correct the AIM situation.
    OK when I go to the ME.com account there is no where where I see Caller ID???
    What I see is My wifes e-mail a Bonjour ( imactive) account, &  Yahoo account.  I may be in the wrong place
    Toi be frank I don't see an Imessages account.  Under mail accounts I see My wifes 5 e-mail accounts and one of them is a .ME account ( I assume that is the icloud account) but where it says account type it says AIM how do I change it to an I Cloun account?
    OK the next question when you say click on the DOCK I go to system preferences and click on DOC and I get some screen that shows SIZE, Magnification Position on screen and so on.
    When I go to the Finder and click on Applications I get a window that says messages but there is nothing on that window that I can adjust?
    Help Where is i messages

  • How do you know where you quit editing your pictures in your organizer?

    How do you know where you quit editing your pictures in your organizer. I have only used the program twice and now I am lost as to where I stopped. Thank you for any help in this matter.

    hatstead wrote:
    The properties dialog refers to a point in time
    Exactly my point.  If one has been using the Organizer to go through the images one at a time and editing them in the Editor; at a later date one would want to know where to begin editing additional images.
    Ken

  • How do you use your iPod Touch?

    I'm thinking of buying an ipod touch 5th gen, but I have to convince myself that it would help me significantly before I drop $300 on a device. My question: how do you use your iPod Touch, aka, what things have helped you significantly, excluding games? I've heard a ton about how awesome the new version is, and everything about its camera and retina display, but I want to know that I would actually use one first....
    Thanks.

    Surf the web from bed and coffee shops/bookstores.  When in a store that has WiFi I may research a product that looks interesting to buy.
    It is a camera that is always with you (assuming you always take it with you), so you can capture that picture that happens once in a life time.  Also the camera is great when shopping for "Big Ticket" items as you can take pictures to remind you of things you were looking at so you can do additional research at home before making your final decision.
    Check my mail from bed and coffee shops/bookstores, etc... when WiFi is available.
    Use it as an alarm clock, meeting reminder, todo reminder.
    Take notes (not school notes, just ideas, stuff I maybe want to buy, useful information I may pick up in a bookstore, books I may want to buy, etc...)
    Contains my contacts for friends, family, and businesses (plumber, dentist, doctor, etc...)
    Plays music, or in my case, I listen to podcasts
    Reading ebooks.  I use it a lot to read ebooks.  It is always with me, so I can read a book anywhere, such as waiting in a doctor/dentist office, at the motor vehicle registry.  And reading in bed is great as when you fall asleep, it remembers what page you were on vs that book that drops onto your face and wakes you back up while at the same time loosing your page
    The Maps app is great for finding where something is located, and plotting how to get there (not as good as having an iPhone with GPS, but still useful).  Also the satellite images make it easier to visualize where you are going.
    When connected to WiFi it can be used for Facetime when calling a friend or family member that also has an iOS device.  Seeing a loved one when they are not near can be emotionally satisfying.  You can also make skype calls.
    I use 1Password to store all my passwords.  It keeps them secure, I always have them with me, and I do not need to use the same password over and over again, or make them too simple to remember.  1Password has a built-in browser so you it can substitute the correct password for the web site you are visting without actually needing to look it up.
    1Password related but not passwords.  Because 1Password encrypts all the data it holds, I can also store sensitive information (such as medical conditions, or other information I do not want made public should my device be lost or stolen), yet always have that information with me should I need it.
    I can get the weather.  This week, I've been using an app to get high/low Tide infromation, plus sunrise information.  But getting weather info when you wake up so you can plan your day and if you need to shovel the driveway before going to work.  I find it easier to get the weather from my iOS device than it is to use my laptop or turn on the Weather Channel.
    Calclator.  2+2 = 4, but there are times you do need to get something right, and calculators are useful. They have all kinds available, including hexidecimal calculators for programmers.
    RSS newsfeed reader (I follow about 20+ feeds, including these discussions groups via RSS feeds).
    Travel services.  Most airports have WiFi, and you can get updated travel info for your flights via some speciallized travel apps.
    If you are into tracking your car mileage, gas usage, maintenance costs, etc..., there are apps for that.
    While you can watch video on your iOS device (downloaded movies, YouTube), you can also stream movies from services such as Netflix.  This can be useful when traveling, or if you are stuck in bed with a cold, or if you have lost control of the "Remote" and do not want to watch "Dancing with the Stars"
    TV related, there are apps that will give you the TV schedule for your area, so you can browse the shows on this evening.
    List.  You can keep lists, including grocery shopping lists, items to pack for a trip lists, things to do for that bathroom remodel, things you need to get before school starts, Christmas lists, etc....  NOTE:  Ideas for Christmas/Birthday/Anniversary gifts may come anytime during the year, but if you do not write them down, you may be scratching your head when the event arrives.  Putting them in a list can help you later on.
    You can get a Level app.  You may laugh, but I have actually used my iOS device to check if something was level.  It was there, and a carpenters level was not.  Not perfect, but it did what I needed at the time.
    Finding a good resturante (Yelp, Urbanspoon, etc...).  The iOS device can be very helpful in finding a good nearby place to eat when away from home, or even discovering a new play where you live to get out of that eat at the same place rut.
    That is some of the things I use my iOS device for.

  • Can we use where clause in Update on Merge statement?

    Hi All,
    I tried to execute the following Merge Query:
    When this query is executed without ‘Where clause’ in Update statement its working fine. When executed with ‘Where clause’ it throwing the following error:
    ORA-00905: missing keyword.
    Following is the sample query which I tried to execute:
    MERGE INTO TABLE_NAME
    USING (SELECT COLUMN FORM TABLES)
    ON (CONDITION)
    WHEN MATCHED THEN
    UPDATE SET
         COLUMN UPATES
    WHERE CONDITION -- Can we use where clause here?
    WHEN NOT MATCHED THEN
    INSERT
    INSERT VALUES;
    Can some one help on this?
    Thanks in advance.
    Darius

    Yes:
    SQL> drop table emp1;
    Table dropped.
    SQL> create table emp1 as select * from emp where deptno = 30;
    Table created.
    SQL> update emp1 set sal = sal*2;
    6 rows updated.
    SQL> commit;
    Commit complete.
    SQL> select ename,sal from emp1;
    ENAME             SAL
    ALLEN            3200
    WARD             2500
    MARTIN           2500
    BLAKE            5700
    TURNER           3000
    JAMES            1900
    6 rows selected.
    SQL> MERGE INTO emp1
      2  USING(select * from emp) emp
      3  ON (emp1.empno = emp.empno)
      4  WHEN MATCHED THEN
      5  UPDATE SET sal = emp.sal WHERE ename = 'TURNER'
      6  WHEN NOT MATCHED THEN
      7  INSERT(ename,sal) VALUES(emp.ename,emp.sal);
    9 rows merged.
    SQL> select ename,sal from emp1;
    ENAME             SAL
    ALLEN            3200
    WARD             2500
    MARTIN           2500
    BLAKE            5700
    TURNER 1500
    JAMES            1900
    SMITH             800
    JONES            2975
    CLARK            2450
    SCOTT            3000
    KING             5000
    ENAME             SAL
    ADAMS            1100
    FORD             3000
    MILLER           1300
    14 rows selected.
    SQL> SY.

  • How do you use Default Resource Access Information?

    I have some 10g Forms & Reports that I want to use with SSO and they will all be connecting to the database with the same connection info. I know how to configure a Default Resource Access Information, but how do you use this with Forms & Reports?

    Douglas,
    the default Resource Access Infomation should be the connection information right? This is used in conjunction with SSO. You need to configure your F&R applications to delegate authentication to SSO by placing ssoMode=true in the config section of formsweb.cfg.
    The Forms Servlet will connect to OID retrieve the Resource Access Information (descriptor) for a given user and automatically log them into the application.
    Users will need a global identity in OID and SSO must be enabled to use resource access info with F&R
    regards,
    tt

Maybe you are looking for