How to add a dynamic condition to query *.

Hi all

Could you please help me logic

I need only query

There are tables emp, dept

SELECT E.ENAME, D.DNAME
FROM EMP E, DEPT. D
WHERE d.DEPTNO = e.DEPTNO (+)
AND (DYNAMIC CONDITION)

LOGIC OF THE DYNAMIC CONDITION IS

IF D.DEPTNO IS E.DEPTNO THEN [E.JOB "PASSWORD"] - SEATS SHOULD BE ADDED TO THE PLACE (DYNAMIC CONDITION)
IF D.DEPTNO IS NOT THERE IN E.DEPTNO THEN [D.LOC = "LONDON"] - SEATS SHOULD BE ADDED TO THE PLACE (DYNAMIC CONDITION)

-----------------------------------

I tried below


Select e emp, dept e.ENAME, e.SAL, d.dname d
CASES where WHEN e.deptno = d.deptno then e.job = "MANAGER".
else D.loc = "LONDON".
END

But its giving error...

Please give a solution

Thanks in advance
KC
SELECT E.ENAME,D.DNAME, d.loc, e.job, e.deptno
FROM EMP E, DEPT D
WHERE d.DEPTNO = e.DEPTNO(+)
and (
       (e.deptno is null and d.loc='LONDON')
         or
       (e.deptno is not null and e.job='MANAGER')
     );  

(But it's not dynamic sql!)

Tags: Database

Similar Questions

  • How to add the field or a query to THE field of the process send e-mail Page

    Hello world

    Can you help me please?

    How can I add a field or a query in "to THE" field of the process to send a Page in e-mail?

    I use the 4.1.0.00.32 and oracle 10g Express Application.

    Hi User11131067, please update your grip via profile to something more personal.

    Here's how I did it:

    DECLARE

    l_body CLOB.

    l_to VARCHAR2 (255);

    BEGIN

    l_body: =.

    "Thank you for your interest in the APEX_MAIL package."

    || UTL_TCP. CRLF

    || UTL_TCP. CRLF;

    l_body: = l_body | "Sincerely,". UTL_TCP. CRLF;

    l_body: = l_body | "Dev APEX team | UTL_TCP. CRLF;

    -Get the email addresses of administrators from point of harvest

    WITH the admins

    AS (SELECT person_tbl.email_address_txt,

    ROW_NUMBER () OVER (ORDER BY email_address_txt) rn,

    COUNT (*) NTC)

    OF harvest_admin_tbl, person_tbl

    WHERE harvest_admin_tbl.active_ind = 'Y' - use active Admins only

    -Eliminate Admin Act

    AND harvest_admin_tbl.internal_employee_id <> v_payroll_id

    AND harvest_admin_tbl.internal_employee_id =

    person_tbl.employee_ghrs_id)

    -Concatenate addresses into a single string

    SELECT LTRIM (SYS_CONNECT_BY_PATH (email_address_txt, ",") ",") catvalues

    IN l_to

    Admins

    WHERE rn = NTC

    START WITH rn = 1

    CONNECT BY PRIOR rn = rn - 1;

    apex_mail. Send (p_to => ' [email protected]', - change to your email address)

    P_FROM-online l_to

    p_body-online l_body,

    p_subj => 'APEX_MAIL Package - message in plain text');

    END;

    /

  • How to add a 'hint' in my query to resolve the error "hash aggregation can be done."

    I have a query Oracle 10 SQL that works very well in the environment of train, but fails live (presumably because of the volume). I get the error. "ORA-00600: internal error code, arguments: [32695] [hash aggregation cannot be done.  Google suggests that I can use a trick to fix this if I'm luckey (i.e. "NO_USE_HASH_AGGREGATION"). How to incorperate a 'hint' in my query?  (where in my query I would put the suspicion and what kind of syntax)?  Thank you!!!

    Optimizer tips shouln can't be used to try to solve the problems, they should be used to analyze issues.

    Before attempting to apply patches of poor to an unknown cause, you'd be btter to identify what is the real problem.

    ORA-00600 errors indicate an internal error and should be reported to Oracle via My Oracle Support (it is also a search tool of ORA-00600 on My Oracle Support, which can help to tell you if it is a known problem that is fixed by a solution of workaround or bug fix/patch etc..)

    Do not use the tips where they should not be used.  Correct the cause of the problem, not the symptom.

  • How to add a where condition to seeds VO

    Hi I have a VO PoRequisitionLinesVO.Now knowledge I want to add the SQL where condition...

    How can I do this...? There is no addition of all fields... only adding a where condition clause?

    Will I need to extend that VO? If yes then how should I do this?

    Thank you...

    Yes, you must extend the VO.

    To get the procedure you can search the Internet, there is a great article (that I mentioned below):

    https://blogs.Oracle.com/prajkumar/entry/eo_based_vo_extension_in

    Kind regards

    Sandeep M.

  • How to add a prefix to SQL query tool part

    When executing the installation of the tool component under Middleware11g/user_projects/domains/ucm_domain/ucm/cs/bin using the following command:

    . / ComponentTool - install /scratch/u01/app/stage/VueLink/VL_For_UCM_201/VLForUCM/dms_customization/AutoVue.zip

    I have the following error:

    Failed to create the result set of query 'SELECT value FROM Config WHERE dSection = "DevUpdate" AND dName =' DatabaseUpgrade ". ORA-00942: table or view does not exist

    The table of that configuration does not exist in my database. The table is named 'WCC_OCS. Config'.» Is it possible to customize this SQL statement to adapt to my database Setup?

    I was able to connect as WCC_OCS on the database in SystemProperties tab after I have sysdba privileges account but I still get this error:

    Failed to create the result set of query 'SELECT value FROM Config WHERE dSection = "DevUpdate" AND dName =' DatabaseUpgrade ". ORA-00942: table or view does not exist

    The query needs to read WCC_OCS. Config. Even when I connect to SQLDeveloper as WCC_OCS I need to make this distinction pattern in my query either it attempts to return table sys.

    If I run this statement to add a synonym to the DB for this table, I no longer receive the DB schema prefix error. :

    CREATE A CONFIG FOR WCC_OCS SYNONYM. CONFIG;

    However, after having solved the problem of schema, you receive an error when executing the installation:

    There is no such thing as a 'user' workspace.

    Because of a WCC bug must be updated to 12.2.1.0.0

  • How to add by dynamically/programming of the parameters to a taskflow of entry?

    I have like that - usecase
    I have a created taskflow. But I don't know how many input parameters that I need to define on this taskflow.
    Is it possible, by which I can add parameters of entry to a taskflow programmatically? with an MBean or any APIs are available that will allow to make?

    You can specify a map (HashMap) as only input parameter and put all the other parameters in the plan. The card can contain any number of key / value, but the workflow enough to know (the plan).

    Timo

  • How to add a dynamic additional value in LOV

    Hello

    I have a dynamic LOV and I want to add one more in there other than like NULL value 'other '.

    Select ENAME, EMPNO from EMP Ruy

    Now, I want that 'other' extra value in this dynamic LOV

    Thnx
    -Smith

    Hello

    You can add as many other values that you need by doing a join UNION ALL:

    SELECT 'Other' d, 0 r FROM DUAL
    UNION ALL
    SELECT ENAME d, EMPNO r FROM EMP
    

    Andy

  • How to add a dynamic table in DW CC?

    I'm relatively new to DW.  I am trying to set up a database where I can enter an area code and returns an array with the associated data (diseases in this area, for example).  I need a dynamic table for this, but DW CC does not have an object dynamic link in the "Insert" menu  Any help?  I am running on a Mac

    1. Click on the button "+" on the databases tab and create a database connection
    2. Under the links tab, create a recordset object
    3. In Design view, create a table
    4. Drag the names of the fields in the Bindings tab in a table cell

    1. At the bottom of the view Design make sure that 'table' is highlighted
    2. In the server behaviors tab, click the plus sign and the repeating region
    3. Click OK, save your work, and you have finished creating your first dynamic table.

  • How to add a link to the html area to launch a dynamic action?

    Hey, guys:

    I need to add a link to a region of html hyper (I wish it could be a button :(), the value of the items in this region is loaded by a process of pl/sql before loading the header. And this link must trigger a dynamic action to update the database. I know how to add a link Super in this region, but how to define this link if I can launch a dynamic action by clicking on this link, could someone give me a hint?

    Thank you very much in advance.

    Sam

    Published by: lxiscas on April 11, 2013 17:04

    When I said updateRec I was just a name. Using the class alias_ncic will produce exactly the same result.
    Learn more about what you're trying to do, I wouldn't do that with DA at all. I would probably do the link send page and launch a process that call your PL/SQL. But if you must do a DA I'll try to explain a technique below.

    When you say

    Then, I pass two values of two hidden variables:

    P216_H_NCIC_APPROVE_TABLE_NAME---> "SOR_ALIAS".
    P216_H_NCIC_APPROVE_KEY_VALUE---> #ALIAS_ID #.

    Your link not pass anything because you never actually call the link, you have a DA of the substitution of the link action.

    So... try something like that. Use it for your link attributes:

    onclick="return false;" class="alias_ncic" title="NCIC Approve" id="#ALIAS_ID#" rel="SOR_ALIAS"
    

    This defines two attributes more to enter the values you need to.

    In yourself DA action on a.alias_ncic add two actions to "set the value.
    1.
    Action: Set
    Set Type: Javascript
    JavaScript expression: this.triggeringElement.getAttribute ("id")
    Assigned items: P216_H_NCIC_APPROVE_KEY_VALUE

    2.
    Action: Set
    Set Type: Javascript
    JavaScript expression: this.triggeringElement.getAttribute ("rel")
    Assigned items: P216_H_NCIC_APPROVE_TABLE_NAME

    Now you have your values defined.
    Make sure that in your PL/SQL Execute Code action you both of these elements in the field "Page to go" so that they values are actually passed.

    That should do it.
    Thank you
    -Jorge

    Published by: jrimblas on April 29, 2013 16:49

  • How to add additional buttons, the fields in the query Panel

    I have a layout where I need to search for employees working under a Manager

    I have a search criteria where I can choose coach in a menu drop-down so that the data of employees under him appears


    Now I need to add a field more in search as assign to the manager who is a drop down

    And I need add two buttons Reassign, Deassign the search criteria


    So that when I select my manager current employees under him if poster and when I select the value of the entitlement and Manager dropdown in search criteria and click on the button to re-allocate employees are they assigned to this new manager... If I click on delete the key assignment those employees will get current Manager deassigned

    And also once the results displayed in table I have to have a checkbox for each record where I can select the checkbox and reassign or deassing only employees


    How to add additional buttons, fields for the Commission to request... I slipped and dropped my display criteria in the query with table Panel

    Hello

    a query Panel is for query and do not update documents. You can add buttons to the toolbar facet

    See: http://download.oracle.com/docs/cd/E21764_01/apirefs.1111/e12419/tagdoc/af_query.html

    but not the query itself on the ground

    Frank

  • How to add dynamic content to a .php model Dreamweaver

    OS: Windows 7

    DW Version: CS5

    PHP: XAMP Local Server

    I hope someone can help.  I created a Dreamweaver template for .php and created 5 pages of child of this model.  Everything is in working order as that is concerned.  Here's my problem:

    I want to add some dynamic data (categories) of a MySQL database to a non editable master section so that it flows to the pages of 5 children.  I can create a connection to the database without problem, but when I go to insert a recordset object in the model, it asks me to put in place the "site", the "document type" and the "test server" what I have done.  I'm sure it's because it's in watching the .dwt file type and saying that she should be a dynamic document such as .php.  I tried to go through these steps, but then it ends just rename my .php .dwt file and then it is no longer a model. I don't know why I can't add dynamic data to a dreamweaver template.  It seems that it should be a no-brainer, but it just isn't working for me.  In my research, I find the following

    http://help.Adobe.com/en_US/Dreamweaver/10.0_Extending/WS5b3ccc516d4fbf351e63e3d117f53d610 8 - 7fdb.html

    but wasn't completely sure how to apply it or if it involved only CS4 since I'm using CS5.  To be honest, it confused me more that it has helped.

    I really hope that there is a simple and logical solution to this issue because I have spent a lot of time to search for/test this.

    Any help/direction is greatly appreciated.  I don't want someone to just solve my problem and I'm willing to dig deep to learn, I just don't know where to go from here.

    Thanks again in advance for your help.

    Rename your yourtemplate.dwt.php model file.

    In other words, simply add .php at the end of your template file leaving the .dwt there.

    Brad Lawryk

    Adobe Professional Community: Dreamweaver

    The Northern British Columbia Adobe user group: Manager

    Thompson Rivers University: Dreamweaver instructor

    My Blog from Adobe: http://blog.lawryk.com

  • How to add a xmlelements not nested in a nested query xmlelement

    I have the following query prints in a file xml very well:

    Select xmlroot)
    XmlElement
    (
    EMSData,
    XMLAGG
    (

    XMLELEMENT
    (
    year,
    XmlAttributes (calyear),
    XMLAGG
    (
    XmlElement
    (
    meantime,
    XmlAttributes (intervalType as 'Type', 'Value' ValeurIntervalle),
    XmlElement
    (
    data,
    XmlAttributes (selectType as "Select", supplier, mission, instrument),
    XMLFOREST
    (
    bytes,
    files
    )
    )
    )
    ValeurIntervalle desc order, supplier, mission, orderBy, instrument
    )
    )
    calyear desc order
    )
    (), version '1.0') .getClobVal () in l_xml
    FROM MyTable
    Calyear group;

    The output is:
    <? XML version = "1.0"? >
    < EMSDATA >
    < CALYEAR YEAR = "2011" >
    < Type INTERVAL = 'DAY' Value = "320" >
    < Select DATA = 'SYSTEM' >
    < BYTES > 2750877820501 < / BYTES >
    <>273997 FILES < / FILES >
    < / DATA >
    < / INTERVAL >
    < Type INTERVAL = 'DAY' Value = '319' >
    < Select DATA = 'SYSTEM' >
    < BYTES > 5155961487454 < / BYTES >
    <>378457 FILES < / FILES >
    < / DATA >
    < / INTERVAL >
    < Type INTERVAL = 'DAY' Value = "318" >
    < Select DATA = 'SYSTEM' >
    < BYTES > 4606818769422 < / BYTES >
    <>420231 FILES < / FILES >
    < / DATA >
    < / INTERVAL >
    < Type INTERVAL = 'DAY' Value = "317" >
    < Select DATA = 'SYSTEM' >
    < BYTES > 3686199358862 < / BYTES >
    <>399271 FILES < / FILES >
    < / DATA >
    < / INTERVAL >
    < Type INTERVAL = 'DAY' Value = '316' >
    < Select DATA = 'SYSTEM' >
    < BYTES > 4989867970498 < / BYTES >
    <>406249 FILES < / FILES >
    < / DATA >
    < / INTERVAL >
    < Type INTERVAL = 'DAY' Value = "315" >
    < Select DATA = 'SYSTEM' >
    < BYTES > 4027315556027 < / BYTES >
    <>463319 FILES < / FILES >
    < / DATA >
    < / INTERVAL >
    < Type INTERVAL = 'DAY' Value = "314" >
    < Select DATA = 'SYSTEM' >
    < BYTES > 4893244762669 < / BYTES >
    <>600252 FILES < / FILES >
    < / DATA >
    < / INTERVAL >
    < / YEAR >
    < / EMSDATA >

    What I have to do is to add a few items just above the nested element under < YEAR >, i.e.:

    <? XML version = "1.0"? >
    < EMSDATA >
    < DailyStartDate > 28 November 11 < / DailyStartDate >
    < WeeklyStartDate > 29 - SEP - 11 < / WeeklyStartDate >
    < MonthlyStartDate > 1 October 01 < / MonthlyStartDate >
    < CALYEAR YEAR = "2011" >
    < Type INTERVAL = 'DAY' Value = "320" >
    < Select DATA = 'SYSTEM' >
    < BYTES > 2750877820501 < / BYTES >
    <>273997 FILES < / FILES >
    < / DATA >
    < / INTERVAL >
    < Type INTERVAL = 'DAY' Value = '319' >
    < Select DATA = 'SYSTEM' >
    < BYTES > 5155961487454 < / BYTES >
    <>378457 FILES < / FILES >
    < / DATA >
    < / INTERVAL >
    < Type INTERVAL = 'DAY' Value = "318" >
    < Select DATA = 'SYSTEM' >
    < BYTES > 4606818769422 < / BYTES >
    <>420231 FILES < / FILES >
    < / DATA >
    < / INTERVAL >
    < Type INTERVAL = 'DAY' Value = "317" >
    < Select DATA = 'SYSTEM' >
    < BYTES > 3686199358862 < / BYTES >
    <>399271 FILES < / FILES >
    < / DATA >
    < / INTERVAL >
    < Type INTERVAL = 'DAY' Value = '316' >
    < Select DATA = 'SYSTEM' >
    < BYTES > 4989867970498 < / BYTES >
    <>406249 FILES < / FILES >
    < / DATA >
    < / INTERVAL >
    < Type INTERVAL = 'DAY' Value = "315" >
    < Select DATA = 'SYSTEM' >
    < BYTES > 4027315556027 < / BYTES >
    <>463319 FILES < / FILES >
    < / DATA >
    < / INTERVAL >
    < Type INTERVAL = 'DAY' Value = "314" >
    < Select DATA = 'SYSTEM' >
    < BYTES > 4893244762669 < / BYTES >
    <>600252 FILES < / FILES >
    < / DATA >
    < / INTERVAL >
    < / YEAR >
    < / EMSDATA >

    I can select these separate items of data in the table or I can add them to the XML through a local variable. I tried several ways to add this to my above query but am stuck. If I bring to the table, the field names are dailyStartDate, weeklyStartDate and monthlyStartDate. Again, I only want the distinct values and therefore something for everyone in this XML file rather than enumerate over and over again in the XML.

    Please notify.

    Best,
    NAT

    If you already have the values in variables, why not just do that?

    select xmlroot(
     xmlelement
     (
      EMSData,
      XMLForest(
       v_DailyStartDate as "DailyStartDate",
       v_WeeklyStartDate as "WeeklyStartDate",
       v_MonthlyStartDate as "MonthlyStartDate"
      ),
      XMLAGG
      (
       XMLELEMENT
       (
        year,
    
  • How to build a dynamic array index in the attribute 'to' house arrest

    Hi all

    I need to generate xml output with the appearance of multiples of the same complex element. The number of items is calculated dynamically. I use bpelx: append to add items, but I'm crashes when I try to assign values to elements using a variable to index items.

    How can you dynamically assign an array index variable in the attribute 'to' a copy instruction? I was able to do in the attribute 'from' the copy statement, following the examples indicated in the documentation for the xpath function. But when I use the concept of intermediate variable, I get a compiler error stating that the query attribute must start with ' / '.
    It works fine when I hard code the index in the attribute of "query" in the statement "copy to".

    I use 10.3.3 version JDev and 10.3.3.0 PM BPEL version.

    Here are the two methods I've tried:
    ----------------------
    < copy >
    < expression = "concat ('/ client: assTestProcessResponse / client: ScreeningComments / client: CommentItem [', bpws:getVariableData('notesCount'),'] / client: CommentText')" / >
    < variable = "queryText" / >
    < / copy >
    < copy >
    < expression = "bpws:getVariableData('noteText')" / >
    < variable = part of the 'outputVariable"="payload ".
    Query = "bpws:getVariableData('queryText')" / >
    < / copy >
    ----------------------
    < copy >
    < expression = "bpws:getVariableData('noteText')" / >
    < variable = part of the 'outputVariable"="payload ".
    Query = "/ client: assTestProcessResponse / client: ScreeningComments / client: CommentItem ["bpws:getVariableData(&quot;notesCount&quot;) " ""] / client: CommentText "/ >
    < / copy >

    ----------------------

    Has anyone had a similar problem? Please let me know this is doable and how.

    Thank you
    A.T.

    Hello

    I don't know if the following solution is what you want, but I'll try to explain how this would work; (o)

    I understand your question, you have a following like the watch of simple structure xml schema:

    
      
        
           
        
        
           
        
    
    

    The element is a complex type that has as a child element.
    The element can have 1.. * items

    As you explained that you know how to add loose, common is to use an XML Fragment example

    
      
        
          
            
          
        
        
      
    
    

    As you can see now there are two elements with the child element

    After the task to assign the variable content looks like:

    
      
        
          
            
              
            
            
              
            
          
        
      
    
    

    After adding the fragment, you can set the value for the for the first content element in the following way:

    
      
        
        
      
    
    

    The important thing is to know how to point to the correct position within the payload. It works with that part of the query statement

    [position()=1]
    

    or you can of course use the short version

    [1]
    

    The next task is to dynamically create the reference to the position. Therefore, you can for example use a variable. You can for example something like this:

    
      
        
        
      
    
    

    And the last step is to set the element of content dynamically using the defined variable

    
      
        
        
      
    
    

    The only thing to use the defined variable is that part of the query:

    [position()=bpws:getVariableData('Position_Variable')]
    

    Finally, the XML Structure should look like this:

    
      
        
          
            
              Content1
            
            
              Content2
            
          
        
      
    
    

    Concerning

    Alex

  • Add more dynamic events registration refnum

    Hello

    I have a wire that passes Event Registration refnum to my structure of the event. This thread is from VI, that I don't want to touch. He spent recording for the cluster of user events.

    I would add more dynamic events to the refnum (but not to the cluster), so I would like to re-record with the addition of new events.

    When I'm passing this refnum to block 'Register for events', LabVIEW does not allow me to expand this block and add new events, which I think is understandable.

    How can I add more dynamic events to the refnum?

    Close, but no cigar.  When you add user events, you want to be sure that every event has a unique name, then name your constants defining the events differently (as shown here).

    Bob Schor

  • How to add template mvc3 in ultimate vs10?

    How to add template mvc3 in ultimate vs10? Please help me

    Hello

    Welcome to Microsoft Windows 7 answers Forum!


    Thank you for visiting the Microsoft answers Forum.

    The question you posted would be better suited in the MSDN Forums. I would recommend posting your query in the MSDN Forums.
     
     
    I hope this helps.

Maybe you are looking for