Convert Sybase update the query to Oracle PL/SQL

Hello
I have a Sybase query to update a table CRM_Report in another table r1 CRM_Report1, who do I migrate PL/SQL.

Update CRM_Report
Set LT_MMT = r1.LT_MMT, ST_MMT = r1. ST_MMT,
LT_FixedInc = r1.LT_FixedInc, ST_FixedInc is r1. ST_FixedInc,
LT_CrdCLN = r1.LT_CrdCLN, ST_CrdCLN is r1. ST_CrdCLN,
LT_Der = r1.LT_Der, ST_Der is r1. ST_Der,
LT_FX = r1.LT_FX, ST_FX is r1. ST_FX,
LT_CrdCDS = r1.LT_CrdCDS, ST_CrdCDS is r1. ST_CrdCDS
of CRM_Report1 r1
where r1. Location = CRM_Report.Location
and r1. CountriesGrp_Id = CRM_Report.CountriesGrp_Id
and r1. CountriesGrp_ShortName = CRM_Report.CountriesGrp_ShortName

I used Oracle SQL Developer for the application migration, but it doesn't seem to work

All of the Suggestions.

Dear bOrN_fReEsTyLeR!

Sybase:

update CRM_Report
set LT_MMT = r1.LT_MMT, ST_MMT = r1.ST_MMT,
LT_FixedInc = r1.LT_FixedInc, ST_FixedInc = r1.ST_FixedInc,
LT_CrdCLN = r1.LT_CrdCLN, ST_CrdCLN = r1.ST_CrdCLN,
LT_Der = r1.LT_Der, ST_Der = r1.ST_Der,
LT_FX = r1.LT_FX, ST_FX = r1.ST_FX,
LT_CrdCDS = r1.LT_CrdCDS, ST_CrdCDS = r1.ST_CrdCDS
from CRM_Report1 r1
where r1.Location = CRM_Report.Location
and r1.CountriesGrp_Id = CRM_Report.CountriesGrp_Id
and r1.CountriesGrp_ShortName = CRM_Report.CountriesGrp_ShortName 

Oracle:

UPDATE CRM_Report r
SET (LT_MMT, ST_MMT, LT_FixedInc, ST_FixedInc, LT_CrdCLN, ST_CrdCLN, LT_Der, ST_Der, LT_FX, ST_FX, LT_CrdCDS, ST_CrdCDS) =
  SELECT LT_MMT, ST_MMT, LT_FixedInc, ST_FixedInc, LT_CrdCLN, ST_CrdCLN, LT_Der, ST_Der, LT_FX, ST_FX, LT_CrdCDS, ST_CrdCDS
  FROM   CRM_Report1 r1)
  WHERE r1.Location = r.Location
     AND r1.CountriesGrp_Id = r.CountriesGrp_Id
     AND r1.CountriesGrp_ShortName = r.CountriesGrp_ShortName)

I have not tested but I think it will work.

Yours sincerely

Florian W.

Tags: Database

Similar Questions

  • Best practical Question - update the query (see object) based on the drop-down list selection

    I have a question about the most efficient way to perform the following task:

    I create a page that contains several DVT components to display data based on specific requests.  Top of page I am hoping to have a drop down menu (selectOneChoice) that contains dates different and based on what the user selects (i.e. 2010, 2011, 2012, 2013, etc.), this will update the query in the view object of some (i.s. WHERE Date = '2011', or WHERE Date = 2013"), and then you view the appropriate data in the DVT.  What is the best way to do this - from a point of view bean managed / page, as well as the View object?  Advice/documentation would be appreciated.

    Thank you!

    When you drag the vo executeWithParams one another that will create links for operations such as 'executeWithParams2', 'executeWithParams3 '. On the method that you use to update a view by calling the executeWithParams operation, you call the other operations too.

    Timo

  • How dynamically update the role of oracle using the trigger

    How dynamically update the role of oracle using the trigger:

    I have svmanger owner of schema in the database. There are five tables belonged to svmanager.

    Table A, B, C, D, E.

    I have a role that is played only to these tables under the scheme: SVMANAGER_READ_ONLY

    now, if I create a new table F under svmanager. the role that svmanager_read_only does not work is updated, so the user had assigned role cannot access table F.

    is there a way to create the trigger for this role dynamically update any when a table is created or deleted?

    Thank you.

    I really really really don't suggest to do this - it's a bad habit. If possible I'd just adding the grant as part of the steps to the role on the new creation of the table.
    But for fun here's how you can accomplish this:

    create or replace procedure execute_grant(v_ddl in varchar2)
    is
    begin
       execute immediate v_ddl;
    end;
    /
    
    create or replace trigger catch_create_table_trg after create on schema
    DECLARE
    
    ddl_job number;
    ddl_str varchar2(50);
    begin
       IF ora_dict_obj_type = 'TABLE' THEN
    
           ddl_str := 'GRANT SELECT ON '||ora_dict_obj_owner||'.'||ora_dict_obj_name||' TO SVMANAGER_READ_ONLY';
    
           dbms_job.submit(job => ddl_job,
           what => 'execute_grant(''' || ddl_str || ''');',
           next_date => sysdate+(5/24/60/60));
    
       END IF;
    end;
    /
    

    Test it

    create table F (id number(1));
    

    Validate

    select * from ROLE_TAB_PRIVS where ROLE = 'SVMANAGER_READ_ONLY';
    
  • Need to update the query

    Hi all

    I update a table using the loop... but its taking too much time.

    I think to update this table using the single update statement... How can I write a single update statement.

    Below you will find the updated my for loop:

    BEGIN

    for c4 to (select source_logo, news_sources a.channel_id, matched_news_industry a

    where s.channel_id = a.channel_id

    and a.newS_id in (select news_id was in gm_sector_activity_tracker where is_transferred = am' and news_type = "Report entry")

    and a.newS_type like '% reports '.

    and a.LOGO_SOURCE is null

    and a.channel_id not in (6522,6835,5395)

    and a.channel_id not in (select thomson_channel_id from si_portals)) loop

    Update matched_news_industry

    Set logo_source = c4.source_logo

    where channel_id = c4.channel_id;

    end loop;

    Total: = SQL % ROWCOUNT;

    IF Total = 0 THEN

    dbms_output.put_line (' no data updates in matched_news_industry - logo_source');

    ON THE OTHER

    dbms_output.put_line ('Total records updated in matched_news_industry - logo_source' |)

    In total);

    END IF;

    Total: = 0;

    EXCEPTION

    WHEN No_data_found THEN

    dbms_output.put_line ('zero immeasurably updated in matched_news_industry - logo_source');

    WHILE OTHERS THEN

    dbms_output.put_line (' there was an error updating data in matched_news_industry - logo_source');

    END;

    Thank you

    Try the query optimized below:

    Fusion in matched_news_industry one

    using news_sources c4

    on)

    a.channel_id = c4.channel_id

    and a.newS_id in (select news_id was in gm_sector_activity_tracker where is_transferred = am' and news_type = "Report entry")

    and a.newS_type like '% reports '.

    and a.LOGO_SOURCE is null

    and a.channel_id not in (6522,6835,5395)

    and a.channel_id not in (select thomson_channel_id from si_portals)

    )

    When matched then

    update set a.logo_source = c4.source_logo

  • pass the query to oracle

    Hi all

    How can I send a query to oracle using cfstoredprod?

    Try this:

    < datasource = "" #application.dsn # cfstoredproc "procedure =" #importTable #">"

    < cfprocparam type = 'in' cfsqltype = "cf_sql_refcursor" value = "#myQuery #" >

    < / cfstoredproc >

    The Oracle code:

    Procedure importTable (v_table IN SYS_REFCURSOR) is

    Error: [Oracle JDBC Driver] impossible to determine the type of the specified object.

    Any ideas?

    Thanks in advance.

    Get your drives and put them in a query object (if they aren't already), let's call it getRecs, and:

    
    INSERT ALL
       
          INTO schema.tableName(columnA, columnB, columnC, etc)
          VALUES (,,,)
       
       SELECT * FROM DUAL
    
    

    You must include the "SELECT * FROM DUAL" after the loop to exit.  Connect it to your database (Oracle), insert all the lines and disconnect.  Place it in a CFTRANSACTION tag to make sure that they are all inserted or all cancelled.

    HTH,

    ^_^

  • Sybase to the Migration of Oracle: issues of assignment of object names

    I'm migrating Sybase to Oracle databases. By default, the name of the schema that results is < owner > _ < dbname > (dbo_SALES). To change this, I'm following the example to migrate objects in an existing user, as described here: http://dermotoneill.blogspot.com/2012/03/migrate-to-existing-oracle-users.html

    The name of object change "DATABASE.dbo" to "DATABASE" - and it seems to work very well. The problem I have is that there are many references to the DATABASE... OBJECT that do not include "dbo", the owner of the object. These references seem to be replaced by dbo_DATABASE. Object.

    Is there a way I can add another rule to the object name to catch these references? I am OK the migration offline, but I'd like to avoid performing a find/replace massive.

    Other ideas would be appreciated!
    Kevin

    Hey Kevin,

    I played a bit with a few examples and I was able to reproduce your problem with dbo... conversion of object name.
    Looks like we are trying to guess the name of the target that we did not seize the owners of default database. Speculation works well, unless you specify the name of the target, as in your case.
    Using SQL Developer 3.2.2 there is no solution except the search and replace dbo_databasename in the build script, as you suggest.
    Sick, working on a better solution for the next release, if Developer SQL will guess 'dbo' as the user, then it may as well find the name of the specified target of the dbo instead to assume the default value of naming conversion.
    Thanks for the comments,

    Kind regards
    Dermot.
    SQL development team.

  • 2.1 EA1: Query Builder does not update the query to display the results

    When using the query designer, if you click view results to see the results of the current query, then return to "Select columns" or the tabs 'Create a Where Clause' change the query, the "View results" tab shows again the results of the original query, even if no tables or columns of the original query occurs. By clicking on the button run the report or by setting a refresh interval has no effect.

    On another note, the query designer again is not reentrant, because you cannot select (highlight a part where cursor in) a query, and then open the query for this request of change graphically Designer.

    Sentinel,

    The problem is known and is listed in the known issues in the release notes for the first users. We hope to have this sent to production.

    Returning Query Builder is always on our list of things to do. We intend to rewrite the Query Builder and examine a number of requests related to this function. I'm hoping to make it a priority for the next release.

    Sue

  • update the XML name by using sql

    Hello

    IAM using oracle 11g

    create table example (ch. clob);
    insert into a values (sample)
    ? XML version = "1.0"? (> < ABC > < company > < / ABC > < A employee > < name > < / name > < sex > M < / sex > < / employee > < employee > < name > B < / name > < sex > M < / sex > < / employee > < employee > < name > c < / name > < sex > F < / sex > < / employee > < / business > ');

    for example I want to update the 'ABC' to 'CDE' XML element

    ? XML version = "1.0"? (> < company > < ORDER > < / EBR > < A employee > < name > < / name > < sex > M < / sex > < / employee > < employee > < name > B < / name > < sex > M < / sex > < / employee > < employee > < name > c < / name > < sex > F < / sex > < / employee > < / company > ');


    How can I update this XML element name.

    I search the web, I found UPDATEXML it is used to change the value of XML. but I want to display xml name.

    Concerning
    Oracle user

    To start, if you want a pure XML solution, you should really use an XMLType column to store XML data in the first place.
    It allows several types of optimization takes place, according to the model of storage used.
    11 g, I highly recommend the use of binary XML storage (this is the default template from 11.2.0.2).

    IAM using oracle 11g

    What version exactly?

    On 11.2.0.3, you can use XQuery Update Facility:

    SQL> create table sample_data (doc xmltype);
    
    Table created
    
    SQL> insert into sample_data values (
      2  '
      3  
      4   
      5   AM
      6   BM
      7   cF
      8  ');
    
    1 row inserted
    
    SQL> commit;
    
    Commit complete
    
    SQL> set long 500
    SQL> select xmlserialize(document
      2           xmlquery(
      3            'copy $d := /Company
      4             modify rename node $d/ABC as "CDE"
      5             return $d'
      6            passing t.doc
      7            returning content
      8           )
      9           as clob indent
     10         )
     11  from sample_data t
     12  ;
    
    XMLSERIALIZE(DOCUMENTXMLQUERY(
    --------------------------------------------------------------------------------
    
      
      
        A
        M
      
      
        B
        M
      
      
        c
        F
      
    
     
    

    Other solutions of "XML" involve recursive or as mentioned XQuery, XSLT functions:

    SQL> SELECT XMLSerialize(DOCUMENT
      2    XMLTransform(
      3      t.doc
      4    , xmltype('
      5       
      6        
      7          
      8            
      9          
     10        
     11        
     12          
     13            
     14          
     15        
     16      ')
     17    )
     18    AS CLOB INDENT
     19  )
     20  FROM sample_data t
     21  ;
    
    XMLSERIALIZE(DOCUMENTXMLTRANSF
    --------------------------------------------------------------------------------
    
    
      
      
        A
        M
      
      
        B
        M
      
      
        c
        F
      
    
     
    
  • Window of the query editor with Microsoft SQL Server Management Studio DO NOT scroll

    In my view, that it is a question more of a Microsoft SQL Server Management Studio number... apologies if you think I might be in the wrong place of Windows...

    When you work in Microsoft SQL Server Management Studio, my cursor is common in my part of the query editor window. When I try using my scroll wheel it to review some SQL code, instead the scroll on my mouse wheel is controlling the pane objects in the Solution Explorer window and NOT the glass query editor.
    Some of our partners appear to be well with their ability to scroll using the mouse scroll wheel while others seem to be in the same boat I am, and nobody here seems to know why it is.
    I hope for some comments and I am hopeful for an answer. Thanks in advance.
    PSULionRP

    Hello

    The question you posted would be better suited to the TechNet community. Please visit the link below to find a community that will provide the support you want.

    http://social.technet.Microsoft.com/forums/Gu-in/sqldatawarehousing/threads

    Hope this information helps.

  • DB Link using the gateway to Oracle to SQL server 2005

    Hi all

    I am facing problems to configure the gateway for Oracle database to connect to SQL server, given below are details:

    Machine has
    ----------------
    OS = Windows server 2008 R2 64 bit
    DB = Oracle 10.2.0.5 64-bit

    content of C:\oracle\product\10.2.0\db_1\NETWORK\ADMIN\*tnsnames.ora*

    ORCL =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP) (HOST = WIN-G9TJ5GM2SAO)(PORT = 1521))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = orcl)
    )
    )

    dg4msql =
    (DESCRIPTION =
    (ADDRESS =
    (PROTOCOL = TCP)
    (HOST = 10.1.87.119)
    (PORT = 1521)
    )
    (CONNECT_DATA =
    (SID = dg4msql))
    (HS=OK))

    EXTPROC_CONNECTION_DATA =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = CIP)(KEY = EXTPROC1))
    )
    (CONNECT_DATA =
    (SID = PLSExtProc)
    (PRESENTATION = RO)
    )
    )

    Machine B
    ----------------
    OS = Windows Server 2003 32-bit
    DB = SQL Server 2005 32-bit
    Gateway = Gateway Oracle 11 g 32 bit

    Content of C:\product\11.2.0\tg_1\dg4msql\admin*\initdg4msql.ora*

    HS_FDS_CONNECT_INFO = localhost:1433 / / SDÉS
    HS_FDS_TRACE_LEVEL = OFF
    HS_FDS_RECOVERY_ACCOUNT = RECOVERY
    HS_FDS_RECOVERY_PWD = RECOVERY

    Content of C:\product\11.2.0\tg_1\NETWORK\ADMIN\*listener.ora*

    LISTENER =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP) (HOST = eZeePay-DB)(PORT = 1521))
    (ADDRESS = (PROTOCOL = CIP)(KEY = EXTPROC1521))
    )
    )

    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = dg4msql)
    (ORACLE_HOME = C:\product\11.2.0\tg_1)
    (PROGRAM = dg4msql)
    )
    )

    ADR_BASE_LISTENER = C:\product\11.2.0\tg_1

    On computer A, if I use TNSPING it gives below error

    C:\users\administrator > tnsping dg4msql

    AMT Ping Utility for 64-bit Windows: Version 10.2.0.5.0 - Production on 12-MAR-2
    012 11:44:12

    Copyright (c) 1997, 2010, Oracle. All rights reserved.

    Use settings files:
    C:\oracle\product\10.2.0\db_1\network\admin\sqlnet.ora

    AMT-03505: failed to resolve the name


    Please please help what's not in configurations!

    Best regards!

    Irfan

    Published by: irf_mas on March 12, 2012 12:47 AM

    Hello Irfan,
    As far as I can see the correct air configuration files, but you can check a few things-

    1. they may have been lost when posting in the forum, but can do you that there is a space at the beginning of each line in the tnsnames.ora and listener.ora except for the first line of each section-

    ORCL =

    dg4msql =

    EXTPROC_CONNECTION_DATA =

    LISTENER =

    SID_LIST_LISTENER =

    2. What is in the file sqlnet.ota on the computer has?

    3. host 10.1.87.119 is the machine eZeePay-DB?

    4 is the gateway listener began the eZeePay DB?

    Kind regards
    Mike

  • Sort of the differences between Oracle and SQL Server

    Hi all

    This question is linked by both Oracle and SQL Server

    I have a requirement where I want to compare 2 tables line by line. A table is in Oracle and other table in SQL Server

    And suppose that both tables do not have a primary key. Now when I sort records by using the order by clause for a column, then-

    Rows with null values in that column of Oracle are placed in the background.
    When that rows with null values in the same column in SQL Server are placed right at the top.

    How can I make one of them to behave like any other.

    My only goal is to have same order of lines in Oracle and SQL Server tables so that I can compare line by line.

    YADQ: Yet another Doc Question

    Can you please avoid them?

    Take your SQL reference manual, search for the ORDER BY clause and notice that it has
    NULL FIRST or LAST values NULL values.

    ------------
    Sybrand Bakker
    Senior Oracle DBA

  • Update the query using nulls update box

    I need to update a column according to the conditions that I've used below, the update query, I used is updated as well to null values. How can I stop this and keep the old values when no match was found for the case.
    create table sample (name varchar2(10),eno number(10),salary number(10));
    insert into sample (name,eno,salary) values ('emp1',1,100);
    insert into sample (name,eno,salary) values ('emp2',2,200);
    insert into sample (name,eno,salary) values ('emp3',3,300);
    select * from sample;
        
    update sample 
    set salary = 
    case when salary = 100 then 10000 else 
    case when salary = 150 then 15000 else 
    case when salary = 200 then 20000 end end end
    where name is not null;
           
    Actual o/p:
           emp1     1     10000
           emp2     2     20000
           emp3     3     
    
    Required o/p:
            emp1     1     10000
           emp2     2     20000
           emp3     3      300

    Hello

    The updated control WHERE clause lines.
    If you do not have a WHERE clause, then updates all rows in the table.

    update  sample
    set      salary = case
                          when salary = 100 then 10000
                   when salary = 150 then 15000
                   when salary = 200 then 20000
               end
    where   salary   IN (100, 150, 200)
    ;
    

    Note that you do not need to nest BOX icies expressions (or almost anywhere else). If the 'salary = 100' condition is true, then its correspondent WHEN the value is returned, and the remaining terms will not be evaluated. If the first condition is not true, then only will be the "salary = 150" condition to be evaluated. (The terms are mutually exclusive in this example anyway, so it does not matter.)

    Published by: Frank Kulash, June 5, 2012 13:09

  • Update the issue in Oracle ADF in JDeveloper

    Hi all

    My ADF application is to have around 350 forms. Application size is 700 MB. I am facing a problem of refreshment in this application. whenever I'm changing all requests in the view of the objects or research it is not reflecting immediately. Say: I changed a single query. Then I deployed the application means the application takes the old query. to take the modified query, I rebuilt the view object. Whenever I am faced with this same problem. A few times in 2-3 deployments it is modified by itself (without the refurbishment) and work very well. Some time after 10 times as he takes the old query only. Whenever I have rebuilt in order to solve this problem. Please help me solve this problem. I use oralce 11g.

    Try to invoke any operation of cleaning before you deploy the application.

    In the main Menu-> build--> pure all

  • Logical operators in the query select Oracle

    Hi all

    Can I use the logical operators in queries select oracle?

    for 1 and 0 = 0; 1 or 0 = 0

    If I have a 1010 value two fields in a table COL1 and COL2 have a value of 0001.

    Is it possible to use select col1 or col2 from table? where or is a logical operator.

    Kind regards
    select bitand(6,8) from dual;
    
    BITAND(6,8)
    --------
    0     
    
  • Update the query doubt

    Table with two columns as shown below, I have...

    Name sex
    AB m
    CA m
    Ad m
    Æ m
    BA f
    BB f
    f BC.
    BD f

    I need to change all'm ' to 'f' and all 'f' for me "... I tried this using rowid and collection and I was able to do this. Is there another way to do it with a simple SQL query? Please someone help...
    Thanks in advance
    Sylvie...
    update your_table
    set    s_e_x = (case s_e_x
                         when 'm' then 'f'
                         when 'f' then 'm'
                    end
                   )
    where s_e_x in ('m','f');
    

Maybe you are looking for

  • Sites Web using php and mysql successfully stopped the week last of sorting drop-down lists. Change something?

    We run a programme of internal timesheet open source called Timesheet Next Gen available on Sourceforge. We have it worked for a few years without any problems. We moved all of our Firefox users because the developer has indicated that there are ques

  • Not the power of the mobile robot platform

    Hello I just got the Robotics Starter Kit for education and have problems at the robot to work. I plugged the power and turned all the dipswitches in the off position but the power led is still off and the hardware configuration can not detect. The p

  • How can I disable the startup mode fast for my Iconia One B1-770-K651 7 inch 16 GB Tablet

    Hi, I recently bought the Iconia One B1-770-K651 7 inch Tablet 16 GB and when I turn it on and put it back in the box for some reason any continues to go in quick start mode. I want to know how can I disable quick start permanently mode I can't find

  • Zineb battery, C510A

    I received a three-year-old C510a all-in-one with a "Zineb" connected tablets. The zitoun battery recharge, and online help for the printer says that I have to get a new Zeen. This looks like a costly proposal. Is there a way of removing and replacin

  • Windows vista side by side - configuration errors

    Agree with others, I need clear instructions step by step to solve this problem. I started having side by side configuration errors trying to open Chrome.  It then spread to Quicken.  Then Norton.  I took my laptop to a computer store to fix.   It ha