cfquery fails with conditional stored query in a variable

Following the code does not work. Can anyone explain why?

< cfset myquery = "select * from employee where id ="10 "" > "
< name cfquery = "a" datasource = "MyDSN" >
#myquery #.
< / cfquery >

What do you mean by "not working"?  You really should read this before posting: http://forums.adobe.com/thread/607238.

The ID is really a column focused on the chain?  I expect it to be an integer, so it did not have quotes.

Also, if you do what you do, if your variable inside single quotes, you will need to use preserveSingleQuotes() to stop CF escape them.

--
Adam

Tags: ColdFusion

Similar Questions

  • This is how a SELECT query fails with ORA-1555 occur?

    11 GR 2/RHEL 6.2

    I would like to know exactly how a SQL fails with error ORA-1555.

    Please take a look at the following simple example.

    INVENTORY_DETAIL is a table that stores information about items in a store.

    For this DB UNDO_RETENTION is set to 3 600 (1 hour) and TUNED_UNDO_RETENTION Meanwhile 5400 (1.5 hours)

    At 15:00, there's 12 Logitek involved in inventory.

    ITEM_ID NOM_ELEMENT STOCK_LEFT

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

    8432 LOGITEK 12 SPEAKER

    At 15:00 Session1, starts a SELECT large with several tables joins query. Something like

    Select id.item_id, id.item_name, su.supplier_price, su.supplier_code

    Su.batch_code...

    of INVENTORY_DETAIL id join in-house suppliers knew on (id.supplier_id = su.supplier_id)

    ...

    ..

    03:02, Session1 reads the block that stores the line with item_id = 8432 and learns that he has 12 Logitek left speakers.

    15:10, Session2 delivers the next UPDATE and he agrees immediately.

    Update inventory_detail set stock_left = 7 where item_id = 8432;

    commit;

    The UNDO data for Session2 transaction are stored in the measure of cancellation remaining, and the UNDO data gets debusquees at 04:40 when the TUNED_UNDO_RETENTION of 1.5 hours is crossed at 16:40.

    Because of the bad of e/s, query SELECT of Session1 manages to retrieve all the records only from 17:00.

    But session1 notice this line with item_id = 8432 changed. Now, there's only 7 Logitek speakers which is inconsistent with what he learned at 15:02 (who was then at 12). Because of this incompatibility SO not able to recover data UNDO on this gap, ORA-1555 is thrown. My assumptions are good?

    3:10PM                             4:10PM                          4:40PM                       5:00PM

    |===================================|-------------------------------|-----------------------------|

    UNDO_RETENTION = 1 HR retention Undo Tuned = 1.5 h finishes of request for enforcement

    Martin, you asked, "are the correct on the circumstances that led to ORA-1555 my explanations?  The answer is no.  Oracle does not notice at the end of the query that changed a line he read.  Instead, each read line is at the same point in time.  When Oracle sees that a row has changed Oracle reads the UNDO segments to find the version of the data corresponding to the query start time.  If these data cannot be found the ORA-01555 error is raised.

    - -

    HTH - Mark D Powell.

  • Microsoft SQL Server 2014 (SP1 - CU4) (KB3106660) query failed with error ORDER BY items must appear in the select list if SELECT DISTINCT is specified.

    Hello
    I use Microsoft SQL Server 2014 (SP1 - CU4) (KB3106660) Enterprise Edition (64-bit) on Windows NT 6.1 (Build 7601: Service Pack 1)

    SELECT DISTINCT A.PI_LOOKUP_CATEGORY_ID,
    REPLACE (REPLACE (UPPER (A.LOOKUP_CATEGORY_NAME), ' ', '_'), '-', '_') AS CATEGORY_TECH_NAME,
    A.LOOKUP_CATEGORY_NAME,
    A.LOOKUP_CATEGORY_DESCR,
    COUNT (B.PI_LOOKUP_CATEGORY_ID) AS USAGE_COUNT
    FROM [PI_LOOKUP_CATEGORY] A LEFT OUTER JOIN B [PI_INSIGHT_COLUMN] WE
    A.PI_LOOKUP_CATEGORY_ID = B.PI_LOOKUP_CATEGORY_ID
    A.PI_LOOKUP_CATEGORY_ID GROUP,
    REPLACE (REPLACE (UPPER (A.LOOKUP_CATEGORY_NAME), ' ', '_'), '-', '_').
    A.LOOKUP_CATEGORY_NAME,
    A.LOOKUP_CATEGORY_DESCR
    ORDER TO REPLACE (REPLACE (UPPER (A.LOOKUP_CATEGORY_NAME), ' ', '_'), '-', '_')

    above request is failed with error ' ORDER BY items must appear in the select list if SELECT DISTINCT is specified. " Microsoft SQL Server (SP1 - CU4) 2014 (KB3106660)

    same query works fine with older versions of SQL servers like (2008R2, or 2012)

    Please let me know the resolution of this problem...

    Thank you
    Touria

    Ask here:

    MSDN - SQL Server - Microsoft forums

  • Replication fails with the-501 error

    Hi all

    My replica jobs suddenly all fail with error - 501 (I can't find any info one that means), but that's what shows the log to replicate:

    Replicate version1.3.0 generation R2

    From backup

    Folder lock target: /...

    File recovery is «...»

    P2P connection to the nas-xy-xy (distance RN102)

    X cannot connect to the nas-34-xx-yy (local RN104)

    X the connection - 501 error code

    X please verify the network connection between the devices

    This worked very well for months since the last update 6.5.1 I'm not aware of any changes that I made in each of the configurations.

    Both RN do not appear in ReadyCloud, Replicate sees the two RN in the network tab but when starting a job to replicate my local RN on the RN remote I get the above fault message.

    I am very reluctant to upgrade to 6.5.2 that it worked very well on 6.5.1 for so long and I did not really pleasant experiences for the latest updates...

    Someone at - it similar experiences (I'm inclined to think that the issue is on the server to replicate as it happened before that jobs has failed for a period, but succeeded after a few days without any changes on my side.

    Any suggestion that means this error - 501 (and how to fix it)?

    And if all fails, I'm getting a little tired of the repeated questions, someone at - it an installation of certificates SSH on the RN to activate RSYNC over SSH?

    Any comment is very appreciated!

    Yes, just tried it and got that job, turns out that apart from the source and target parameters that needs to be identical to the old job, also the name of the work is essential, it must be exactly the same as the lost job. (on the target files side are stored in a folder named after the name of the task, found that rather confused, but either way, once you are aware of it...)

    Don't have that and I got my old RESUME jobs where they left, it looks like I'm back in business.

    Thanks for your support!

  • Windows Update KB968930 fails with the error code 800F080D

    For the last week I have "been trying to install this update, Windows PowerShell 2.0 and WinRM 2.0 for Windows Vista (KB968930) and the installation fails, with error code 800F080D. I am always prompted to install it. Is there a resolution? Meanwhile a few other updates when the installation was successful. Thanks in advance!

    Hi MariMaraki,

    If you receive the Windows Update 8024200d error, it may mean that an update did not finish to download or install. The System Update Readiness Tool for Windows can correct some conditions that can cause this error.

    You can check the link and try to use the system analysis tool and check.

    Windows Update error 8024200d

    http://Windows.Microsoft.com/en-us/Windows7/Windows-Update-error-8024200d

    This also applies to Windows Vista.

    After you run the tool, try to install the update manually and check.

    See the link to download the update:

    http://www.Microsoft.com/downloads/en/details.aspx?FamilyId=f2fa1227-9a34-4E29-AA03-62f5c00e16f2&displaylang=en

  • Remote Desktop sessions fail with the error of data encryption

    All my remote desktop sessions attempts fail with an error of bull data encryption *. It seems that half of the world has this error and no one can provide an answer. Before binding you to an answer without value, it is all my clients servers with Windows Server 2003-2011 everything, cannot RDP to any of them.

    Most suggested answers a problem of router or server specific problem or suggest disabling large unloading on the network card.  Well, this problem hooked 30 + servers I've tried lately.  I tried with unloading defined on deactivate and activate.  I tried ethernet and wifi.  I tried to do different internet connect, work, home to various customer sites.

    In other words, I can no longer use RDP to connect to servers on ANY connection.  It simply doesn't work anymore.

    I run Windows 7 32 bit and this couple suddenly some days ago.  Before you start, no virus, no updated drivers... blah blah blah.

    The first day, he started, he wouldn't let me RDP via VPN but if I went through the external IP (mapped ports).  Then, it only works if I was on ethernet, not the wireless.  Then he just decided it wouldn't work at all.  Today, that I even tried to get back into the work remotely via RWW and the RDP ActiveX... did not work.  Tried both servers a SBS 2003 to 2008.  Nope.

    XP has a ten years more of life.  Win7 has done roughly three years, now it starts to fall apart.

    If you can fix this before moving on to Windows 8, and without having to wipe my whole PC, it would be much appreciated.

    Hello

    The question you posted would be better suited in the TechNet Forums. I would recommend posting your query in the TechNet Forums:

    http://social.technet.Microsoft.com/forums/en/winserverTS/threads

  • Automatic failover with Transport and apply Lag fails with ORA-16798

    Hello
    I configured a physical database maximum Performance, accelerated failover mode standby. I set FastStartFailoverLagLimit to 3 hours (10800 seconds).

    If I understand the Oracle documentation, Fast-Start failover should work with Max Performance, as long the Transport timeout is whithin the FastStartFailoverLagLimit.


    So I started a few scripts, generated some loading, so I have a Transport and apply the shift of 3-4 Minutes.
    Then I killed pmon to cause an automatic failover.

    Failover failed with ORA-16798.

    I know, there is Note 846087.1 , which describes the problem, but I thought that automatic failover should work in this configuration.
    Is this a bug or am I wrong?

    Thank you very much in advance.


    Configuration Data Guard standby:
    -----------------------------------------------

    Role: STANDBY PHYSICS
    State of destination: apply
    Transport delay: 3 minutes 3 seconds (calculated two seconds ago)
    Apply the Lag: 3 minutes 26 seconds (calculated 0 seconds ago)
    Apply the rate: 23,52 MB/s
    Real-time query: OFF
    Occurrence (s):
    ...

    Properties:
    ...
    LogXptMode = "async".
    DelayMins = '0'
    Binding = "optional."
    MaxFailure = '0'
    MaxConnections = '1'
    ReopenSecs = "300"
    NetTimeout = "15"
    RedoCompression = "DISABLE."
    ...

    State of the database:
    SUCCESS

    Fast failover configuration:
    -----------------------------------------------

    Fast-Start Failover: ENABLED

    Threshold: 180 seconds
    Target: < Targetname >
    Observer: < servername >
    Offset limit: 10800 seconds
    Primary closure: TRUE
    Auto-Rétablir: TRUE
    Reconnection of the observer: (none)
    Substitution of the observer: FALSE

    ...


    Messages of the DG - Log:
    -----------------------------------------------
    FAILOVER TO < DB >
    Starting failover to the < DB > database
    Notifying Oracle Clusterware to disassembly for the FAILOVER database
    02/02/2015-13:38:04
    Error running SQL = 604, sql = [ALTER DATABASE RECOVER MANAGED STANDBY DATABASE FI
    ORA-00604: an error has occurred at the SQL level 1 recursive
    ORA-00283: cool cancelled due to errors
    ORA-16171: RECOVER... FINISHING not allowed away for thr 1, seq 34-37
    Failed to retrieve Terminal.
    Database error resource SetState (16798)
    02/02/2015-13:38:08
    Command FAILOVER < DB > completed with error ORA-16798


    The FastStartFailoverLagLimit property specifies the amount of data, in seconds, during which the standby database target can

    delay on the main database on the recovery plan applied. If again applied Eve point database notes that many

    seconds of the primary database redo point generation, accelerated tipping is allowed.

    Errors show a gap for sequences 34-37, which is not optimal for a fast failover.

    Even if FastStartFailoverLagLimit is set to 3 hours, there is too much data loss for the standby site because newspapers are not available on the backup server and the Broker cannot activate the Pb of the day before.

    I recommend to to lean on increase the bandwidth network.

    Concerning

  • Photoshop CC install fails with "USS has quit unexpectedly.

    Since the Office application creative cloud [Windows 7] failed with a spinning wheel permanently I tried the various solutions found here. They involved all uninstall, running cleaner, re-installing Office CC... Try to reinstall Photoshop CC 2015 then fails, [stops at some percentage]. I tried the more specific operations available here [errors 'Exit Code 6' and ' exit 7 "Code install Adobe Creative Cloud, CS6, CS5.5, Premiere Elements and Photoshop Ele..."] without success. [Although cannot claim all the redistributable repairs and modified startups were completed successfully.]

    The relevant part of the journal seems to be:

    10/03/16 18:54:43:215 | [INFO] |  | OOBE. OF |  |  |  | 1060 | *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*

    10/03/16 18:54:43:215 | [INFO] |  | OOBE. OF |  |  |  | 1060 | Operation of the installer: PayloadInstaller

    10/03/16 18:54:43:215 | [INFO] |  | OOBE. OF |  |  |  | 1060 | *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*

    10/03/16 18:54:43:215 | [INFO] |  | OOBE. OF |  |  |  | 1060 | Request to install the payload

    10/03/16 18:54:43:215 | [INFO] |  | OOBE. OF |  |  |  | 1060 | Payload ARKEngine Adobe Photoshop CC 2015 Core_16.1.2_AdobePhotoshop16 - Core_x64 16.1.2.0 {F217525B-30EB-42F2-A730-F61139264DB5}: the call of the path C:\Program Files (x 86) \Common Files\Adobe\OOBE\PDApp\DECore\DE6\resources

    10/03/16 18:54:43:386 | [INFO] |  | OOBE. OF |  |  |  | 1060 | Extraction of asset:C:\Users\Misha\AppData\Local\Temp\Adobe\AAMUpdater\AdobePhotoshopCC2015-16.0\16.1.2 \setup\payloads\AdobePhotoshop16-Core_x64-130116074228\Assets2_1.zip

    10/03/16 18:54:43:386 | [INFO] |  | OOBE. OF |  |  |  | 1060 | Affecting false in the unzipper file open option

    10/03/16 18:54:43:449 | [INFO] |  | OOBE. OF |  |  |  | 1060 | Extraction of asset:C:\Users\Misha\AppData\Local\Temp\Adobe\AAMUpdater\AdobePhotoshopCC2015-16.0\16.1.2 \setup\payloads\AdobePhotoshop16-Core_x64-130116074228\Assets1_1.zip

    10/03/16 18:54:43:449 | [INFO] |  | OOBE. OF |  |  |  | 1060 | Affecting false in the unzipper file open option

    10/03/16 18:57:05:420 | [ERROR] |  | OOBE. OF |  |  |  | 1480 | ASU has quit unexpectedly.

    10/03/16 18:57:29:740 | [INFO] |  | OOBE. OF |  |  |  | 1060 | All self-extracting assets. Number of active: 2

    10/03/16 18:57:29:740 | [INFO] |  | OOBE. OF |  |  |  | 1060 | CustomizedPatch property not found in the database

    10/03/16 18:57:29:740 | [INFO] |  | OOBE. OF |  |  |  | 1060 | Begin the installation of payload to C:\Users\Misha\AppData\Local\Temp\Adobe\AAMUpdater\AdobePhotoshopCC2015-16.0\16.1.2\setup \payloads\AdobePhotoshop16-Core_x64-130116074228\Install.db

    10/03/16 18:58:32:952 | [INFO] |  | OOBE. OF |  |  |  | 1060 | Definition of authorization to: C:\Program Files\Adobe\Adobe Photoshop CC 2015\Presets\Deco\Picture Frame.jsx group / user: BuiltinGuests access: GENERIC_ALL (Seq 1450)

    10/03/16 18:58:32:952 | [INFO] |  | OOBE. OF |  |  |  | 1060 | Definition of authorization to: C:\Program Files\Adobe\Adobe Photoshop CC 2015\Presets\Deco\Picture Frame.jsx group / user: BuiltinUsers access: GENERIC_ALL (Seq 1451)

    10/03/16 18:58:33:607 | [INFO] |  | OOBE. OF |  |  |  | 1060 | Definition of authorization to: C:\Program Files\Adobe\Adobe Photoshop CC 2015\Presets\Deco\_Deco Menu.jsx group / user: BuiltinGuests access: GENERIC_ALL (Seq 1472)

    10/03/16 18:58:33:607 | [INFO] |  | OOBE. OF |  |  |  | 1060 | Definition of authorization to: C:\Program Files\Adobe\Adobe Photoshop CC 2015\Presets\Deco\_Deco Menu.jsx group / user: BuiltinUsers access: GENERIC_ALL (Seq 1473)

    10/03/16 18:58:34:325 | [INFO] |  | OOBE. OF |  |  |  | 1060 | Evaluate condition # 1 (seq. 1500)

    10/03/16 18:58:34:325 | [INFO] |  | OOBE. OF |  |  |  | 1060 | Condition failed (seq. 1500)

    10/03/16 18:58:34:325 | [INFO] |  | OOBE. OF |  |  |  | 1060 | Evaluate condition # 1 (Seq 1501)

    10/03/16 18:58:34:325 | [INFO] |  | OOBE. OF |  |  |  | 1060 | Condition failed (Seq 1501)

    10/03/16 18:58:48:271 | [INFO] |  | OOBE. OF |  |  |  | 1060 | Evaluate condition # 1 (Seq 1834)

    10/03/16 18:58:48:271 | [INFO] |  | OOBE. OF |  |  |  | 1060 | Condition failed (Seq 1834)

    10/03/16 18:58:48:271 | [INFO] |  | OOBE. OF |  |  |  | 1060 | Evaluate condition # 1 (Seq 1835)

    10/03/16 18:58:48:271 | [INFO] |  | OOBE. OF |  |  |  | 1060 | Condition failed (Seq 1835)

    Assets1_1.zip file is present in the correct path. To test the integrity of the file I can unzip it manually. The UN - zip seems to work without error.

    Try to run Photoshop then fails with components not found.

    It seems that many people have similar problems. Solutions or workarounds?

    Yet once, responding to my own post. Success! [But not sure exactly why...] kglad and Brucgovn suggestions were helpful. Thank you! Repair or reinstall all Microsoft Visual C++ Redistributable helped some.

    Finally, in desperation, I removed everything even vaguely smell of "Adobe,"[not including the Acrobat documents.]" It's all applications, services, nothing in the folder AppData Local or roaming Adobe and the C:\Users\Misha\AppData\Local\Temp\{708A6B05-0886-43ED-9EB0-A6E346EE3A1F} file. It takes re-start to remove already running services.

    Then, I have upgraded from Windows 7 to Windows 10. Not sure it was necessary, but it must do it anyway.

    Then reinstalled AdobeAIR, ensuring well run Setup in administrator mode.

    Then re-installed Creative Cloud desktop application, again doing some fashion Admin CC app asks user name and password, and goes to the application install a window immediately.

    Properly installed Photoshop.

    Properly installed Lightroom.

    Launch of the Photoshop and Lightroom.

    Seven log files are created:

    12/03/2016-15:32 14 457 adobe Active Export 2 (64-bit) 2.4 12 - 03-2016.log
    12/03/2016-16:05 33 642 adobe Lightroom 6.0 03-12 - 2016.log
    12/03/2016-16:08 13 706 adobe Lightroom 6.4 03-12 - 2016.log
    12/03/2016-15:29 174 575 adobe Photoshop CC 2015 16.0 03-12 - 2016.log
    12/03/2016-15:34 Photoshop adobe 55 948 CC 2015 16.1.2 03-12 - 2016.log
    12/03/2016-15:36 Overview of 14 232 adobe CC 1.1.3 03-12 - 2016.log
    12/03/2016-15:37 25 083 Photoshop Camera Raw 8 9.4 03-12 - 2016.log

    I hope that these steps are not really necessary for all users, or it will take once again on each update, but I was getting desperate.

  • Where to write the condition in the design of workflows with conditional step?


    Hello

    Again, I wish BP and workflow with contitional design stage.

    I had designed BP and workflow.

    As directed by the user for Udesigner guide, I had added trigger before the condition step.

    But I do not understand where to set the Condition to test?

    If I need to write the condition in triggering elemt itsel... How to proceed?

    for example, I want to write the condition as cost of Tota > = 100000, it must follow a path and if fails to another path.

    The conditions of triggers are specified in the workflow settings.  After you have created a new configuration, open it and click on the settings tab.  You will see a tree structure of the workflow with conditional branches.  Click a conditional branch to set the parameters for the trigger for this route condition.

  • EIM Delete fails with the error SBL-EIM-00107: error ODBC 37000

    Hello

    When the execution of a removal of the EIM products, we encounter an error:

    Error: SBL-EIM-00107: error ODBC 37000: [Microsoft] [SQL Native Client] [SQL Server] DELETE failed because the following SET options have incorrect settings:
    «CONCAT_NULL_YIELDS_NULL, ANSI_WARNINGS» Verify that SET options are correct for use with indexed views or indexes on computed columns or the filtered index or query
    notifications or data XML type methods and/or spatial index operations.

    Can anyone help on this error?

    This work ran fine however on QA dev environment we receive this error.

    EIM table status "DELETED", but the current record not get deleted from the database.

    Hello

    Please check the display where we discovered this problem in a different context, the process of MRI

    MRI fails with the error "CREATE INDEX failed because the following SET options have incorrect settings: 'CONCAT_NULL_YIELDS_NULL, ANSI_WARNINGS'" (Doc ID 1619780.1)

    Please define

    the DB level settings. We do not know why SQL server is looking for these settings, maybe they are necessary from the point of view of SQL Server...

    CONCAT_NULL_YIELDS_NULL = WE

    ANSI_WARNINGS = WE

    They also changed the setting for the ODBC connection below

    Use ANSI null = values we

    fillings and warnings = WE

    Rerun EIM task after having defined meanings.

    Thank you

    Maddox.

  • RMAN recovery failed with the incarnation of target of error 03002,11003 and recovery 19906 changed during recovery

    Hi all

    I was cloning a Prod DB (Oracle 10.2.0.5) from tape backup. So the cloning is going on it failed with the below error in RMAN:

    archive log thread = 2 sequence 23044 = filename=+DG_zeus_FRA_01/zeus/archivelog/2014_05_23/thread_2_seq_23044.3558.848348137

    output channel: ch01

    output channel: ch02

    output channel: ch03

    RMAN-00571: ===========================================================

    RMAN-00569: = ERROR MESSAGE STACK FOLLOWS =.

    RMAN-00571: ===========================================================

    RMAN-03002: failure of Db in dual at 23/05/2014 20:15:48

    RMAN-03015: an error has occurred in the script stored memory Script

    ORA-00283: cool cancelled due to errors

    RMAN-11003: failure in parsing / execution of the SQL statement: alter database recover logfile ' +DG_zeus_FRA_01/zeus/archivelog/2014_05_23/thread_2_seq_23044.3558.84

    8348137'

    ORA-00283: cool cancelled due to errors

    ORA-19906: embodiment of changed during recovery recovery targets

    Any possible solution to the resume and cloning complete successfully?

    Kind regards

    Ritu

    incarnation of the list;

    It listed 2 incarnation. I have reset the previous incarnation

    RESET DATABASE TO INCARNATION 2;

    and recovered again and it solved my problem.

    After that added temp files as usual after failing RMAN duplication;

    After this nest of DB and open reset logs.

  • join with condition

    Hi all

    Is there a possible way to cross the join with condition?

    I want something like this:

    Table A: custid, accu_id, sum

    CustID, accu_id unique =

    CustomerID amount accu_id

    10 25 400

    10 35 447

    10 29 420

    20 30 510

    30 35 472

    .

    .

    .

    Table b: accu_id, description

    accu_id description

    shoes 25

    Book 29

    30 computer

    pen 35

    Note: in table A, it is a mismatch of the accu_id values that do not use. Please, take into account this.

    I want to see all the columns in the TABLE B for each custid in A. TABLE (something like cross join but with ONE article.) The following query does not work.

    Select * from a right join B on A.accu_id = B.accu_id;

    10-25

    10-29

    10-30

    10-35

    20-25

    20-29

    20-30

    20-35

    30 25

    30 29

    30 30

    30-35

    What should I do for this?

    Thanks in advance

    Use partition outer join:

    with a (too)

    Select double union all 10 custid, accu_id 25, amount 400

    Select 10,35,447 from all the double union

    Select 10,29,420 from all the double union

    Select 20,30,510 from all the double union

    Select double 30,35,472

    ),

    b like)

    Select accu_id 25, "shoe" description of all the double union

    Select 29, 'book' from dual union all

    Select 30, 'computer' from dual union all

    Select 35, 'pen' from dual

    )

    Select a.custid,

    a.accu_id,

    a.amount,

    b.

    a

    by (a.custid) partition

    right join

    b

    On a.accu_id = b.accu_id

    order of a.custid,

    a.accu_id

    /

    AMOUNT ACCU_ID CUSTID DESCRIPT
    ---------- ---------- ---------- --------
    10 25 400 shoe
    10 29 420 book
    10 35 447 pen
    10 computer
    20 30 510 computer
    shoe 20
    book 20
    20                       pen
    30 35 472 pen
    30 shoe
    30 book

    AMOUNT ACCU_ID CUSTID DESCRIPT
    ---------- ---------- ---------- --------
    30 computer

    12 selected lines.

    SQL >

    SY.

  • Procedure failed with ORA-01403, associated with immediate execution, captured

    This procedure compiles without error. Its purpose is to copy the sequence of one schema to another object. After it failed with ORA-01403, I added exception code of capture (see the comments in the code).

    A few notes:

    1. I started the proceedings with exec copy_sequence ('ADDRESS_SEQ', 'SST', 'TEST1');

    2. the first sql string is built correctly since I can see in the console output:

    Select last_number in the all_sequences where sequence_owner = upper('TSS') and upper('ADDRESS_SEQ') = sequence_name

    I can run this SQL command, and returns a real value;

    Here is the procedure

    SET SERVEROUTPUT ON;

    create or replace procedure copy_sequence (seq VARCHAR2, prod_schema VARCHAR2, VARCHAR2 test_schema)

    as

    Val number (21);

    s_sql varchar2 (200);

    Start

    s_sql: = ' select last_number in the all_sequences where sequence_owner = upper('''|| prod_schema ||'') ') and sequence_name = upper('''||) Seq | " ')';

    -immediate' select last_number in the Vale of all_sequences where sequence_owner = upper('''|| prod_schema ||'') ') and sequence_name = upper('''||) Seq | " ')';

    Dbms_output.put_line ('sql 1 ' | s_sql);

    execute immediate s_sql in val;  ---!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! The code does not work here!

    Dbms_output.put_line ('val' |) Val);

    s_sql: = 'delete the sequence'. test_schema |'. ' || FF.;

    Dbms_output.put_line ('sql 2 ' | s_sql);

    -execution immediate s_sql;

    s_sql: = 'create the sequence'. test_schema |'. ' || Seq |' minvalue maxvalue 1 999999999999999999999 begin by ' | Val | 'increment of 1';

    Dbms_output.put_line ('sql 3 ' | s_sql);

    -execution immediate s_sql;

    -Add the following after procedure thown ORA-01403: no data found

    exception when TOO_MANY_ROWS then DBMS_OUTPUT.put_line ('TOO_MANY_ROWS error');

    When NO_DATA_FOUND then DBMS_OUTPUT.put_line ('error NO_DATA_FOUND');

    While some other then raise_application_error (-20011, "Unknown Exception in this procedure");

    end;

    /

    Hoek wrote:

    The user (no SYSTEM, SYS, and SYSTEM are special, you should not use them unless you have TO) execution of the procedure must have the necessary privileges granted directly, bypassing a role...

    ??? There is nothing special about SYS or SYSTEM in what concerns them stored procedures. SYS by default is granted directly SELECT ANY SEQUENCE, so it does not work for the owner of MS by SYS. SYSTEM is therefore not:

    Scott@pdborcl12 > create sequence s;

    Order of creation.

    Scott@pdborcl12 > create or replace
    2 procedure system.p1
    3 is
    number of v_last_value 4;
    5. start
    6. Select last_number
    7 in v_last_value
    8 of all_sequences
    9 where sequence_owner = 'SCOTT '.
    10 and s = sequence_name ';
    11 end;
    12.

    Created procedure.

    Scott@pdborcl12 > system.p1 exec.
    BEGIN system.p1; END;

    *
    ERROR on line 1:
    ORA-01403: no data found
    ORA-06512: at "SYSTEM. "P1", line 5
    ORA-06512: at line 1

    Scott@pdborcl12 > grant select on s to the system;

    Grant succeeded.

    Scott@pdborcl12 > system.p1 exec.

    PL/SQL procedure successfully completed.

    Scott@pdborcl12 >

    SY.

  • How to avoid duplicates on a column with condition

    Hi all

    I need some advice here. At work, we have an Oracle APEX application that allow the user to add new records with the decision of the increment automatic number based on the year and the group name.

    Said that if they add the first record, group name AA, for 2012, they get the decision number AA 1 2013 as their record casein displayed page of the report.

    The second record of AA in 2013 will be AA 2 2013.

    If we add about 20 records, it will be AA 20 2013.

    The first record for 2014 will be AA 1 2014.

    However, recently, we get a claim of the user on two files of the same name of group have the same number of the decision.

    When I looked in the history table and find that the time gap between 2 record is about 0.1 seconds.

    In addition, we have the correspondence table which allows the user admin update the sequence number start with the restraint that it must be greater than the maximum number of the current name of the current year.

    This boot sequence number and the name of the group is stored together in a table.

    And in some other case, the user can add a decision duplicate for related record number. (this is a new feature)

    The current logic of the procedure to add the new record on the application are

    _Get max record table with selected group name (decision_number) and the current year.

    _INSERT in the folder table the new record came with the decision to number + 1

    _ update sequence number of the number of the decision just added.

    So instead of utitlising the process of editing the built-in automatic table of the APEX, I write a procedure that combine all three processes.

    I have run some loop for continually perform this procedure, and it seems that it can generate autotically new decision unique number with time about 0.1 second difference.

    However, when I increase the number of entry to 200 and let two users run 100 each.

    If the time gap is about 0.01 second, double decision numbers are displayed.

    What can I do to prevent duplicate?

    I can't just apply a unique constraint here for three columns with condition because it can be duplicated in some special conditions. I don't know much about the use of lock and its impact.

    This is the content of my procedure

    create or replace

    PROCEDURE add_new_case)

    -ID just use the trigger

    p_case_title IN varchar2,

    p_year IN varchar2,

    p_group_name IN VARCHAR2,

    -decisionnumber here

    p_case_file_number IN VARCHAR2,

    -active

    p_user in VARCHAR2

    )

    AS

    NUMBER default_value;

    caseCount NUMBER;

    seqNumber NUMBER;

    previousDecisionNumber NUMBER;

    BEGIN

    -execution immediate q '[alter session set nls_date_format = "dd/mm/yyyy"]';

    SELECT count (*)

    IN caseCount

    OF CASE_RECORD

    WHERE GROUP_ABBR = p_group_name

    AND to_number (to_char (create_date, "yyyy")) = to_number (to_char (date_utils.get_current_date, "yyyy"));

    SELECT max (decision_number)

    IN previousDecisionNumber

    OF CASE_RECORD

    WHERE GROUP_ABBR = p_group_name

    AND to_number (to_char (create_date, "yyyy")) = to_number (to_char (date_utils.get_current_date, "yyyy"));

    IF p_group_name IS NULL

    THEN seqNumber: = 0;

    ON THE OTHER

    SELECT Seq_number INTO seqNumber FROM GROUP_LOOKUP WHERE ABBREVIATION = p_group_name;

    END IF;

    IF caseCount > 0 THEN

    default_value: largest = (seqNumber, previousdecisionnumber) + 1;

    ON THE OTHER

    default_value: = 1;

    END IF;

    INSERT INTO CASE_RECORD (case_title, decision_year, GROUP_ABBR, decision_number, case_file_number, active_yn, created_by, create_date)

    VALUES (p_case_title, p_year, p_group_name, default_value, p_case_file_number, 'Y', p_user, sysdate);

    -Need to update the sequence here also

    UPDATE GROUP_LOOKUP

    SET SEQ_NUMBER = default_value

    WHERE the ABBREVIATION = p_group_name;

    COMMIT;

    EXCEPTION

    WHILE OTHERS THEN

    Logger.Error (p_message_text = > SQLERRM)

    , p_message_code = > SQLCODE

    , p_stack_trace = > dbms_utility.format_error_backtrace

    );

    LIFT;

    END;

    Many thanks in advance,

    Ann

    It's easier to solve for the case, while p_group_name is not null. In this case, you update a GROUP_LOOKUP line, so that you can select to update this line at the beginning, to prevent cases of two for the same group added at the same time. To do this, change the selection of GROUP_LOOKUP to:

    SELECT Seq_number INTO seqNumber FROM GROUP_LOOKUP WHERE ABBREVIATION = p_group_name for an updated VERSION OF the SEQ_NUMBER;

    and move this to be the first thing that did the procedure - before it has CASE_RECORD lines.

    In the case when p_group_name is set to null, you have some object to be locked. I think the best you can do is to lock the entire table GROUP_LOOKUP:

    the table lock in exclusive mode GROUP_LOOKUP wait 100;

    The '100 expectation' means that he will wait until 100 seconds before giving up and trigger an error. in practice, that is expected to only wait a moment.

    Exclusive mode allows others to read, but not to update the table.

    UPDATES and the LOCK of the TABLE will be updates of other sessions wait for this transaction to validate. Queries from other sessions are not affected.

    The locks are released when you commit or roll back.

  • OEM 12.1.0.3 Setup fails with ora-01017

    Greetings,

    I'm trying to upgrade my OEM 12.1.0.1 installation at 12.1.0.3. I'm following the instructions in the Oracle Enterprise Manager Cloud control Upgrade Guide and Support Oracle Note 1568143.1. I checked that all the prerequisites are met and have installed patch 11061801 in the repository. The repository and WHO are on different computers. The 12.1.0.1 installation is able to connect to the repository, it worked successfully for some time now. On the SGD server, quit the SGC and Agent and I invoke the 12.1.0.3 installation program. I followed the steps and when it gets to the login page, it fails with ORA-01017. Messages are displayed -

    1. check if the SYS password you have entered is valid.

    2. check if the REMOTE_LOGIN_PASSWORDFILE database initialization parameter is set to either shared or Exclusive.

    3. check whether a file with the file name orapw < SID > password exists in the < ORACLE_HOME > / dbs directory.

    All the conditions are met:

    -bash-3, $ 2 echo $ORACLE_SID

    oemrepos

    SQL > connect sys as sysdba

    Enter the password:

    Connected.

    SQL > connect sysman

    Enter the password:

    Connected.

    SQL > show parameter remote_login_passwordfile

    VALUE OF TYPE NAME

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

    Remote_login_passwordfile string EXCLUSIVE

    -bash-3, $ 2 ls-l $ORACLE_HOME/dbs/orapwoemrepos

    -rw - r - 1 oracle dba 1536 January 30, 2013 /usr/local/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/orapwoemrepos

    I am able to connect remotely from another machine. sqlplus is not installed on the SGD server.

    I am completely confused and need help. Web search indicates only that I need to make sure that the conditions listed above must be met, they are. If anyone has any suggestions I would appreciate the help.

    Thank you.

    Bill Wagman

    The problem has been resolved by recreating the password file. I used the same password. I don't understand yet why however.

    Thank you

    Bill Wagman

Maybe you are looking for

  • Why iTunes automatically 'check' all my purchased songs?

    After recently updated to 12.3.2.35 and subsequently sign with my apple ID to download their new album, all of a sudden ALL my never purchased pieces were marked as checked and started to copy on my iPhone. I had carefully unchecked several of these

  • G7-2235dx - memory Slot defective/made not climb in memory Slot

    Recently I bought a package of 4 GB of DDR3 1600 PC3 12800 for my laptop. I received it today and progressed to install after the direcitons given to the user of my laptop manual. But never well switched memory. It seems that the retention clips are

  • Compaq Presario CQ60 - how to reset the bios password?

    Mr President. My compaq presario cq 60 I forgot the bios password (Administrator password enter?). After 3 attempts I got a code 63186857 please help me.

  • 8500 printer using ink because of the constant print alignment

    Did someone had problems with a printer HP 8500 constantly try to align the print heads?  It's the printer of the worst I have ever owned, not quite 2 years old and the ink is extremely expensive, it would be more profitable to the trash, and by a ne

  • Oracle Enterprise Manager 12 c + Postgresql plugin

    Hello guys,.We would like to install OEM on several servers with the plugin for monitoring Postgres.Our question is, is - legal - do we need pay any type of OEM license, or it is a free software that we can install anywhere.Just for the record, we do