Convert a statement of SQL for Oracle Server Update

Hello
I need to convert an update statement written for SQL Server to run on Oracle.
the update is:

UPDATE TABLE1
SET TBL2 = CDate. CDate
OF TABLE1 TBL1
JOIN TABLE2 ON TBL2 TBL2. Code = TBL1. TBL2Code
JOIN TABLE3 TBL3 ON TBL3. ID = TBL1. ID
WHERE TBL3. TypeCode = '07'

How can I make compatible with oracle?

Thank you!!

Try this...

MERGE INTO table1 t1
     USING (SELECT t2.cdate cdate, t1.ROWID ri
              FROM table2 t2, table3 t3, table1 t1
             WHERE     t2.code = t1.tbl2code
                   AND t3.id = t1.id
                   AND t2.typecode = '07') src
        ON (t1.ROWID = src.ri)
WHEN MATCHED
THEN
   UPDATE SET t1.cdate = src.cdate

Tags: Database

Similar Questions

  • transfer of data from the sql for oracle server

    Can we use the tools datapumps or oracle exp in oracle to transfer data from oracle to sql server database? Is it possible to do through the use of these tools expdp or exp in oracle. Create oracle dump files and import them to sql server?
    I know there are third-party tools for the same. but I'm just curious?

    No, these tools cannot be used for the transfer of data from oracle to sql server. The two write files in an oracle proprietary format, that they not fixed data or sql scripits files.

  • Convert or map Typedonnees decimal Transact-SQL for Oracle Number data type?

    MSSQL 2005
    Oracle 10.2 g

    In a MSSQL table, I have a column with the data type set on (decimal (1.0), null) with the values of line-1. (695 lines in total)

    In the Oracle table, the proposed mapped column is a number data type. When I import data, I received 695 errors with the message "invalid value for the field. How to properly convert or map Decimal (MSSQL) Transact-SQL for Oracle Number data type for a negative value?

    Thank you.

    How do you load data into Oracle? What tool or programming language you are using? Can you post something cause what you stated in your post should work, but there may be some ODBC, or other type of conversion factors to be taken into account.

     > create table t1 (field1  number(1,0));
    
    Table created.
    
     > insert into t1 values (-1);
    
    1 row created.
    
    UT1 > select * from t1;
    
        FIELD1
    ----------
            -1
    

    HTH - Mark D Powell.

  • Covert SybaseIQ SQL for Oracle

    Hi all

    Can come a help me next secret SybaseIQ SQL for Oracle.

    Select
    t.Sales_rep_id as sales_rep_id
    CASE when
    length (if t.market_id is null then "endif) = 0 or t.market_id is null
    then 0 otherwise cast (t.market_id as integer) end UP as market_id
    "TENDER" as feature_category
    null as is_override_tax_exempt
    null as audit_entered_by_user of ODS. POS_ODS_TENDER t;

    Thank you

    user2281943 wrote:
    Hi all

    Can come a help me next secret SybaseIQ SQL for Oracle.

    Select
    t.Sales_rep_id as sales_rep_id
    CASE when
    length (if t.market_id is null then "endif) = 0 or t.market_id is null
    then 0 otherwise cast (t.market_id as integer) end UP as market_id
    "TENDER" as feature_category
    null as is_override_tax_exempt
    null as audit_entered_by_user of ODS. POS_ODS_TENDER t;

    Thank you

    Try this

    select t.Sales_rep_id as sales_rep_id
           , CASE when length(decode(t.market_id,null,'')) = 0 or t.market_id is null
                  then 0
                  else to_number(t.market_id)
             END as market_id
           , 'TENDER' as feature_category
           , null as is_override_tax_exempt
           , null as audit_entered_by_user
      from ODS.POS_ODS_TENDER t;
    
  • SQL to Oracle Server

    Hello
    I'll put up a link TO SQLServer to Oracle. I set up a linked server on the SQL computer (selects and updates and calling the work of the fine SP) and now trying to get a distributed transaction going on so that I can issue several commands and then validate the end of the process.

    I'm as follows using as reference but it seems little informaiton about this sort of thing passed Oracle 8i. I use the client software of 11g on the side of SQL Server and the database 10g (10.2.0.4).
    http://support.Microsoft.com/support/ComPlus/mtsandoracle.asp?sd=gn & LN = en-GB & gssnb = 1

    On the SQL Server side, I use OLEDB Microsoft (I have also installed the Oracle OLEDB in the ODAC, but I don't think that I need this because I plan to use the MSDTC Microsoft rather than Orace MTS). The doc cited above seems to say that MTS is not required, and to be honest I prefer to keep things simple and use drivers MS existing and MSDTC rather than install the drivers Oracle and OracleMTS, if they are not really necessary. Someone at - it not experience / opinion on this please?

    The main question I wanted to ask you, is that I was wondering if anyone could suggest if there is anything I do on the side of the Oracle to get this to work - it seems to be even less docs on this end of the transaction. I guess there are different parameters that would be preferable to set in the init.ora to optimize or even to allow distributed in Oracle transactions? No doubt MSDTC must run on the Oracle Server? I have to update the settings [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSDTC\MTxOCI] to reflect the Oracle 10 g s Dll on the server?

    Any help from someone who has done this, or links to recent docs would be appreciated...

    Thank you

    Rob

    Hello

    No, it has nothing to do at the end of the Oracle server. Given that the customer is the MSSQL Server in our case that attempts to make a connection with Oracle and to transmit, and to query the data.

    I think that you problem is solved, if you don't know how the naming model should be in the records of what you could do is simply go to ORACLE_HOME/bin directories and these DLLs will be residing there.

    If your answer is resolved you could mark the response as correct ;)

    Concerning

  • ODI 12 - problem with LKM SQL for Oracle

    Hi again,

    Three days ago, that I asked about the problem with the data types of data warehouses in models that were missing. After you apply the ideas suggested by Rita (thank you very much ) I got from their work.

    But after that, we came across a new problem. When you run a mapping (Oracle for Oracle databases), it failed on the second stage - ' "work table create. "When we checked the generated code was something like this: '(" CREATE TABLE < work_table_name >). None of the names of columns or data types have been described in parentheses and as expected, the ODI execution error was "invalid identifier". It seems that API odiRef.getColList(params)%> does not work. I tried loading using LKM Oracle Oracle (DB LINK) but once again the columns are missing in the generated script.

    I have to mention the master and work repositories are different databases from Oracle and ODI Agent is not installed because of some problems.

    We are still beginners of ODI and would appreciate any help from more experienced guy (or other beginners).

    Thank you in advance.

    Just by chance, we found the soluton today!

    The reason of missing generated code was that the description of the types of data was not entirely cofigured.

    We found that the fields "create table syntax" and "'syntax of data accessible in writing' in each type of data in the topology definition were empty." After filling them, the generation of the script is running properly.

    Before that we had problems with missing data types in models and we realized the reverse engineering of the types of data, but obviously it is insufficient.

    Thanks to all those who participated in the discussion and tried to help us!

  • Convert the Sql for Oracle script

    Could someone help me convert the sql script in oracle below

    -- EXEC SP_smpAGENCY_MYWS_LAPSE_GET_USP_AMSurrenderMngtReport '2005','2010','09048','IL'    
    ALTER PROCEDURE SP_smpAGENCY_MYWS_LAPSE_GET_USP_AMSurrenderMngtReport    
    --DECLARE     
    @StartYY AS VARCHAR(4),    
    @EndYY AS VARCHAR(4),    
    @AgentCode AS VARCHAR(9),    
    @CompanyCode AS VARCHAR(4)    
        
    AS    
        
    DECLARE @ProfileYYYYMM AS VARCHAR(6), @SQLStr1 AS VARCHAR(8000),@SQLStr2 AS VARCHAR(8000), @SQLStr3 AS VARCHAR(8000)    
        
    SET @ProfileYYYYMM = '201005'    
        
    SET @SQLStr1 = ''    
        
    SET @SQLStr1 = @SQLStr1 + ' DECLARE @CompAvgCount AS  DECIMAL(38,2), @CompAvgAP AS  DECIMAL(38,2), @CompInforceAP AS DECIMAL(15,2), @CompSurrenderAP AS DECIMAL(15,2), '    
    SET @SQLStr1 = @SQLStr1 + ' @CompInforceCount NUMERIC, @CompSurrenderCount NUMERIC,@ALCompInforceAP AS DECIMAL(15,2), @ALCompSurrenderAP AS DECIMAL(15,2), '    
    SET @SQLStr1 = @SQLStr1 + ' @ALCompInforceCount NUMERIC, @ALCompSurrenderCount NUMERIC,@ILCompInforceAP AS DECIMAL(15,2), @ILCompSurrenderAP AS DECIMAL(15,2), '    
    SET @SQLStr1 = @SQLStr1 + ' @ILCompInforceCount NUMERIC, @ILCompSurrenderCount NUMERIC '    
      
    SET @SQLStr1 = @SQLStr1 + ' DECLARE @tblAgentNumber TABLE '    
    SET @SQLStr1 = @SQLStr1 + ' ( '    
    SET @SQLStr1 = @SQLStr1 + '  [AgentName] VARCHAR(255), '    
    SET @SQLStr1 = @SQLStr1 + '  [AgentNumber] VARCHAR(9), '    
    SET @SQLStr1 = @SQLStr1 + '  [AgentRank] VARCHAR(10) '    
    SET @SQLStr1 = @SQLStr1 + ' ) '    
      
    SET @SQLStr1 = @SQLStr1 + '  DECLARE @tblmineInForce TABLE '    
    SET @SQLStr1 = @SQLStr1 + ' ( '    
    SET @SQLStr1 = @SQLStr1 + '  [company_code] VARCHAR(50), '    
    SET @SQLStr1 = @SQLStr1 + '  [mine_policy_no] VARCHAR(50), '    
    SET @SQLStr1 = @SQLStr1 + '  [Annl_premium] NUMERIC(28, 2) '    
    SET @SQLStr1 = @SQLStr1 + ' ) '    
        
    SET @SQLStr1 = @SQLStr1 + ' DECLARE @tblmineSurrender TABLE '   
    SET @SQLStr1 = @SQLStr1 + ' ( '    
    SET @SQLStr1 = @SQLStr1 + '  [company_code] VARCHAR(50), '    
    SET @SQLStr1 = @SQLStr1 + '  [mine_policy_no] VARCHAR(50), '     
    SET @SQLStr1 = @SQLStr1 + '  [Annl_premium] NUMERIC(28, 2) '    
    SET @SQLStr1 = @SQLStr1 + ' ) '    
        
    SET @SQLStr1 = @SQLStr1 + ' INSERT INTO @tblAgentNumber '    
    SET @SQLStr1 = @SQLStr1 + ' SELECT AgentName, AgentNumber, AgentRank '    
    SET @SQLStr1 = @SQLStr1 + ' FROM [SUMYOLAP0001].aetnaildb.dbo.agentprofile'+ @ProfileYYYYMM +' AgtProfile '    
    SET @SQLStr1 = @SQLStr1 + ' WHERE (LEN(agentnumber) = 5 and (left(agentnumber,1) between ''0'' and ''8'' or left(agentnumber,1) = ''A'')) '    
    SET @SQLStr1 = @SQLStr1 + ' AND (Amname not like ''%COMPANY%'' OR Amname not like ''%DIRECT%'' OR Amname not like ''%MARKETsmp%'') '    
    SET @SQLStr1 = @SQLStr1 + ' AND agencynumber not in (''ILS'',''PLS'',''99999'') '    
    SET @SQLStr1 = @SQLStr1 + ' AND LEFT(agencynumber,2) not in (''CD'',''DR'') AND LEFT(agencynumber,3) <> ''DIR'' '    
    SET @SQLStr1 = @SQLStr1 + ' AND RIGHT(RTRIM(agencynumber),2) not in (''CD'',''DR'') AND RIGHT(RTRIM(agencynumber),3) <> ''DIR'' '    
    SET @SQLStr1 = @SQLStr1 + ' AND companycode = ''IL'' '    
        
    SET @SQLStr1 = @SQLStr1 + ' INSERT INTO @tblmineSurrender '    
    SET @SQLStr1 = @SQLStr1 + ' SELECT company_code, mine_policy_no, Annl_premium '    
    SET @SQLStr1 = @SQLStr1 + ' FROM odsmine_policy '    
    IF @CompanyCode = 'All'    
    BEGIN    
     SET @SQLStr1 = @SQLStr1 + ' WHERE company_code IN (''IL'',''AL'') '    
    END    
    ELSE    
    BEGIN    
     SET @SQLStr1 = @SQLStr1 + ' WHERE company_code IN ('''+ @CompanyCode +''') '    
    END    
    SET @SQLStr1 = @SQLStr1 + ' AND cont_status = ''S'' '    
    SET @SQLStr1 = @SQLStr1 + ' AND YEAR(effective_date) BETWEEN '+ @StartYY +' AND '+ @EndYY +' '    
        
    SET @SQLStr1 = @SQLStr1 + ' SELECT @CompSurrenderCount = COUNT(1), @CompSurrenderAP = SUM(Annl_premium) '    
    SET @SQLStr1 = @SQLStr1 + ' FROM @tblmineSurrender S '    
    SET @SQLStr1 = @SQLStr1 + ' INNER JOIN odsagent_role R '    
    SET @SQLStr1 = @SQLStr1 + ' ON S.company_code = R.company_code '    
    SET @SQLStr1 = @SQLStr1 + ' AND S.mine_policy_no = R.mine_policy_no '    
    SET @SQLStr1 = @SQLStr1 + ' INNER JOIN @tblAgentNumber A '    
    SET @SQLStr1 = @SQLStr1 + ' ON R.servicsmpagent_code = A.AgentNumber '    
        
    SET @SQLStr1 = @SQLStr1 + ' INSERT INTO @tblmineInforce '    
    SET @SQLStr1 = @SQLStr1 + ' SELECT company_code, mine_policy_no, Annl_premium '    
    SET @SQLStr1 = @SQLStr1 + ' FROM odsmine_policy '    
    IF @CompanyCode = 'All'    
    BEGIN    
     SET @SQLStr1 = @SQLStr1 + ' WHERE company_code IN (''IL'',''AL'') '    
    END    
    ELSE    
    BEGIN    
     SET @SQLStr1 = @SQLStr1 + ' WHERE company_code IN (''' + @CompanyCode + ''') '    
    END    
    SET @SQLStr1 = @SQLStr1 + ' AND cont_status = ''I'' '    
    SET @SQLStr1 = @SQLStr1 + ' AND YEAR(effective_date) BETWEEN '+ @StartYY +' AND '+ @EndYY +' '    
        
    SET @SQLStr1 = @SQLStr1 + ' SELECT @CompInforceCount = COUNT(1), @CompInforceAP = SUM(Annl_premium) '    
    SET @SQLStr1 = @SQLStr1 + ' FROM @tblmineInforce I '    
    SET @SQLStr1 = @SQLStr1 + ' INNER JOIN odsagent_role R '    
    SET @SQLStr1 = @SQLStr1 + ' ON I.company_code = R.company_code '    
    SET @SQLStr1 = @SQLStr1 + ' AND I.mine_policy_no = R.mine_policy_no '    
    SET @SQLStr1 = @SQLStr1 + ' INNER JOIN @tblAgentNumber A '    
    SET @SQLStr1 = @SQLStr1 + ' ON R.servicsmpagent_code = A.AgentNumber '    
        
    SET @SQLStr1 = @SQLStr1 + ' SET @CompAvgCount = ROUND(ISNULL(@CompSurrenderCount,0) * 100 / ( ISNULL(@CompSurrenderCount,0) + @CompInforceCount),2) '     
    SET @SQLStr1 = @SQLStr1 + ' SET @CompAvgAP = ROUND(ISNULL(@CompSurrenderAP,0) * 100 / ( ISNULL(@CompSurrenderAP,0) + @CompInforceAP),2) '     
        
    SET @SQLStr1 = @SQLStr1 + ' DECLARE @tblODSmine_Policy TABLE '    
    SET @SQLStr1 = @SQLStr1 + ' ( '    
    SET @SQLStr1 = @SQLStr1 + '  [AgentName] VARCHAR(255), '    
    SET @SQLStr1 = @SQLStr1 + '  [AgentNumber] VARCHAR(9), '    
    SET @SQLStr1 = @SQLStr1 + '  [AgentRank] VARCHAR(10), '    
    SET @SQLStr1 = @SQLStr1 + '  [Company_Code] VARCHAR(4), '    
    SET @SQLStr1 = @SQLStr1 + '  [mine_Policy_No] VARCHAR(10), '    
    SET @SQLStr1 = @SQLStr1 + '  [Cont_Status] VARCHAR(1), '    
    SET @SQLStr1 = @SQLStr1 + '  [Annl_Premium] DECIMAL(15,2), '    
    SET @SQLStr1 = @SQLStr1 + '  [No_count] NUMERIC '    
    SET @SQLStr1 = @SQLStr1 + ' ) '    
        
    SET @SQLStr2 = 'INSERT INTO  @tblODSmine_Policy '    
    SET @SQLStr2 = @SQLStr2 + ' SELECT DISTINCT AgtProfile.AgentName, AgtProfile.AgentNumber, '    
    SET @SQLStr2 = @SQLStr2 + ' AgtProfile.AgentRank,mine.company_code, mine.mine_policy_no, mine.cont_status, mine.Annl_Premium, 1.0 as no_count '    
    SET @SQLStr2 = @SQLStr2 + ' FROM @tblAgentNumber AgtProfile '    
    SET @SQLStr2 = @SQLStr2 + ' INNER JOIN [SUMYOLAP0001].aetnaildb.dbo.COMAGH COMAGH '    
    SET @SQLStr2 = @SQLStr2 + ' ON AgtProfile.AgentNumber = COMAGH.AHAGTN '    
    SET @SQLStr2 = @SQLStr2 + ' AND (AHAMNO = ''' + @AgentCode + ''' OR AHUMNO = ''' + @AgentCode + ''' OR AHAGNO = ''' + @AgentCode + ''') '    
        
    IF @CompanyCode = 'ALL'    
    BEGIN    
     SET @SQLStr2 = @SQLStr2 + ' AND AHCO IN (''AL'',''IL'') '    
    END    
    ELSE    
    BEGIN    
     SET @SQLStr2 = @SQLStr2 + ' AND AHCO = ''' + @CompanyCode + ''' '    
    END    
        
    SET @SQLStr2 = @SQLStr2 + ' INNER JOIN odsagent_role Role '    
    SET @SQLStr2 = @SQLStr2 + ' ON AgtProfile.AgentNumber = Role.servicsmpagent_code '    
    SET @SQLStr2 = @SQLStr2 + ' INNER JOIN odsmine_policy mine '    
    SET @SQLStr2 = @SQLStr2 + ' ON Role.company_code = mine.company_code '    
    SET @SQLStr2 = @SQLStr2 + ' AND Role.mine_policy_no = mine.mine_policy_no '    
    SET @SQLStr2 = @SQLStr2 + ' AND mine.cont_status IN (''S'',''I'') '    
        
    IF @CompanyCode = 'ALL'    
    BEGIN    
     SET @SQLStr2 = @SQLStr2 + ' AND mine.company_code IN (''AL'',''IL'') '    
    END    
    ELSE     
    BEGIN    
     SET @SQLStr2 = @SQLStr2 + ' AND mine.company_code = ''' + @CompanyCode + ''' '    
    END    
        
    SET @SQLStr2 = @SQLStr2 + ' AND YEAR(mine.effective_date) BETWEEN '+ @StartYY +'  AND  '+ @EndYY +' '    
        
    SET @SQLStr3 = 'SELECT AgentName, AgentRank, AgentNumber, '    
    SET @SQLStr3 = @SQLStr3 + ' CONVERT(INT,SUM(CASE WHEN cont_status = ''S'' THEN no_count ELSE 0 END)) AS Surrrender_Count, '    
    SET @SQLStr3 = @SQLStr3 + ' CONVERT(INT,SUM(CASE WHEN cont_status = ''I'' THEN no_count ELSE 0 END)) AS InForce_Count, '    
    SET @SQLStr3 = @SQLStr3 + ' SUM(CASE WHEN cont_status = ''S'' THEN Annl_premium ELSE 0 END) AS SurrenderAP, '    
    SET @SQLStr3 = @SQLStr3 + ' SUM(CASE WHEN cont_status = ''I'' THEN Annl_premium ELSE 0 END) AS InForceAP, '    
    SET @SQLStr3 = @SQLStr3 + ' CASE WHEN count(*) = 0 THEN 0 ELSE CONVERT(DECIMAL(38,2),(SUM(CASE WHEN cont_status = ''S'' THEN no_count ELSE 0 END) * 100 / count(*))) END AS AgtSurrenderCount, '    
    SET @SQLStr3 = @SQLStr3 + ' CASE WHEN SUM(Annl_premium) = 0 THEN 0 ELSE CONVERT(DECIMAL(38,2),(SUM(CASE WHEN cont_status = ''S'' THEN Annl_premium ELSE 0 END) * 100 / SUM(Annl_premium))) END AS AgtSurrenderAP, '    
    SET @SQLStr3 = @SQLStr3 + ' CONVERT(varchar(100),@CompAvgCount) AS CompAvgCount, '    
    SET @SQLStr3 = @SQLStr3 + ' CONVERT(varchar(100), @CompAvgAP) AS CompAvgAP '    
    SET @SQLStr3 = @SQLStr3 + ' FROM @tblODSmine_Policy '    
    SET @SQLStr3 = @SQLStr3 + ' GROUP BY AgentName, AgentRank, AgentNumber '    
        
    EXEC (@SQLStr1 + @SQLStr2 + @SQLStr3)    
    --PRINT (@SQLStr1 + @SQLStr2 + @SQLStr3)    

    Yes.

    1. the scrap code.
    2. get the specification of the requirements of business origin.
    3. learn PL/SQL.
    4. write the PL/SQL code to meet the requirements of the company.

  • Please help to translate ms access sql for oracle

    Hello

    I work by the migration of sql processes for updating legacy 11g access ms stuff we already use for a lot of other business processes.

    I need advice with the code below if someone could help please.

    SELECT (ABC. NAME = ABC. + (ABC. FAMILY NAME) INITS = ABC. INITIALS or IsNull (ABC. INITS) or IsNull (ABC. +(ABC.) INITIALS)) BDAY = ABC. BIRTHDAY or IsNull (ABC. BDAY)) AS [success]

    The results in the column are successes; 0 = no match fields, matches, 2 = 2 fields match, 3 = 3 fields are the field of 1 = 1.

    It works 3 concatenations and function success fills a column with a numeric value that reflects the success.

    in General, it seems to be almost a Where statement but clause to choose and it operates fortunately access.

    There are a lot more code, but ironically it is fairly standard, once the brackets [] around the table with spaces names are deleted and search and replacement of the legacy! between the table and column names.

    Your suggestions are greatly appreciated.

    Cheers, Peter

    so you'd:

    SELECT DECODE (ABC. NAME, ABC. SURNAME, 1, 0)

    + DECODE (NVL (ABC. INITS, ABC. (INITIALS), NVL (ABC. INITIALS, ABC. INITS), 1, 0)

    + DECODE (NVL (ABC. BROWN, ABC. (BIRTHDAY), ABC. BIRTHDAY, 1, 0) as a result

    Of...

    Returns + 1 for all matches (so 0 to do nothing, 1 for 1, 2, 2,...)

    the matches are: the same name (both null is considered to be identical too)

    Inits and identical initials (null or one of them null is considered identical too)

    bday and identical birthday (both null or null bday is considered identical too)

    HTH

  • Problem of migration: SQL to Oracle Server

    Windows 2008
    Oracle 11.2.0.2

    I'm migration of database sql server 2005 to Oracle 11 g. I have migrated without error, but when I compare the two system tables, I'm getting inconsistent County. Majority of the tables are consistent, but two or three are this inconsistent numbers, including the example below.

    Example:

    Oracle-
    Select count (*) in the tblcasefile;

    I get 3770 counties

    SQL Server-

    Select count (*) in tblcasefile:

    I get 3803 counties

    Any idea to get out of here?

    When you validate, code, ddl or output, please surround the noformat}

    {noformat} tags to make it easier to read. It should look like this:
    

    SQL > tblcasefile desc;
    >

    Name Null? Type
    ----------------------------------------- -------- -------------------

    AUTONUMBER NOT NULL NUMBER (10)
    CASENUMBER NOT NULL NUMBER (10)
    OLDCASENUMBER NUMBER (10)
    DATE_OF_INCIDENT VARCHAR2 (24 CHAR)
    DATE OF DATE_INITIALLY_REPORTED
    REPORTED_TO VARCHAR2 (255 CHAR)
    REPORTED_TO_POSITION VARCHAR2 (100 CHAR)
    DATE OF DATE_REPORTED_TO_BOARD

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
    
  • slow performance pl/sql for insert and update (pls suggestion) required

    DECLARE

    TYPE IS of LOC_USI_SEQ1 TABLE customer_TABLE.customereid%type;

    row_cnt number (19): = 0;

    CURSOR C1 IS

    SELECT customereid

    OF customer_TABLE

    WHERE customereid = 6316;

    LOC_USI_SEQ LOC_USI_SEQ1;

    BEGIN

    OPEN c1;

    C1 FETCH BULK COLLECT INTO LOC_USI_SEQ;

    Close c1;

    row_cnt: = LOC_USI_SEQ. Count;

    If row_cnt = 0 THEN

    INSERT INTO CUSTOMER_TABLE (CUSTOMEREID) VALUES (LOC_USI_SEQ);

    ON THE OTHER

    If row_cnt = 1 then

    Update customer_TABLE set id = 1 where CUSTOMEREID = LOC_USI_SEQ;

    INSERT INTO CUSTOMER_TABLE (CUSTOMEREID) VALUES (LOC_USI_SEQ);

    on the other

    If row_cnt = 2 then

    Update customer_TABLE set id = 2 where CUSTOMEREID = LOC_USI_SEQ;

    INSERT INTO CUSTOMER_TABLE (CUSTOMEREID) VALUES (LOC_USI_SEQ);

    end if;

    end if;

    end if;

    COMMIT;

    end;

    the query above works only for 1 customer id 6316. It runs in 1 sec.
    But if I run for the customer id 10 lakh of input parameter,
    (Whenever he runs for unique subscriber id) 10 times lachize it is running.
    update by inserting the customer_table table. it becomes slow. What is the real reason behind all this?


    Pls help gurus


    S

    Of course, it's slow.

    This is the perfect example of HOW not in PL/SQL code.

    Cursor fetch in PL/SQL loops are wrong 99% of the time. When you want to process the data in the database? Use SQL statements. Use SQL statements. And use SQL statements.

    No PL/SQL.

    Use INSERT... SELECT, MERGE, UPDATE (SELECT) and other SQL constructions.

    When you want to change it manually (where you manage the treatment), run this SQL via DBMS_PARALLEL_EXECUTE.

  • all other sources being investigated for oracle 12 update?

    Hello

    I studied for about 150-200 hours.

    I went on software free test several times.

    I read Matthews Book 12 c upgrade.

    I read the book of 12 c Sam upgrade.

    Are there legitimate things in that I can watch.

    I hope to take the exam within one week.

    Roger


    I guess you also read my site 1Z0-060-related articles, but since you didn't mention it, I'll point out that as a possibility:

    Oracle Certification Preparation: Details of the examination and preparation for 1Z0 - 060 resources

    Another possibility is the site of Oracle-Base of Tim Hall.  He creates 12 c articles extensively.  I connect to the many - maybe more - his articles on my site, but he adds new ones all the time so I am missing almost certainly some:

    ORACLE-BASE - Articles on the what's new in Oracle 12 c

  • Help: SQL for the massive update (service lead)

    Hello

    I use Oracle11.2. I want to update the column of hist_dttm of tb_hist with the tb_base crt_dttm column value in the following line, which is ordered by crt_dttm. Here are the details:

    creat table tb_base (tid varchar2 (32), crt_dttm timestamp (6));
    creat table tb_hist (tid varchar2 (32), crt_dttm timestamp (6), upd_dttm timestamp (6));

    insert into tb_base values ("AAA", to_timestamp (12 January 05 14:00:00.123456', ' dd-mm-rr hh24:mi:ss.ff'));))
    insert into tb_base values ("AAA", to_timestamp (May 12 05 14:00:00.123456', ' dd-mm-rr hh24:mi:ss.ff'));))
    insert into tb_base values ("AAA", to_timestamp (16 December 05 14:00:00.123456', ' dd-mm-rr hh24:mi:ss.ff'));))

    insert into tb_base values ("AAA", to_timestamp (12 January 05 14:00:00.123456', 'dd-mm-rr hh24:mi:ss.ff'), null);
    insert into tb_base values ("AAA", to_timestamp (May 12 05 14:00:00.123456', 'dd-mm-rr hh24:mi:ss.ff'), null);

    I use the following SQL to update the column upd_dttm of the tb_hist, I'm waiting for the upd_dttm needs to be updated to "12/05/05 14:00:00.123456 ' and 14:00:00.123456 16 December 05. However they is NULL. Any suggestion?



    Update tb_hist hist
    Set (upd_dttm) = (select lead (base. CRT_DTTM over (Partition by order of base.tid of base.crt_dttm)
    tb_base base
    where base.tid = hist.tid
    and base.crt_dttm = hist.crt_dttm)
    ;
     update tb_hist
      set crt_dttm= (select min (crt_dttm)
           from tb_base
         where tb_base.crt_dttm > tb_hist.crt_dttm)
    

    Published by: DPT Opitz Consulting com on 09.10.2012 19:24

    Published by: DPT Opitz Consulting com on 09.10.2012 19:25

  • MySQL to Oracle using LKM SQL to Oracle, poor performance

    Hello

    I'm on the underside of technology.

    I'm try to use ODI to import data from MySQL to Oracle using the LKM SQL to Oracle, it works well for small amounts of documents but once volumes go higher it performs very badly.

    I'm replacing an integration of existing HS dblink to 44 seconds and ODI is 9 minutes.

    The MySQL and Oracle DB are on the same host with an autonomous ODI agent on the same host.

    MySQL 5.6.21

    Oracle 11.2.0.4

    Oracle Data Integrator 12.1.3

    I may try a different approach to dumping the MySQL table to a flat file and import from external table or sqlldr but y at - it a way to make the LKM SQL for Oracle perform better?

    Hello

    This problem has been resolved.

    I was setting the table sizes in batches on the data source server, after you set the values on the target data server is it now works as expected.

    Using a value of 5,000 for the two tables has reduced the operating time of 9 minutes to about 40 seconds.

  • SQL Server edition full for vCenter Server 6.0

    Hello

    Just learn that vCenter 6.0 does not support SQL Server Express.

    We intend to use SQL Server 2008R2 as the database of vCenter Server 6.

    We would like to ask for your opinion if we should use the full 32-bit or 64-bit SQL Server Edition?  For SQL Server Express, 64 - Bit is used, I think that we need to use 64 bits one, is this correct?

    Your opinion is requested.

    Just learn that vCenter 6.0 does not support SQL Server Express.

    The Windows 6.0 vCenter dropped the integrated SQL Express, BUT instead, it comes with a SQL database vPostgres shipped to replace it with similar restrictions. You don't need to install your own SQL server if you're ok with these limits. See the following article:

    vSphere 6 - clarify misinformation. VMware vSphere Blog - VMware Blogs

    Databases are supported for installing windows SQL 2008 R2, 2012 and 2014, Oracle 11g and 12 c as well as the possibility of using an embedded database vPostgres on windows vPostgres is limited to 20 guests and 200 VMs. Upgrades where SQL express is installed will be converted to vPostgres. The vCenter Server Appliance supports the vPostgres shipped to full scale, the host of 1000 and 10,000 virtual computers and is the database recommended for vCenter server unit. Oracle 11g and c 12 external databases are also supported for this version, look for these to drop in the future releases.

    It is also possible to keep an existing SQL Express DB when you perform an upgrade:

    VMware KB: Upgrade vCenter Server 6.0 without migration of the SQL database to vPostgres

    If you use your own SQL server to go with a 64-bit version and stick them on products VMware interoperability Matrices.

  • convert DB2008 SQL express oracle 12 c by sql developer

    Hi friends,

    I created a SQL 2008 declare for the prod database. I run OMWB_OFFLINE_CAPTURE and receive an ocp source file complete

    Transform ocp Oracle express12c sql developer (3.2.20.10) but failed with error DB

    oracle.dbtools.metadata.persistence.PersistenceException: ORA-06550: line 1, column 14: PLS-00201: identifier ' MIGRATION. GATHERCONNECTIONSTATS' must be declared ORA-06550: line 1, column 7: PL/SQL: statement ignored

    Research on the basis and the migrated tables revised, I found that I only migrated system SQL sql objects and does not see any user with dbo SQL prefix object

    OMWB_OFFLINE_CAPTURE test its backsql P@$$w0rd1234

    The SQL server database was generated by s a software vendor and we know not what user has application data.

    How can I get sql tables dbo server in ocp for the migration file.

    Thank you

    newdba

    Hello

    I ran a test on my system using SQL * 3.2 Developer and don't see the problem you have.

    Can I check what you have done and the steps to follow?

    1. you have generated the ocp in the menu - Tools - Migration file - Create Database capture Scripts

    2. after the execution of OMWB_OFFLINE_CAPTURE you see 2 directories under the directory chosen for migration?

    You should see - 2 directories - 'master' and 'backsql.

    3. in the migration wizard.

    Tools - Migration - migration

    for the 'Source' database, you chose "offline" and then the file .ocp is generated - sqlserver2008.ocp

    4. in the next screen "Capture" you shoud see the database "backsql" in the column "databases selected. If it of in "Databases" then move it across.

    If that's what you see migration should precede as planned.

    5. in the next screen - target database - choose "offline" and check the generated scripts.

    They should contain instructions create for all objects in the database 'backsql.

    If this isn't what you see then please detail the exact measurements you have taken.

    Kind regards

    Mike

Maybe you are looking for

  • I CAN'T REORGANIZE MY FAVORITES

    I WANT TO MOVE MY BOOKMARKS IN THE BOOKMARKS LIST

  • Resolution of NOR-9263

    Hello I have a question about the resolution of the NOR-9263 analog output module. The specs say it's 16-bit resolution, and that it has a range of 20V (-/ + 10V). I want to use the NOR-9263 to reproduce a 16-bit recording of a waveform, but I need t

  • WindowsUpdate_80240038

    I tried Windows Update, but failed with the error code '80240038' when I JUST fininshed the installation and activation of Windows 7 Ultimate OEM on HP2230s. I use a wireless connection to internet and works well with all kinds of IE Web site. The Wi

  • Update Windows (VISTA) problems :(

    Salvation during the installation of the updates of windows on my laptop, the power was cut to the configuraion now when I start laptop it just hangs at startup screen saying 3 3 config 0% complete then continuous itslf repeatadly I tried to restart

  • View legend of particular intrigue

    Hello I have a listbox that has 100 elements inside and draw as 25 items at a time, but the legend of the plot has all the legends of 100 locations. How could I simply display the legend plot 25 selected in the drop-down list. Thank you