update with the instruction box

Hello

I need to do something like this:

update my_table set (prelucrat, err) = (select case
                                                         when r.id is not null then
                                                           ('D', null)
                                                         else
                                                           ('N', 'Nu exista persoana cu marca '||r.marca)
                                                       )
where marca = r.marca and ctiserver = r.ctiserver

But I got an error 'missing right parenthesis.

'r' is a cursor variable, so this update is nested in one 'for r in (...) ". loop. "

What I am doing wrong? Is it possible to update both the two columns, then select in this use case?

Thank you.

for r in loop (select...)

Update my_table

Set prelucrat = nvl2(r.id,'D','N')

, err = nvl2 (r.id, null, 'Nu exista person cu marca' | r.marca)

where marca = r.marca

and ctiserver = r.ctiserver;

end loop;

----

Ramin Hashimzade

Tags: Database

Similar Questions

  • DEFAULT CONSTRAINT with the INSTRUCTION BOX - Oracle 11.2.0.3

    Is it possible to create a default constraint on a table based on conditional logic.

    For example:

    CREATE TABLE TEST_T (NUMBER OF DEPT_NO,

    GRANT_FL CHAR (1)

    );

    GRANT_FL DEPT_NO

    10             Y

    10             Y

    0               N

    I want the DEPT_NO to be filled with a default value of 10 only when GRANT_FL = 'Y' otherwise the value to 0.

    I can do that with an after Insert trigger, but would be better if this can be done via the case statement that sets a default value.

    Thank you very much!

    Kevin

    Hi, Kevin,

    Sorry, I don't think that there is a way to do it with the DEFAULT options.

    Kevin_K wrote:

    ... I can do this with an after Insert trigger...

    I think that a trigger is your best bet, but a BEFORE INSERT trigger would be much simpler and more effective?  An INSTEAD OF trigger is another possibility.

  • Is is possible to make several updates with the text box

    How to enter an area and have it update several records in a field, I can do this with sql?
    Thank you
    Doug

    you want to update multiple fields in the same folder? If so, you could do something like:

    UPDATE emp
       SET comments = :P150_text
           extra_comments = :P150_text
     WHERE emp_id = :P150_emp_ID
    {code}
    
    this will set the comments and extra_comments fields both equal to the :P150_text apex item. you would put this into a procedure on your page.
    
    If you were updating the comments field for multiple records you would have to make a cursor for X records and loop through X records and make the comments := :P150_text
    
    good luck...
    
    Edited by: Tyson Jouglet on Sep 17, 2008 9:53 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
    
  • Update of dynamic Action with the text box

    This goes along with: update records with the text box

    APEX: 4.0.2

    THEME: SAND

    SERVER: Oracle-Application-Server-10g/10.1.3.1.0 Oracle-HTTP-Server

    I created an example with more comments on the page:

    workspace: stevendooley34

    username: dev01

    password: dev01

    application: examples of Forum

    page: update example

    I've implemented just as I think it should be put in place, but records only updates by clicking on my Refresh"" button.

    Keep in mind that the example is found in the apex 4.2.5 but I will implement this in 4.0.2.

    Thank you

    Steven



    Hi Steven,

    I think the main thing that was missing was adding the elements used in the PL/SQL "Page to go".

    The reason this is necessary is so APEX know what values of point on the browser should be sent (as part of the AJAX call) to the browser.

    IF you had all the elements that must be returned to the screen, then you will use the 'Page field items to return.

    I've also corrected a few things, P6 instead of P6 and P6_SEARCH_TYPE instead of SEARCH_TYPE, but they were just small "bugs" in the example.

    I also added another real action to refresh the report after the update.

    Thank you

    -Jorge

    PS. I do not validate that your code works for multiple, but the first glance entries and a quick test, it seems to work fine.  I focused only on the DA.

  • Problem with variable referencing of presentation (KEY Date) in the instruction box

    Hello

    I'm trying to reference variables of presentation created on a Date column in the instruction box to one of the columns in the query, as shown below:

    -case when '-citation details. "" "Created" between ' @{of} {1999-1-1}' and ' @{until} {2999-1-1} "then"-quote Metrics. " "" end of number of citations.

    I m getting a view displays error message with the following error message:

    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error occurred. [nQSError: 17001] Oracle error code: 1861, message: ORA-01861: literal does not match the format string to the call of the OIC OCIStmtExecute

    SQL issued: SELECT "-quote Types '." Name of level 2 Saw_0', case when '-citation details. "" Created "between" 01/04/2009 ' and ' 15 / 04/2009 ' then '-quote Metrics ' "." number of citations"end saw_1"(unit) - CATALOGUE of quotes"WHERE"-citation details "". "" Date of creation"BETWEEN timestamp ' 2009-04-01 00:00:00 ' timestamp AND ' 2009-04-15 00:00:00 ' ORDER BY saw_0


    When I created the prompt on the date field, I put the following in the command prompt:
    Cast ("-time".) Day)

    When I apply a filter on the query using these variables, it works fine.

    If anyone has faced this kind of question earlier and have a resolution, please help me.

    Thank you
    Kitenge

    Hello.

    Select the double - A NON-VALIDE MONTHS TO_DATE('1999-1-1','mm/dd/yyyy')

    Try this:

    OLD: EVALUATE ('TO_DATE (%1, %2)', ' @{of} {1999-1-1} ", mm/dd/yyyy)
    NEW: EVALUATE ('TO_DATE (%1, %2)', ' @{of} {01/01/1999} ", mm/dd/yyyy)

    and

    OLD: EVALUATE ('TO_DATE (%1, %2)', ' @{of} {2999-1-1} ", mm/dd/yyyy)
    NEW: EVALUATE ('TO_DATE (%1, %2)', ' @{of} {1, 1, 2999} ", mm/dd/yyyy)

    and if not ok after that, after an error in query SQL of NQQuery.log.

    Kind regards

    Goran Ocko

    http://108obiee.blogspot.com/

  • Advanced action not updated on the click box update

    I inherited a model with a quiz with boxes made from boxes to click. In its current form, the user can cilck the button submit without clikcking on any of the 6 boxes (not an ideal situation for a trial).

    I created variables for all click areas and associated with 0 (set checkbox 1 with 0... etc.).

    In the in the slide, I have on enter slide Execute advanced Actions, I have AND of statements indicating that if the checkbox is = to 0, then hide and disable the button send... and I am doing this for all the checkboxes (if checkbox1 = 0 AND checkbox2 = 0... etc.). I then an Else, indicating to display and activate the submit button.

    In the clickbox I have when it is activated (there's a box for clicked and clicked not), I put the variable checkbox to 1 between 0... that means that the advanced Actions 'should' be updated with the new variable to 1, but it does not work.

    I think it has something to do with the click boxes because it seems to stall the reading head and not continue to run the advanced Actions. It's my guess only as that is the question.

    Any thoughts?

    Thank you.

    Brent

    Removal of variables is possible in Captivate 9, not in previous versions. Even in CP9 that it's always a bit tricky, some variables seem is always 'used' so that they do not.

  • Distinct count in the instruction box

    -------------------------------------------------------------------------------------------------
    SELECT A.P_ID,
    B.P_NAME,
    C.P_DESC,

    SUM (CASE
    WHEN A.DATE BETWEEN TRUNC (ADD_MONTHS (LAST_DAY (SYSDATE),-4) + 1) AND ADD_MONTHS (LAST_DAY (TO_DATE (SYSDATE)),-1)
    AND A.M_ID IS NOT NULL
    THEN 1
    0 OTHERWISE
    END) AS COUNT,
    SUM (CASE
    WHEN A.DATE BETWEEN TRUNC (ADD_MONTHS (LAST_DAY (SYSDATE),-4) + 1) AND ADD_MONTHS (LAST_DAY (TO_DATE (SYSDATE)),-1)
    AND A.M_ID IS NOT NULL
    THEN COUNT (DISTINCT A.M_ID)
    0 OTHERWISE
    END) AS UNIQUE_COUNT, / * is not possible * /.
    SUM (CASE
    WHEN A.DATE BETWEEN TRUNC(SYSDATE,'YEAR') AND ADD_MONTHS (LAST_DAY (TO_DATE (SYSDATE)), - 1).
    THEN A.AMT_1
    0 OTHERWISE
    END) AS TOTAL_AMT_1,
    SUM (CASE
    WHEN A.DATE BETWEEN TRUNC(SYSDATE,'YEAR') AND ADD_MONTHS (LAST_DAY (TO_DATE (SYSDATE)), - 1).
    THEN A.AMT_2
    0 OTHERWISE
    END) AS TOTAL_AMT_2

    FROM TABLE_A A,.
    TABLE_B B,.
    C TABLE_C


    WHERE A.P_ID = B.P_ID
    AND B.PT_ID = C.PT_ID
    A.P_ID GROUP,
    B.P_NAME,
    C.P_DESC

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

    Hello

    It is a simplified version of my request.
    I'm doing 4 things here,
    1. the County A.M_ID
    2 County has separate .M_ID, is where I have a problem.
    3 and 4. It is just the sum of 2 diff columns.

    Note that the dates for the County and the amt are different and I can't hard-code the.
    Can someone help me step of distinct count?
    This query runs also a bit slow.
    So all suggestions, comments are welcome.
    Note: TABLE_A REB 700 million, TABLE_B 4 million and TABLE_c is located only 500 RECS
    Thank you!

    Advantage of the fact that aggregate functions more ignore nulls, you could do something like:

    SELECT a.p_id, b.p_name, c.p_desc,
           COUNT(CASE WHEN a.date BETWEEN TRUNC(ADD_MONTHS(LAST_DAY(sysdate),-4) + 1) AND
                                          ADD_MONTHS(LAST_DAY(TO_DATE(sysdate)),-1) AND
                           a.m_id IS NOT NULL THEN m_id END) AS countall,
           COUNT(DISTINCT CASE WHEN a.date BETWEEN TRUNC(ADD_MONTHS(LAST_DAY(sysdate),-4) + 1) AND
                                        ADD_MONTHS(LAST_DAY(TO_DATE(sysdate)),-1) AND
                         a.m_id IS NOT NULL THEN a.m_id END) AS unique_count, /* entirely possible */
           SUM(CASE WHEN a.date BETWEEN TRUNC(sysdate,'YEAR') AND
                                        ADD_MONTHS(LAST_DAY(TO_DATE(sysdate)),-1) THEN a.amt_1
                    ELSE 0 END) AS total_amt_1,
           SUM(CASE WHEN A.DATE BETWEEN TRUNC(sysdate,'YEAR') AND
                                        ADD_MONTHS(LAST_DAY(TO_DATE(sysdate)),-1) THEN A.AMT_2
                    ELSE 0 END) AS TOTAL_AMT_2
    FROM table_a a, table_b b, table_c c
    WHERE a.p_id = b.p_id and
          b.pt_id = c.pt_id
    GROUP BY a.p_id, b.p_name, c.p_desc
    

    The two statements inside the COUNTY box return a.m_id or NULL. A simplified test case is:

    SQL> WITH t as (
      2     SELECT 1 m_id, 9 dt FROM dual UNION ALL
      3     SELECT 1 m_id, 6 dt FROM dual UNION ALL
      4     SELECT 2 m_id, 9 dt FROM dual UNION ALL
      5     SELECT 2 m_id, 6 dt FROM dual UNION ALL
      6     SELECT 1 m_id, 5 dt FROM dual UNION ALL
      7     SELECT 2 m_id, 5 dt FROM dual UNION ALL
      8     SELECT null m_id, 9 dt FROM dual)
      9  SELECT count(CASE WHEN dt BETWEEN 6 and 9 THEN m_id end) cid,
     10         count(distinct CASE WHEN dt BETWEEN 6 and 9 THEN m_id end) cdid
     11  FROM t;
    
           CID       CDID
    ---------- ----------
             4          2
    

    I'm not entirely sure that you really need the IS NOT NULL predicate a.m_id in the instructions BOX, but I left it for more security.
    John

  • Restrictions does not not after ISO put 10.0.1 update with the new iPhone 7

    Restrictions does not after ISO put 10.0.1 update with the new iPhone 7 any which option of ranking app I don't choose no changes are made.  All the patches?

    Thank you

    Hello Launcher,

    Thank you for bringing your question about Restrictions here in Apple Support communities. My understanding of your question is that you change the Restrictions, but no change is noticed. I tried the same on my iPhone 6 Plus running iOS 10 and noticed a similar situation. Please allow me the opportunity to explain how the Restrictions is designed to work. First, I put my limitations for applications, do not allow Apps and together 4 +, which basically means everything beyond 4 + will be blocked from buying. Then I went to the App Store and the first app that caught my attention was NCIS: hidden crimes. This app is rated 12 + and is definitely an application I would not want my toddler to help. It is that Restrictions come into play. When I type on NCIS: hidden Crimes, the Get option is grayed out. Restrictions does remove all apps, songs, books, etc. from view, but it will prevent the purchase, download, and install all applications rated above the setting you choose when you set up restrictions. It's the help article that discusses the Restrictions and prevent purchases: Use Restrictions in order to avoid buying on iPhone, iPad, or iPod touch.

    I checked on the restrictions help articles, and I understand where it can be a bit confusing. In the help article Use Restrictions on iPhone, iPad and iPod touch, it says "You can use Restrictions, also known as parental control, to block or limit specific applications and features on your iPhone, iPad or iPod touch." This means in fact that apps, features or services (rated above that helped you, or if you have turned off completely) can he no longer appears on the device if the restriction is activated and starts blocking them. I also tested this by activating Restrictions and turned the cursor for Safari to off. When I went back to the home screen, Safari doesn't show any more and I could no longer use it.

    I hope this helps to clarify how the Restrictions. If my understanding of the issue was not accurate to the issue that you are experiencing, I will be happy to pursue this issue with you. Please indicate exactly what you took measures, and what expectations you had or the some restrictions, applications, features, or services you are restricted. Thanks again and have a great rest of your day!

  • You can change the font size using the form in the preview (not with the text box). Having also arrow drawing trouble in preview.

    You can change the font size using the form in the preview (not with the text box). Having also arrow drawing trouble in preview.

    What problems are you having with the arrow? You go to Tools-> annotate-> arrow and an arrow appears. Then you can drag around the head and tail to make it to the desired location.

  • I bought an iphone used several years ago... hen his recently updated with the new iOS 7.1.2 it was locked with the previous owners account.how can I use my iphone is back with my apple and pass

    I bought an iphone used several years ago... When updating with the new iOS 7.1.2 recently, he was locked with previous apple owners account.

    its now useless. I didn't know all these crappy activation locks and all.now I have no idea

    How can I find my iphone is off and use my phone back

    iphone 4 32 gb

  • Bug in reporter Panel updated with the property Value Chart

    Hi guys,.

    Defer to what the Panel update property is set to true and chart is updated with the help of node "Property value", data are not updated graphics. Capture of the block diagram and VI (2014) screen gasket.

    Is this a known bug, and is there any fix for it?

    Thank you

    Knockaert

    I have not tried running your code, but here are some possible solutions:

    1. There is a primitive to write the value of a control by index (added in ~ 2013). This is designed to be used others live too and should work like a local.
    2. You can send data using another way (like a queue, etc.).
    3. Use the Ctl Val.Set method.
    4. Do not use a chart. Use a chart and manage the buffer yourself. You can find some examples if you're looking for graph XY.
  • Please help me understand how to install updates with the following error updated Message__The following have not been installed: __Security update for Microsoft XP KB 2289162

    Please help me understand how to install updates with the following error Message

    The following updates were not installed:

    Security for Microsoft XP KB 2289162 update

    See the section "How to get help" of http://support.microsoft.com/kb/2289162

    For individuals, please visit the Microsoft Solution Center and antivirus security for resources and tools to keep your PC safe and healthy.  If you have problems with the installation of the update itself, visit the Microsoft Update Support for resources and tools to keep your PC updated with the latest updates.

    Buying to meet problems installing Microsoft security updates also can visit the following page for assistance: https://consumersecuritysupport.microsoft.com/

    ~ Robear Dyer (PA Bear) ~ MS MVP (that is to say, mail, security, Windows & Update Services) since 2002 ~ WARNING: MS MVPs represent or work for Microsoft

  • I am also having the same problem with the same updates. I have Windows XP SP3 and it's updates with the problem.

    I am also having the same problem with the same updates. I have Windows XP SP3 and it's updates with the problem.

    Security Update for Microsoft .NET Framework 2.0 SP2 on Windows Server 2003 and Windows XP x 86 (KB2572073)
    A security update for .NET Framework 2.0 SP2 and 3.5 SP1 on Windows Server 2003 and Windows XP x 86 (KB2518864)
    Security Update for Microsoft .NET Framework 2.0 SP2 on Windows Server 2003 and Windows XP x 86 (KB2633880)

    They all install properly but switches back to windows update to install. It's some kind of loop.

    Hi billy73,

    In addition, if you still have questions, please take a look at the thread similar here with a solution as possible.

    I hope this helps!

  • kb2633171 a security update wont install windows vista and keeps on saying failed in the history of updates with the error code 80070020

    Original title: kb2633171 security update will not install windows vista

    Hello

    as noted above, the kb2633171 of security update will not install on my computer used windows vista laptop. I had mcafee installed since the first day (it came with the pc). He continues saying failed in the history of updates with the error code 80070020. When I restart the pc, it says that it cannot configure the update and it is up to the old settings.

    I ran the fix it and aggressive to solve this problem, no luck :-(

    any help muchly appreciated.
    Thank you!

    Chiara

    Hi Chiara,

    Try following the steps in the following article.

    You receive error 0 x 80070020 when you use the Windows Update Web site or the Microsoft Update Web site to install the updates

    http://support.Microsoft.com/kb/883825

     

    Let us know if it helps.

  • Update with the Lead feature and several lines

    I have a table such as:

    Table1:

    OrderNumber EFFECTIVE_DATE EFFECTIVE_END_DATE FileName

    123 11/5/2015-12/31/2099 File5.txt

    123, 7/11/2015-12/31/2099 File7.txt

    or it can look like:

    Table2

    OrderNumber EFFECTIVE_DATE EFFECTIVE_END_DATE FileName

    123 11/5/2015-11/7/2015 File5.txt

    123, 7/11/2015-11/9/2015 File7.txt

    123 11/9/2015-12/31/2099 File9.txt

    123 11/15/2015-12/31/2099 File15.txt

    I want to take the 2nd to the last EndDate and update with the previous value.

    So in fact, it would look like this.

    Table1:

    OrderNumber EFFECTIVE_DATE EFFECTIVE_END_DATE FileName

    123 11/5/2015-11/7/2015 File5.txt

    123, 7/11/2015-12/31/2099 File7.txt

    or

    Table2

    OrderNumber EFFECTIVE_DATE EndDate FileName

    123 11/5/2015-11/7/2015 File5.txt

    123, 7/11/2015-11/9/2015 File7.txt

    123-11/9/11/15 to 2015/2015 File9.txt

    123 11/15/2015-12/31/2099 File15.txt

    I got it work in a select statement to a single value. now I just need help it enter an UPDATE statement and update all records.

    SELECT W.EFFECTIVE_DATE, W.EFFECTIVE_END_DATE,

    NVL (LEAD (W.EFFECTIVE_DATE, 1) (ORDER implementation W.EFFECTIVE_DATE), December 31, 99 ') AS 'EFFECTIVE_DATE_NEW '.

    OF WH_ORDERS_REPORT W

    WHERE ORDERNUMBER = '10460992';

    It did not work:

    UPDATE WH_ORDERS_REPORT WH

    SET EFFECTIVE_END_DATE = (SELECT NVL (LEAD (WH2. EFFECTIVE_DATE, 1) (ORDER of WH2. (EFFECTIVE_DATE), DECEMBER 31, 99 ')

    OF WH_ORDERS_REPORT WH2

    WHERE WH. ORDERNUMBER = WH2. ORDERNUMBER)

    I appreciate your help in the creation of an update statement to do this.

    Rap, but it's working now.  I'll confirm with a few other records before I mark as correct, but what I see so far, it is beautiful, thank you!

    merge into WH_LIFELINE_ORDERS_REPORT D

    a_l'_aide_de)

    Select

    DISTINCT ORDERNUMBER,

    CURRENTSTATUSDATETIME,

    NVL (LEAD(EFFECTIVE_DATE, 1) ON (ORDERNUMBER partition

    (EFFECTIVE_DATE order), December 31, 99 ') as EFFECTIVE_END_DATE

    of WH_LIFELINE_ORDERS_REPORT

    ) S

    WE (D.ORDERNUMBER = S.ORDERNUMBER

    AND D.CURRENTSTATUSDATETIME = S.CURRENTSTATUSDATETIME

    )

    When matched then

    setting a day of set D.EFFECTIVE_END_DATE = S.EFFECTIVE_END_DATE;

Maybe you are looking for