Script: SQL UPDATE

Hi all

Im trying to send a simple update (delete), but Im getting errors constantly. It seems to me that the ' are the problem, but I don't know how I can send these settings thru - that I have to pass the name of the location. Or maybe its something else...

Script:

Query = "" "delete from tdata_temp4 where partname = '?'. » » »

params = [["LOCATION"] fdmContext]

print fdmAPI.executeDML (query, params, False)

fdmAPI.commitTransaction)

Error:

2015-06-19 19:58:02, 115 MORTALS [AIF]: error in Comm.executeJythonScript

Traceback (most recent call changed):

File '< string >", line 524, executeJythonScript

File "D:\FDMEE\/data/scripts/custom/asdsad.py", line 3, in < module >

print fdmAPI.executeDML (query, params, False)

SQLException: java.sql.SQLException: [FMWGEN] [SQLServer JDBC Driver] Invalid parameter bindings.

2015-06-19 19:58:02, 122 FATAL [AIF]: error in CommProcess.executeCustomScript

Traceback (most recent call changed):

File '< string >", line 59, in executeCustomScript

File '< string >", line 482, executeCustomScript

File '< string >", line 524, executeJythonScript

File "D:\FDMEE\/data/scripts/custom/asdsad.py", line 3, in < module >

print fdmAPI.executeDML (query, params, False)

SQLException: java.sql.SQLException: [FMWGEN] [SQLServer JDBC Driver] Invalid parameter bindings.

2015-06-19 19:58:02, 180 FATAL [AIF]: COMM error run a custom Script

Thank you in advance!

Vuk

Hello

you don't need quotes to place parameters in parameterized queries Jython.

Query = "" "delete from tdata_temp4 where partname =?" » »

params = [["LOCATION"] fdmContext]

print fdmAPI.executeDML (query, params, False)

fdmAPI.commitTransaction)

Tags: Business Intelligence

Similar Questions

  • Run scripts to update for W_DAY_D


    Hi all

    I have a requirement where I have to table update W_DAY_D after completing the workflow.

    I have 4 update scripts to update the table. I want to know how can I do it in the ADF.

    I saw the DAC options to run a stored procedure and the SQL query for a task should be created. But I don't know how I can do it.

    I tried to add 4 actions of different tasks for 4 update scripts to add to the last task running in the execution plan, but I'm not able to add more than one action to the task

    because it gives me error message saying

    Cant insert a new record with the same key of user already exists.

    Can someone please tell me what will be an easy way to do it.

    Any help would be really appreciated.

    Thanks in advance!

    Try to give a different name and try

  • When the download or installation of SQL update KB970892 on the Site to update, I get error 0x737D. I have Windows XP Professional Service Pack 3__

    When the download or installation of SQL update KB970892 on the Site to update, I get error 0x737D. I have Windows XP Professional Service Pack 3. I don't know how to solve this problem. Thank you.

    Hi torito63,

    Error 0X737D while updating Windows means that a previous update of Microsoft SQL server does not complete the installation.

    To complete the installation, follow the steps below:

    1. open programs and features by clicking on the Start button, clicking Control Panel, click programs, and then clicking programs and features.

    2. Select Microsoft SQL Server 2005 and then click on edit.

     3. from currently installed programs, select Microsoft SQL Server 2005 and then click on edit.

     4. in the selection of the components, select database engine and then click Next.

     5. in the maintenance of function, select database engine and then click Next.

     6. in the installation of Microsoft SQL Server 2005, click Next.

     7. in the System Configuration check, click Next.

     8. change or remove an Instance, click on complete the suspended installation.

     9. by error and usage report settings, click Next.

     10. in the ready to update, click on install.

     11. in the course of a configuration, click Next.

     12. click on finish.

     For more information, read the messages in the thread titled I get the 737D error code when you try to install the update for SQL Server 2005 Service Pack 3 (KB970892) security. Any suggestions or should I not worry about installing this?

    http://social.answers.Microsoft.com/forums/en-us/vistawu/thread/40db346c-6439-4484-9589-c78b326f5056/

    Check if it works for you. Post back and we do know.

    Kind regards

    Shinmila H - Microsoft Support

    Visit our Microsoft answers feedback Forum and let us know what you think

  • How to convert the next update of FORALL to run the SQL UPDATE statement

    I have a FORALL loop for updating a table. It takes too much time. I want to rewrite the code to a direct sql UPDATE. Also of other tips or tricks that can help to run the fastest proc?
    CURSOR cur_bst_tm IS
    SELECT listagg(tm, ' ') WITHIN GROUP(ORDER BY con_addr_id) best_time,
           con_addr_id
       FROM   (select Trim(Upper(con_addr_id)) con_addr_id,
                      '&'
                      ||decode(Initcap(start_day), 
                                      'Monday', 'm',
                                    'Tuesday', 'tu',
                                    'Wednesday', 'w',
                                    'Thursday', 'th',
                                    'Friday', 'f',
                                     Initcap(start_day))
                      ||'='
                      ||trunc(( ( TO_DATE(start_tm,'HH12:MI:SS PM') - trunc(TO_DATE(start_tm,'HH12:MI:SS PM')) ) * 24 * 60 ))
                      ||','
                      ||trunc(( ( TO_DATE(end_tm,'HH12:MI:SS PM') - trunc(TO_DATE(end_tm,'HH12:MI:SS PM')) ) * 24 * 60 )) tm
               FROM   (SELECT DISTINCT * FROM ODS_IDL_EDGE_OFFC_BST_TM)
                 WHERE con_addr_id is not null)
      GROUP  BY con_addr_id
      ORDER BY con_addr_id;
    
    TYPE ARRAY IS TABLE OF cur_bst_tm%ROWTYPE;
    l_data ARRAY;
    
    
    BEGIN
    
     OPEN cur_bst_tm;
        
         LOOP
        FETCH cur_bst_tm BULK COLLECT INTO l_data LIMIT 1000;
    
        FORALL i IN 1..l_data.COUNT
      
          UPDATE ODS_CONTACTS_ADDR tgt
          SET best_times = l_data(i).best_time,
          ODW_UPD_BY = 'IDL - MASS MARKET',
           ODW_UPD_DT = SYSDATE,
          ODW_UPD_BATCH_ID = '0'
          WHERE Upper(edge_id) = l_data(i).con_addr_id
           AND EXISTS (SELECT 1 FROM ods_idl_edge_cont_xref src
                       WHERE tgt.contacts_odw_id = src.contacts_odw_id
                          AND src.pc_flg='Y')   
           ;       
    
        EXIT WHEN cur_bst_tm%NOTFOUND;
        END LOOP;
         
      CLOSE cur_bst_tm;
    Record count: -.

    Select count (*) from
    ODS_IDL_EDGE_OFFC_BST_TM;
    140 000

    SELECT count (*)
    Ods_idl_edge_cont_xref SRC
    WHERE src.pc_flg = 'Y';
    118 000

    SELECT count (*)
    OF ODS_CONTACTS_ADDR;
    671 925

    Version of database 11g.

    Execution plan for update:
    Operation object name lines cost/output PStart PStop object node bytes

    Mode of UPDATE STATEMENT Optimizer = ALL_ROWS 6 K 8120
    UPDATE ODW_OWN2. ODS_CONTACTS_ADDR
    SEMI 6 K 256 K 8120 HASH JOIN
    TABLE ACCESS FULL ODW_OWN2. ODS_CONTACTS_ADDR 6 K 203 K 7181
    TABLE ACCESS FULL ODW_OWN2. ODS_IDL_EDGE_CONT_XREF K 118 922 K 938

    Edited by: user10566312 May 14, 2012 01:07
  • SQL update statement executed or not?

    I have a sql update stmt.

    How can I know if the recording has updated or not, without cross-checking records?

    Thank you

    Use cursor attribute % number of LINES:

    SQL> begin
      2      update emp set sal = sal + 1000;
      3      dbms_output.put_line(sql%rowcount || ' rows were updated.');
      4  end;
      5  /
    14 rows were updated.
    
    PL/SQL procedure successfully completed.
    
    SQL> 
    

    SY.

  • Updates using the single SQL Update statement.

    Hi guys,.

    I got an interview... and was not able to answer a question.

    In view of the table emp... need to update the salary with the following requirement by using an SQL statement.

    1 update salary + 1000 for employees who receive pay between 500 and 1000
    2 update salary + 500 for employees who receive wages between 1001 and 1500

    The two above the requirement should be made using only a SQL update statement... can someone tell me how to do?
    update emp
      set salary   = case when salary between 500 and 1000
                                then salary + 1000
                                when salary between 1001 and 1500
                                then salary + 500
                          end;
    

    Concerning
    Arun

  • Use a script to update the MaxL substitution variables

    We use the Essbase 11.1.1 version. Can we use MaxL script for updating the substitution variables rather than using the EAS web console? We want to put the MaxL script in a batch file and plan its Windows scheduled task.

    Thanks for your help!

    Hello-

    Yes. Here is an example of script maxl-

    connection "Hypadmin" "#" on myessbaseserver.
    spool to 'mymaxl.log ';

    / * Definition of the substitution variable * /.
    ALTER database appname.databasename set variable "CurMonth" "August";

    variable display;

    spool off;
    Disconnection;
    Exit;

    You can call this maxl from a batch file at the request of windows scheduled task.

    Concerning

  • SQL update the context field to table oe_order_lines_all

    Hello

    Can update us the context field on the order line table using sql update. Can someone please let me know, what would this cause.

    I use the same context values that are defined in the form of DFF, but one of the value is missing from the FDF form. What is the next step?

    Example:

    Update oe_order_lines_all
    Set frame = (select...), attribut1 = 'test '.
    where header_id = 1101

    Hello

    Consult the following document and see if it helps.

    Note: 746787.1 - process of PLC control in the management of order- UPDATE operation
    https://metalink2.Oracle.com/MetaLink/PLSQL/ml2_documents.showDocument?p_database_id=not&P_ID=746787.1

    Kind regards
    Hussein

  • SQL script to update the Peoplesoft database information

    Hi all

    I'm a new DBA for a charity running both PS financials & HR which often must create test, training and instances of dev of our production environments. Doing so currently requires a number of manual steps to update the different nodes and paths to those required for the new instance, and naturally I did not become a DBA to do manual work ;-)

    I'm looking for these steps, but the schema PS script being what it is, I'm not having much joy to find where relevant data could be. If someone had a script to do something similar, or could point me in the direction of the tables, I would be extremely grateful. The kind of things that we currently do through the interface are:

    PeopleTools > Integration Broker > Configuration of integration > nodes
    PeopleTools > Security > security objects > Single Sign-on
    PeopleTools > Public Services > Administration > URL
    PeopleTools > Integration Broker > Configuration > Quick Setup > Integration Broker areas
    PeopleTools > Portal > node definitions
    PeopleTools > the Ren Server Configuration > Ren Server Cluster

    We are currently running MS SQL Server, but all the PL SQL scripts would be great - I just need to know what are the tables contain the data.

    Thank you very much


    Andy

    Well, it is very dependent on version Peopletools.
    An easy way might be to open the corresponding page that you speak, and then display the definition of page and the associated record. At least that is what I use to do.
    Then, update you the table background and see if she takes your new values.

    To be brief, here is an excerpt of these tables (non-exhaustive list, PT.48):
    Node of single sign - we built: pstrustnodes
    Scheduler process definition: ps_serverdefn
    Run the command: psprcsruncntl
    Message channels: pschnldefn
    The e-mail table of contents: psapmsgpub *, psapmsgsub *, psapmsgarc *.
    Definition of message node: psmsgnodedefn
    URL: psurldefn
    Definition of employment: ps_prcsjobdefn
    OPRID (e-mail address): psoprdefn
    ...

    Then fill out your own list with the method that I gave above.

    Nicolas.

  • call scripts sql from a trigger

    I use Oracle Data Miner 11 g in Windows 8. I want to create a trigger that will instantiate some sql scripts when it is executed (that is, whenever I try to insert update a record)
    Relaxation where will call sql scripts. The whole purpose of this is to make some process when I add tuple in the table. Can someone please help me with the correct syntax for it?
    Thank you! ~

    I'm doing some data on my set of data mining techniques. I want to run the data mining process every time I add a new tuple (i.e. record) or update.  For the data extraction process, a script is called that makes data mining and stores the result in a table. That's why I came up with a solution to trigger which in my opinion; would be the perfect way to launch the script and perform the tasks of trigger (on the infeed table) too. The goal is to automate the script to data mining.  Here's my clear understanding?

    No - your 'understanding' is NOT clear or correct.

    1. a trigger runs as PART of a transaction. It was NOT what happens in the trigger and my never be, committed in the database.

    2. that means that the session LIKE NO other can see that data and a script will not be able to access these data until it was committed.

    3. a trigger and the transaction can be rolled back and restarted several times, or can be rollbacked and terminated without a commit never happening.

    4. If all the data your script would be given mine must already exist in the database BEFORE your races and even trigger.

    So these scripts must be a completely separate WORK that run AFTER any validation occurs and the data you want to "mine" actually exist.

    NONE of this is appropriate to be initialized by a trigger, because as I said above, the relaxing activity may not even engaged.

    You must create some PL/SQL (or other) code that controls the steps that must be taken

    1 insert/update data - including your stuff to trigger if there is

    2 validate this transaction

    3 run a DBMS_SCHEDULER job to run if necessary batch files/scripts.

  • How to stop double click on registration in a SQL update

    I have a banner server where an end user clicks on a banner, the link goes to my CLK redirection script. CFM, this page records the clicks in the SQL dbase and then there a CFLOCATION to redirect the user to the appropriate web site.

    The problem I see is that when there is a delay between the 3rd party site that the end user is clicking several times and it's actually recording several clicks in the database

    I tried to write a simple code where the page that displays the banner sets a = session.click "1 session variable", and then when they hit the CLK page I check the value of session.click, if it is empty I have not update SQL, just go directly to the CFLOCATION, but if there is a value of 1 update the database and then I put session.click vacuum " , so in theory a single click should never record, but even with the longer time the CFLOCATION will always do its thing.

    Yet after all that, I still see multiple clicks, and the timestamp shows they occur less than one second or or less than the other, then this is definitely a press several.

    Anyone has an idea why my approach above may not work, and what can I do to stop this?

    Thank you

    Mark

    ACS LLC wrote:

    I have it.

    I actually put it on the CFM page that pulled into the model so that the entire page was covered, not sure if that causes any problems, but so far it seems actually to have done the trick! I keep an close eye on it

    So basically all that changes the session.click anyway, I should have the lock autour. I had also cflock was part of the page, that aside the last command to the click CLK CFLOCATION.

    I'll give it 24 hours and see if it pans, and if so maybe I'll try the less CFLOCK d code to see if it still work

    Nice to hear he has so far. I experiment with some quickfire double and triple clicking. Good luck.

  • SQL update does not

    Hello

    I'm trying to update my database with the following code, but although the code runs without a doubt because he can't seem to echo on the line before the update, the database is not updated.

    If ($totalRows_rsportsale > '0') {}
    $_POST ['dpaid'] = 1;
    $_POST ['listedby'] = $row_rsportid ["listedid"];
    echo ' dpaid is: '. $_POST ['dpaid']. ' < br / > ';
    echo ' listedby is: '. $_POST ['listedby"]. ' < br / > ';
    $updateSQL = sprintf ("UPDATE detailstable SET dpaid = WHERE listedby %s is %s",
    GetSQLValueString ($_POST ['listedby'], "int").
    GetSQLValueString ($_POST ['dpaid'], "int"));

    @mysql_select_db ($database_connUpdate, $connUpdate);
    $Result1 = mysql_query ($updateSQL, $connUpdate) or die (mysql_error ());
    }

    I want to update the database values actually echo right before the update script, so the values are correct for dpaid and listedby, I entered the ILO code was updated in the SQL myphp admin and that updates the database. The connection to the database connUpdate is correct. The two fields are of type "int" in the database and are not primary or unique keys. Any suggestions as to why this update does not work would be very appreciated.

    Thank you in advance.

    No, I don't mean the order of SQL clauses, I mean the order of the two settings that you use.

    $updateSQL = sprintf ("UPDATE detailstable SET dpaid = WHERE listedby %s is %s",
    GetSQLValueString ($_POST ['listedby'], "int").
    GetSQLValueString ($_POST ['dpaid'], "int"));

    As I said, I don't know PHP or sprintf command, but I guess that it replaces the parameters (%s) in the order that they appear. Your (listedby and dpaid) SQL statement parameters are in reverse order. Try to change them.

    $updateSQL = sprintf ("UPDATE detailstable SET dpaid = WHERE listedby %s is %s",
    GetSQLValueString ($_POST ['dpaid'], "int")).

    GetSQLValueString ($_POST ['listedby'], "int");

  • Complex SQL update

    Oracle Version: 10g

    I'm writing an update statement, based on the string of elements. The table contains around 2 M disks. Any help build this SQL is appreciated. Thank you!

    The elements in the array will not be in order. Just use this as an example...

    ItemNo1 changed to ItemNo2
    ItemNo4 changed to ItemNo3
    ItemNo5 changed to ItemNo2
    ItemNo6 changed to ItemNo7
    ItemNo7 changed to ItemNo8
    ItemNo2 changed to ItemNo3

    1, 2, 3, 6 documents should be updated as string agroalimentaire1 and documents 4 and 5 must be updated Chain2.

    Please see the scripts and the sample data below.
      CREATE TABLE "AVLTSB_SUB" 
       (     "CHAIN_ID" NUMBER NOT NULL ENABLE, 
         "ITM_NO" VARCHAR2(30 BYTE) NOT NULL ENABLE, 
         "SUB_ITM_NO" VARCHAR2(30 BYTE) NOT NULL ENABLE, 
         "UPD_TS" TIMESTAMP (6) DEFAULT SYSTIMESTAMP NOT NULL ENABLE, 
         "ORD_IND" NUMBER(*,0) DEFAULT 0 NOT NULL ENABLE, 
         "EFF_DT" DATE NOT NULL ENABLE, 
         "ONE_WY_IND" NUMBER(*,0) DEFAULT 0 NOT NULL ENABLE
       ) 
    
    
    Insert into AVLTSB_SUB (CHAIN_ID,ITM_NO,SUB_ITM_NO,UPD_TS,EFF_DT,ONE_WY_IND) values (0,'009009PM-120','009009PM-121',to_timestamp('22-JUL-10 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_date('22-JUL-10','DD-MON-RR'),1);
    Insert into AVLTSB_SUB (CHAIN_ID,ITM_NO,SUB_ITM_NO,UPD_TS,EFF_DT,ONE_WY_IND) values (0,'009009PM-121','009009PM-122',to_timestamp('22-JUL-10 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_date('22-JUL-10','DD-MON-RR'),0);
    Insert into AVLTSB_SUB (CHAIN_ID,ITM_NO,SUB_ITM_NO,UPD_TS,EFF_DT,ONE_WY_IND) values (0,'009009PM-123','009009PM-122',to_timestamp('22-JUL-10 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_date('22-JUL-10','DD-MON-RR'),1);
    Insert into AVLTSB_SUB (CHAIN_ID,ITM_NO,SUB_ITM_NO,UPD_TS,EFF_DT,ONE_WY_IND) values (0,'009009PM-124','009009PM-125',to_timestamp('22-JUL-10 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_date('22-JUL-10','DD-MON-RR'),1);
    Insert into AVLTSB_SUB (CHAIN_ID,ITM_NO,SUB_ITM_NO,UPD_TS,EFF_DT,ONE_WY_IND) values (0,'009009PM-125','009009PM-126',to_timestamp('22-JUL-10 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_date('22-JUL-10','DD-MON-RR'),1);
    Insert into AVLTSB_SUB (CHAIN_ID,ITM_NO,SUB_ITM_NO,UPD_TS,EFF_DT,ONE_WY_IND) values (0,'009009PM-126','009009PM-127',to_timestamp('22-JUL-10 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_date('22-JUL-10','DD-MON-RR'),0);
    Insert into AVLTSB_SUB (CHAIN_ID,ITM_NO,SUB_ITM_NO,UPD_TS,EFF_DT,ONE_WY_IND) values (0,'009009PM-127','009009PM-128',to_timestamp('28-JUL-10 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_date('28-JUL-10','DD-MON-RR'),1);
    Insert into AVLTSB_SUB (CHAIN_ID,ITM_NO,SUB_ITM_NO,UPD_TS,EFF_DT,ONE_WY_IND) values (0,'009009PM-128','009009PM-129',to_timestamp('28-JUL-10 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_date('28-JUL-10','DD-MON-RR'),1);
    Insert into AVLTSB_SUB (CHAIN_ID,ITM_NO,SUB_ITM_NO,UPD_TS,EFF_DT,ONE_WY_IND) values (0,'009009PM-130','009009PM-131',to_timestamp('28-JUL-10 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_date('28-JUL-10','DD-MON-RR'),0);
    Insert into AVLTSB_SUB (CHAIN_ID,ITM_NO,SUB_ITM_NO,UPD_TS,EFF_DT,ONE_WY_IND) values (0,'009009PM-131','009009PM-132',to_timestamp('28-JUL-10 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_date('28-JUL-10','DD-MON-RR'),1);
    Insert into AVLTSB_SUB (CHAIN_ID,ITM_NO,SUB_ITM_NO,UPD_TS,EFF_DT,ONE_WY_IND) values (0,'009009PM-132','009009PM-133',to_timestamp('28-JUL-10 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_date('28-JUL-10','DD-MON-RR'),1);
    Insert into AVLTSB_SUB (CHAIN_ID,ITM_NO,SUB_ITM_NO,UPD_TS,EFF_DT,ONE_WY_IND) values (0,'009009PM-134','009009PM-135',to_timestamp('28-JUL-10 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_date('28-JUL-10','DD-MON-RR'),1);
    Insert into AVLTSB_SUB (CHAIN_ID,ITM_NO,SUB_ITM_NO,UPD_TS,EFF_DT,ONE_WY_IND) values (0,'0030033-8602','0030033-8604',to_timestamp('22-JUL-10 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_date('22-JUL-10','DD-MON-RR'),1);
    
    Expected Output after updating the Chain_ID:
    
    select chain_id, itm_no, sub_itm_no from avltsb_sub
    
    1     009009PM-120     009009PM-121
    1     009009PM-121     009009PM-122
    1     009009PM-123     009009PM-122
    2     009009PM-124     009009PM-125
    2     009009PM-125     009009PM-126
    2     009009PM-126     009009PM-127
    2     009009PM-127     009009PM-128
    2     009009PM-128     009009PM-129
    4     009009PM-130     009009PM-131
    4     009009PM-131     009009PM-132
    4     009009PM-132     009009PM-133
    5     009009PM-134     009009PM-135
    6     0030033-8602     0030033-8604

    user13143312 wrote:
    There is a problem with documents where if a new item goes back to one of the old elements in the chain, he sees a new chain.

    OK, I've arranged ;-)

    select RootITM_NO,RootSUB_ITM_NO,
    dense_rank() over(order by min(ITM_NO),min(SUB_ITM_NO)) as rn
    from (select ITM_NO,SUB_ITM_NO,
          connect_by_root ITM_NO as RootITM_NO,
          connect_by_root SUB_ITM_NO as RootSUB_ITM_NO
            from "AVLTSB_SUB" a
          connect by nocycle prior SUB_ITM_NO in(ITM_NO,SUB_ITM_NO)
                          or prior ITM_NO     in(ITM_NO,SUB_ITM_NO))
    group by RootITM_NO,RootSUB_ITM_NO
    order by RootITM_NO,RootSUB_ITM_NO;
    
    ROOTITM_NO    ROOTSUB_ITM_NO  RN
    ------------  --------------  --
    0030033-8602  0030033-8604     1
    009009PM-120  009009PM-121     2
    009009PM-121  009009PM-122     2
    009009PM-123  009009PM-122     2
    009009PM-124  009009PM-125     3
    009009PM-125  009009PM-126     3
    009009PM-126  009009PM-127     3
    009009PM-127  009009PM-128     3
    009009PM-128  009009PM-129     3
    009009PM-130  009009PM-131     4
    009009PM-131  009009PM-132     4
    009009PM-132  009009PM-133     4
    009009PM-134  009009PM-135     5
    
  • SQL - update with joins

    My database contains several tables in a parent-child relationship (5 levels). Tables for children contain unique (foreign key) of the parents. I need to update a field in the table below level with a hardcoded value (for example: the value d.field3 = 103), but only on the rows that match certain general criteria. Criteria are set at different levels of the hierarchy. I tried several approaches, but in the end, I still get the same error:

    ORA-01779: cannot modify a column that is mapped to a table not preserved key

    So far, I tried the following:
    -create a view based on all joins (where b.fk = a.id etc.) and then write my update with the "filtering" query where clauses (for example: where b.field1 = 'abc' and c.field2 = 123... etc)
    -create a query of update (without creating a preliminary view) which contains in the 'where' clause all joins and clauses of filtering

    I am trying to adapt some scripts from SQL Server to Oracle, but nothing seems to work for this one. Your help is greatly appreciated.

    Thank you
    Alberto

    Something like:

    update CM_CRITERION_LINE_MASTER set function_id = 103
    where criterion_master_id in (
      SELECT CM_CRITERION_MASTER.criterion_master_id
      from CM_CRITERION_MASTER, CM_STATEMENT, CM_CRITERION, CM_RULE, CM_CASE
      where CM_CRITERION_MASTER.criterion_master_id = CM_CRITERION.criterion_master_id
        and CM_CRITERION.statement_id = CM_STATEMENT.statement_id
        and CM_STATEMENT.rule_id = CM_RULE.rule_id
        and CM_RULE.case_id=CM_CASE.case_id
        and CM_CASE.case_category_id=2
        and CM_CASE.case_id > 799999
        and CM_RULE.rule_category_id 9
        and CM_RULE.task_id in (102,108,112,113,114,123,116)
    )
      and CM_CRITERION_LINE_MASTER.function_id=11
    

    Of course, you need to test.

    Time to understand that SQL Server and Oracle, as well as other DBMS each differ :)

    Gints Plivna
    http://www.gplivna.EU

  • Script SQL Compact database in SQL Server 2008r2

    I am able to open the .sdf (SQL Compact Database) in Microsoft SQL Server 2008r2, but when I right click on the database, it won't let me preview the data, or the database script, so I can create a .mdf file

    This issue is beyond the scope of this site and must be placed on Technet or MSDN

    http://social.technet.Microsoft.com/forums/en-us/home

    http://social.msdn.Microsoft.com/forums/en-us/home

Maybe you are looking for