Can I put confitions in a query?!?

Hi there,
Can anybody tell me if there could have something like a conditional query?
Ok here is the deal.. I have couple of tables where i have the relations between objects, subobjects and sub-subobjects and the status of the sub-subobjects.
One object can have many subobjects with many sub-subobjects with different status
object
- subobject1
-sub-subobject1
-sub-subobject1
I m trying to build a tree which shows img for the status of the subobjects and sub-subobjects.
The idea is if any of the sub-subobject is "URGENT" the status for the Subobject to this subsubobject to be "URGENT" too.
How can I make my tree query work like this?
Any help will be highly appreciated!
Thanks in advance

SQL*Plus: Release 10.2.0.1.0 - Production on Wed Apr 25 16:17:01 2007
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
macmilp@xe > with t as (
  2    select 0 id, null parent, 'UK' node, null status from dual
  3    union
  4    select 1, 0, 'Scotland', null from dual
  5    union
  6    select 2, 0, 'Wales', null from dual
  7    union
  8    select 3, 1, 'Fife', 2 from dual
  9    union
10    select 3, 1, 'Aberdeen', 2 from dual
11    union
12    select 4, 1, 'Edinburgh', 1 from dual
13    union
14    select 5, 2, 'Dyfed', 3 from dual)
15  select  lpad(' ', 3 * (level - 1)) || t1.node as node,
16          (select  min(t2.status)
17           from    t t2
18           connect by prior t2.id = t2.parent
19           start   with t2.id = t1.id) as status
20  from    t t1
21  connect by prior t1.id = t1.parent
22  start   with t1.parent is null;
NODE               STATUS
UK                      1
   Scotland             1
      Aberdeen          2
      Fife              2
      Edinburgh         1
   Wales                3
      Dyfed             3
7 rows selected.Where the urgency of the status is indicated numerically, lowest = most urgent. You can use DECODE or CASE to translate character status codes into numbers and to translate numeric status codes into corresponding img filenames.

Similar Messages

  • Can I put formula in a query

    I created an infoset (SQ02) and a query (SQ01).  I want to have a new column that computes for the difference of the forecasted sales and actual sales.  Can I do that in a query?

    Hello John,
    I'm sure it can be done. But you have to take the help of an Abaper to acheive that.
    Go to Transaction code - SQ02 (Change mode of the query you have created). Then click on the <b>Extras Tab</b> and use the <b>Code Tab</b> to write the formula you require.
    <b>REWARD POINTS IF HELPFUL</b>
    Regards
    Sai

  • Can we show comments in adhoc query?

    Hello All,
           Can we put comments in Adhoc query?
           I have a comment icon in infotype 9903.
           I need to fetch that particular comments and show in a query output. It is not a field.
           Can we do this? If yes, then please let me know how?
    Cheers,
    Darshna.

    I did it sometime back. A bit complicated process.
    Create an infoobject, manually enter the values "keyfig1" and "keyfig2".
    Include this infoobject in the filters and restrict it using a "ready for input" variable.
    Now create two formula variables.
    Write a customer exit such that when you select "keyfig1", first formula variable's value should be set to 1 and other one's to 0.
    Then in the query create two calculated key figures, multiply both with the formula variable. Also supress column (all active value == 0).
    Then it will show the key figure which you have selected.
    Pravender

  • Can I put a SQL query into a bind variable and then use it to output report

    Hi,
    Can I put a SQL query into a bind variable and then use it to output report?
    I want to create a report and an item "text area" (say P1_TEXT) which can let user to input a SQL query(they are all technical users and knows SQL very well). Then, I use a bind variable (that text area) to store the SQL statement. Then, I add a submit button and I want to use the following to output the report:
    select * from (:P1_TEXT);
    Do you think it is possible to do that? Any known limitations for APEX in this area?
    Thanks a lot,
    Angela

    You can, but make sure it's what you really want to do. Make sure you are VERY familiar with SQL Injection. Most people who know what it is, go out of their way to prevent SQL Injection. You're going out of your way to allow it.
    You can try using &P1_TEXT. instead of bind variable syntax. Bind variables are one of the best ways to prevent SQL Injection, which is why it's not working for you.
    Once again, I strongly urge you to consider the implications of your app, but this suggestion should get it working.
    Tyler

  • Can we put Join Query with Expdp in Query Parameter

    Dear All
    Can we put join condition like
    A.roll_no=B.roll_no
    in query clause of EXPDP utility of Oracle 10g.
    My parameter file is
    INCLUDE=TABLE:"IN ('A','B')"
    QUERY ="where roll_no between 1 and 100 "
    then it works and export the data. But I want Above condition.
    But when I specify it gives ORA-39001 error.
    If possible, How and Can you specify example.
    Regards
    Nikhil

    Hello,
    Please check if OSS note 858458 is applicable in your case.
    Regards,
    Praveen

  • I can not put the data of a field(LONG RAW) consulted into a item of a data block

    I want to query a field that is LONG RAW(it's a image) and put the data into a item of a data block (in Forms Builder), when i write ":BLOCK.FOTO:=vfoto" i recieve this errors: "bad bind variable ....". How can i put the data of field of my DB and put the data in a item of a data block(in Forms Builder)?.
    I can store a image in a table of my DB, but i want to query a image stored in my DB and put it into anothers table, all this on FORMS BUILDER.

    You have to base the image item on a base table and use EXECUTE_QUERY on that block. You can't do a direct select in PL/SQL into the item

  • Need to raise a restriction that user can not put multiple PO references in PO Number field in Sales Order.

    Hi,
    reference to subject we need a restriction that user can not put different PO reference within an Order. One Sale Order should have one PO reference at Header and Line's of the sales order. Currently what is our issue that all the sales order are created by Quotes from quoting module. Whatever the line items come from quotes into sales order having no PO Number reference with them but when user completing the sales order user puts the PO reference at Sales Order Header which can not be linked or passed on those line items who captured from quotation. Due to this PO reference value difference between Lines and Header system generates multiple AR invoices based on unique PO Number references within an order.
    we need single PO reference per sales order. How can we restrict this if line level PO number reference is different from Header PO number reference that user can not proceed further?
    Regards
    Kaleem A. Bhatti

    Dear Zakir,
    Thanks a lot for your favorable response. The query is solved now by defaulting rules.
    Regards
    Kaleem A. Bhatti

  • Can we put INDEXES on Views if not Is there any way to make it Index bas

    Hi
    I am running a query in which there are several views involved in the join condition Can we put INDEXES on Views in ORACLE 9i if not Is there any way to make it Index based views beacuse the result that i am getting is very slow and is eating like 10gb of the temp tablespace.
    Thanks

    No, you cannot put indexes on a view. Think about what a view is, a stored sql statement. Oracle has no way of knowing what rows are in a view until it actually runs the view. So, even if you could, Oracle would need to run the view to get the rows, build the index, then run your query a second time using the index. Seems counter productive to me. A view can use indexes on the underlying tables if appropriate.
    Generally speaking, I would say that a query that makes use of multiple views is probably really inefficient. Often, you are only looking for one or two columns from a view which may require joining several tables whose columns are of no use in the main query. I would start by re-writing the query using the base tables, and only using those tables that are actually required to answer the question.
    TTFN
    John

  • BI Auth - user still can search & execute for not authorized query

    Hello All,
    need your help here.
    For BI security,
    I've configured menu role (for example ZBEX_FIN) in order for the end users to see only specific queries/workbook inside the menu folder that assigned to him/her.
    And I've made a function role for end user, copy from the template S_RS_RREPU with the modification:
    1. I delete 0BI_ALL
    2. add S_USER_AGR and put my menu role above (ZBEX_FIN) for field ACT_GROUP
    3. add S_RS_FOLD to disable the infoarea button in BEx.
    currently the user can see and execute report assigned in the role menu folder, this is correct.
    But the problem is there's a find button in the BEx, when the user try to search other query (non authorized query,the one that supposed he can't see), he still can display the query, then can execute the query. This is not acceptable.
    Anyone can suggest whether I can disable the find button in the BEx
    or any other restriction in the role that I missed, so the user can only execute and display the query/workbook under the role menu only.
    Thanks in advance.

    So it means that we need to do it twice restrictring the query in the role menu and then inside the S_RS_COMP ?
    so later when the user wants to add more queries in his role, we need to add those in the role menu as well inside the S_RS_COMP. is this correct ?
    When you add queries/workbook to role menu, you are not restricting the access. Its just that user menu would list those queries/workbooks. Users can search for other queries and workbook and run them with proper authorizations in S_RS_COMP. You may consider maintaining query naming convention with wild cards for example YRZ* etc to give access to all queries/workbooks starting with YRZ. This would save your effort to update role too freqeuntly.
    And if I have a workbook, how I put it inside the S_RS_COMP ? because the component of S_RS_COMP is query only.
    S_RS_COMP can restrict queries as well as workbooks with field RSZCOMPTP= REP

  • Can anyone do more simplify this query

    Following are ddl of two tables
    1.CREATE TABLE EMPL (
         SNO NUMBER,
         ENAME VARCHAR2(25),
         JOB VARCHAR2(25),
    PRIMARY KEY (SNO)
    2.CREATE TABLE EMPL_DET (
         SNO NUMBER,
         SAL VARCHAR2(25)
    Following are DMLs of tables
    INSERT INTO EMPL(SNO, ENAME, JOB) VALUES (1, 'SMITH', 'CLERK');
    INSERT INTO EMPL(SNO, ENAME, JOB) VALUES (2, 'SMITH', 'MANAGER');
    INSERT INTO EMPL(SNO, ENAME, JOB) VALUES (3, 'TOM', 'CLK');
    INSERT INTO EMPL_DET(SNO, SAL) VALUES (1, '1000');
    INSERT INTO EMPL_DET(SNO, SAL) VALUES (2, '10000');
    INSERT INTO EMPL_DET(SNO, SAL) VALUES (3, '900');
    I want to calculate TotalSAL(column:empl_det.SAL) of each employee(empl.ename) with job-description(empl.job).
    Means i want following rows in output
    1.(JOB,TotalSAL,ENAME)-->(CLERK,11000,SMITH)
    2.(JOB,TotalSAL,ENAME)-->(MANAGER,11000,SMITH)
    3.(JOB,TotalSAL,ENAME)-->(CLK,900,TOM)
    I tried to write down for single ename
    select JOB,x.sal,ename from empl,
    select sum(sal) sal from empl_det where sno in
    (select sno from empl where ename ='SMITH')
    )x
    where ename ='SMITH'
    order by ename
    for each ename i have to fire this query. How can i pass ename list(SMITH,TOM) to this query?
    Or can anyone do more simplify this query?

    Hi,
    When you put some code please enclose it between two lines starting with {noformat}{noformat}
    i.e.:
    {noformat}{noformat}
    SELECT ...
    {noformat}{noformat}
    Please read <a href="https://forums.oracle.com/forums/thread.jspa?threadID=2174552#9360002">How do I ask a question on the forums?</a>
    In order to do this you can use a IN.
    i.e.ename IN ('SMITH', 'TOM') etc.
    However your code can be simplified as it seems redundant to me.
    Please double check it and try to understand what you can improve.
    Just a hint: use join and group by without subquery.
    Regards.
    Al
    Edited by: Alberto Faenza on Nov 27, 2012 2:51 PM
    Added a hint                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Can I put more than one user under one Apple ID account. I want to let other family members use imessage on their own Apple device. Or is there another way to get this end result?

    Can I put more than one user under one Apple ID account. I want to let other family members use imessage on their own Apple device. Or is there another way to get this end result?

    You can seach the net for solutions like this one http://appletvvpn.com/how-to-connect-apple-tv-2-to-vpn/ another idea is to use a PC as the control and fit that with a wireless card and set up a ad hoc wireless network that the Apple TV uses. 

  • How can i put apps from one ipod to a new ipod?

    how can i put apps from one ipod to a new ipod?

    iOS: Transferring information from your current iPhone, iPad, or iPod touch to a new device

  • Can I put a amd 64 X2 3800+ on a motherboard msi K8N neo2 platinium ?

    hello
    I'm sorry for my bad english but I'm french ....
    can I put a amd 64 X2 (dual core) 3800+ on a motherboard msi K8N neo2 platinium ?
    Which is the highest processor which I can put on this mothercard ?
    thanks well for your help
    @+

    I'm sorry but I dont find the info on the msi website. I listened it ! but I don't know the adress that you give me.
    thanks well for the adress : 
    but I don't know if it's e4 or e6 or manchester .... if you help me for that proc :
    http://cgi.ebay.fr/processeur-AMD-Athlon-64-X2-dual-core-3800-socket-939_W0QQitemZ290129683087QQihZ019QQcategoryZ80141QQssPageNameZWDVWQQrdZ1QQcmdZViewItem
    and that : http://cgi.ebay.fr/AMD-Athlon-64-X2-4800-socket-939_W0QQitemZ190124445607QQihZ009QQcategoryZ80141QQssPageNameZWDVWQQrdZ1QQcmdZViewItem
    and that :
    http://cgi.ebay.fr/AMD-ATHLON-64-X2-4200-4-4-GHZ-1MB-CACHE-939-DUAL-CORE_W0QQitemZ270133637708QQihZ017QQcategoryZ80141QQssPageNameZWDVWQQrdZ1QQcmdZViewItem
    I don't want to make a error ....
    thanks very well for your help
    @+

  • How can I put my icloud photos to camera roll or photo stream?

    I got a nee iphone, i backed up everything and restored it into mu new iphone, but the pictures didn't restore so i did it manually but now on my phone i got different albums icloud photo stream and camera roll. How can i put the icloud picture into camera roll or photo stream. Any ideas?? On my old iphone ive deleted everything.

    Hello Ozzie94,
    Thanks for the additional information. The camera roll is designed for photos taken on your device, or saved images from Mail and other applications. Photos synced from a computer are organized into their own album(s):
    View photos and videos - iPhone
    http://help.apple.com/iphone/7/#/iph3d267610
    - Camera Roll—photos and videos you took on iPhone, or saved from an email, text message, webpage, or screenshot
    - Shared photos and videos—Photos and videos that you’ve shared with iCloud Photo Sharing or that others have shared with you (see iCloud Photo Sharing)
    - Photos and videos synced from your computer (see Sync with iTunes)
    Additionally, you may find more information by using another one of Apple's support resources - https://getsupport.apple.com
    Thanks,
    Matt M.

  • I downloaded a movie to the wrong library by accident. now i can't put the movie on my husband's ipod because it says it can only sync to one library at a time. how do i fix this? i don't want to get rid of the old videos, i just want to add new ones

    i really don't know what i did wrong. i logged into itunes using my husband's id, then bought some movies. but for some reason, it downloaded them to my library, not his. now i can't put them on the ipod. is there any way to get them out of my library and into his library? i tried home sharing, but it still won't let me sync them to the ipod

    Copy the movie from the current library to the correct library.
    iDevices can only sync to one library at a time.

Maybe you are looking for