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;

Tags: Database

Similar Questions

  • 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.

  • 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 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
    
  • 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.

  • 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

  • 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.

  • 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.

  • Ocacle 12 c with SQL navigator for Oracle

    Hi, could someone help me. I recently installed the Oracle 12 c on my laptop. Try to connect the oracle SQL Navigator for oracle database, but could not succeed

    Sometimes, this error will occur if the tnsnames.ora file is corrupted. Can you please check tnsnames.ora and sqlnet.ora with a text editor ordinary for illegal characters (not the one that comes with Navigator because that could make corruption).

    Or simply move the tnsnames.ora that far and try with direct connect. (hostname:port\SID).

  • restore point warranty Vs catdwgrd.sql downgrade for oracle 12 c


    I understand that we have two ways to downgrade (assuming that the compatible parameter is not modified) when upgraded us a 11.2.0.3 database for oracle 12 c.

    I am curious about the benefits of catdwgrd.sql compared to the guarantees of restore point downgrade. I think that the guaranteed restore point seems very simple

    compared to catdwgrd.sql. I also think that oracle brings exactly the database in the same State when we use catdwgrd.sql, while

    guaranteed restore point brings back us to the State.

    Thank you

    Delphine

    Method you choose depends on your circumstances. This blog can help

    https://blogs.Oracle.com/upgrade/entry/is_there_a_fallback_strategy

    A third option is to restore the database backups

    HTH
    Srini

  • Model reusable SQL Oracle to create a DDL/DML Scripts for Oracle database

    Hello


    I have an obligation to set up a model of Oracle SQL to create the Scripts DDL/DML reusable for Oracle databases.
    Only the Oracle DBA will run scripts permissions is not a problem.

    The workflow for any DOF is as follows:-

    (1) new table

    a. check whether the table exists in the views system/admin.
    b. If the table exists then give message "Table exists".
    c. If the table does not exist then run DDL code

    (2) add the column

    a. check if the column exists for a given table of the system/admin views
    b. If the column exists in the specified table.
    B1. backup table.
    B2. ALTER table alter column
    B3. check data or execute convert dml sauvegardΘ to the new change script.
    c. If the column does not exist
    C1. backup table
    C2. ALTER table add column
    C3. Run dml to populate the column with the default value.

    The DML scripts are to populate the base tables with the data required for business operations.

    (3) addition of new line

    a. check if the line exists by comparing the old values of each column with the new values to be added for the new record.
    b. If there is, to give message line is
    c. If not exists, add the new record.

    (4) update existing record (we createtime columns in these tables as well as changes can be tracked)

    a. check if the row exists using the primary key.
    b. If there is.
    B1. off the record by using the "active" column of the table
    B2. Add new record with the necessary changes.
    c. If does not exist, add the new record with the necessary changes.

    Could you please help with some ideas that can get this done with precision?
    I tried several ways, but I am not able to set up something that meets all the requirements.

    Thank you

    If it helps at all. Sometimes we have a requirement for a DDL statement to be rerunable and her only error if something completely unexpected happens.

    It's a little monstrous, but basically, we wrap all DDL in a dynamic statement and capture errors that would indicate that the DDL script has already been run:

    Here's a bit of a model:

    declare
       w_ddl varchar2(32767);
    begin
       begin
          --
          dbms_output.put_line('Creating table TABLE_NAME');
          --
          w_ddl := 'CREATE TABLE MY_SCHEMA.TABLE_NAME
                    ( COLUMN_1     DATE          NOT NULL
                     ,COLUMN_2  VARCHAR2(10)  NOT NULL
                     ,COLUMN_3  DATE
                    )';
           --
          execute immediate w_ddl;
          --
          dbms_output.put_line('Successfully created table TABLE_NAME');
          --
       exception
          when others then
             if sqlcode = -955 then
                dbms_output.put_line('Table Already exists.');
             else
                dbms_output.put_line('creation of table TABLE_NAME failed:');
                dbms_output.put_line(sqlerrm);
                raise;
             end if;
       end;
    
      begin
          --
          dbms_output.put_line('Creating unique primary key constraint for TABLE_NAME');
          --
          w_ddl := 'ALTER TABLE MY_SCHEMA.TABLE_NAME ADD (
                   CONSTRAINT TABLE_NAME
                   PRIMARY KEY
                   (TABLE_NAME_ID) USING INDEX)';
           --
          execute immediate w_ddl;
          --
          dbms_output.put_line('Successfully created primary key on TABLE_NAME_ID');
          --
       exception
          when others then
             if sqlcode = -02264 then
                dbms_output.put_line('constraint already exists.');
             else
                dbms_output.put_line('creation of primary key failed:');
                dbms_output.put_line(sqlerrm);
                raise;
             end if;
       END;   
    
    <>
    

    It works well with our scripts to autmoated and help us when we iterate through development and back in if needed test environments.

    In this way, we can add the DDL statements to the deployment script and run the script again without error to set the database to the State required without having to run the newly created statement only.

    Sometimes this approach translates into a creation followed a statement alter table statement to add a column, but the end result of the script is always the same, and the deployment script can be controlled at source between iterations of development that is without having to restore the ddl changes to test the modified DDL script.

    hope that gives you some ideas.

  • Where the SQL Scripts running after the installation of the ODAC for Oracle Client?

    I just installed ODAC for Oracle Client on a windows server that runs a database of sql server, allowing developers to connect to a web application to an Oracle/Unix database. The installation States to run SQL scripts, located in the $ORACLE_HOME\ASP.NET\SQL directory after installation. I don't know where to run them? On the ORACLE DB on the Unix server? If someone could let me know, I'd appreciate it. Thank you.

    You must run on the Oracle database server, but they are necessary only if you use Oracle for ASP.NET providers.

    If you just install the software, so you can use OLEDB with SQL Server linked server, for example, you don't need them. What do you need to run although if this is the case is the oramtsadmin.sql script that creates the objects used by the Oracle MTS Recovery Service (if you do not have these objects created on the database) that SQL Server uses a distributed transaction for Oracle connections I think.

    It will be useful,
    Greg

  • equivalent of CLRSplitSting function for sql server Oracle

    Hello friends,

    I have a query in SQL Server - which becomes data.

    Select addl_info_id, sort_seq, code, row_data, addl_info_group_id, group_sort_seq, group_row_data from dbo. CLRSplitString('2406081,2410381,2427008,2430449,2466981,2495083,1586420,2406081,2410381,2427008,2430449,2466981,2495083,1586420','',',') x v join ein_addl_info_v on x.col1 = v.addl_info_id order by sort_seq
    We have same data in oracle too, so I converted the query above to sql to ORACLE like this server...


    Select addl_info_id, sort_seq, code, row_data, addl_info_group_id, group_sort_seq, group_row_data from (with t as)
    Select '2406081,2410381,2427008,2430449,2466981,2495083,1586420,2406081,2410381,2427008,2430449,2466981,2495083,1586420', ",","double str
    Select regexp_substr(str,'[^,]+',1,level) sub_str *) t connect by level < = regexp_count (str, ',') + 1) x *.

    Join cnh_cs_targ_csce_eur_1.ein_addl_info_v v x.sub_str = v.addl_info_id order of sort_seq


    but I don't get all the data. Can someone check if the query oracle above is equivalent to the above SQL query.

    Thank you/Kumar

    Published by: kumar73 on February 15, 2013 08:47

    So your query:

    select  addl_info_id,
            sort_seq,
            code,
            row_data,
            addl_info_group_id,
            group_sort_seq,
            group_row_data
      from      xmltable(
                         'ora:tokenize($str,",")'
                         passing ',2406081,2410381,2427008,2430449,2466981,2495083,1586420,2406081,2410381,2427008,2430449,2466981,2495083,1586420' as "str"
                         columns col1 varchar2(2000) path '.'
                        ) x
            join
                ein_addl_info_v v
              on x.col1 = v.addl_info_id
      order by sort_seq
    /
    

    SY.

  • Problem with migration SQL Server Oracle 11.2 2012 DB using SQL Developer Migration workbench

    Hello

    I have a problem when migrating SQL Server Oracle 11.2 2012 using SQL Developer Migration workbench, hope that someone had the same problem before and can give same advide...

    I use SQL Developer Version 4.0.1.14 and Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0. and last jtds - 1.3.

    I created the schema migration_repo, privileges, connected to the third part of Db (SQL Server) and begin a trial with assistant. In the first step of the model to Capture, I get the message from the:

    "Company Capture Capture failed.  Refer to the table MIGRLOG in the repository for more details ".

    But MIGRLOG is empty.

    Here is my log:

    <? XML version = "1.0" encoding = "windows-1252" standalone = 'no '? >

    < Log >

    account <>

    < date > 2014-03-16T 20: 49:17 < / date >

    oracle.dbtools.migration.workbench.core.MigrationLogResourceBundle < recorder > < / recorder >

    < level > SEVERE < / level >

    oracle.dbtools.migration.workbench.core.logging.MigrationLogUtil < class > < / class >

    < message > Capture

    Capture Enterprise

    Capture failure.  Refer to the MIGRLOG table in the repository for more details < / message >

    oracle.dbtools.migration.workbench.core.ui.FullMigrateTask.doOnlineEnterpriseCapture(FullMigrateTask.java:758) < param > < / param >

    oracle.dbtools.migration.workbench.core.ui.FullMigrateTask.doCapture(FullMigrateTask.java:601) < param > < / param >

    oracle.dbtools.migration.workbench.core.ui.FullMigrateTask.doMaskBasedActions(FullMigrateTask.java:400) < param > < / param >

    oracle.dbtools.migration.workbench.core.ui.FullMigrateTask.doWork(FullMigrateTask.java:314) < param > < / param >

    oracle.dbtools.migration.workbench.core.ui.FullMigrateTask.doWork(FullMigrateTask.java:147) < param > < / param >

    oracle.dbtools.raptor.backgroundTask.RaptorTask.call(RaptorTask.java:193) < param > < / param >

    java.util.concurrent.FutureTask.run(FutureTask.java:262) < param > < / param >

    oracle.dbtools.raptor.backgroundTask.RaptorTaskManager$ (RaptorTaskManager.java:554) < param > RaptorFutureTask.run < / param >

    java.util.concurrent.Executors$ (Executors.java:471) < param > RunnableAdapter.call < / param >

    java.util.concurrent.FutureTask.run(FutureTask.java:262) < param > < / param >

    java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) < param > < / param >

    java.util.concurrent.ThreadPoolExecutor$ Worker.run (ThreadPoolExecutor.java:615) < param > < / param >

    java.lang.Thread.run(Thread.java:744) < param > < / param >

    oracle.dbtools.migration.workbench.core.logging.LogInfo@68e69a < param > < / param >

    < exception >

    < message > oracle.dbtools.migration.workbench.core.ui.FullMigrateTask$ FullMigrateTaskException: Capture

    Capture Enterprise

    Capture failure.  Refer to the MIGRLOG table in the repository for more details < / message >

    < frame >

    oracle.dbtools.migration.workbench.core.ui.FullMigrateTask < class > < / class >

    < line > 758 < / line >

    < / framework >

    < frame >

    oracle.dbtools.migration.workbench.core.ui.FullMigrateTask < class > < / class >

    < line > 601 < / line >

    < / framework >

    < frame >

    oracle.dbtools.migration.workbench.core.ui.FullMigrateTask < class > < / class >

    line 400 > of < < / line >

    < / framework >

    < frame >

    oracle.dbtools.migration.workbench.core.ui.FullMigrateTask < class > < / class >

    < line > 314 < / line >

    < / framework >

    < frame >

    oracle.dbtools.migration.workbench.core.ui.FullMigrateTask < class > < / class >

    < line > 147 < / line >

    < / framework >

    < frame >

    oracle.dbtools.raptor.backgroundTask.RaptorTask < class > < / class >

    < line > 193 < / line >

    < / framework >

    < frame >

    java.util.concurrent.FutureTask < class > < / class >

    < line > 262 < / line >

    < / framework >

    < frame >

    oracle.dbtools.raptor.backgroundTask.RaptorTaskManager$ RaptorFutureTask < class > < / class >

    < line > 554 < / line >

    < / framework >

    < frame >

    java.util.concurrent.Executors$ RunnableAdapter < class > < / class >

    < line > 471 < / line >

    < / framework >

    < frame >

    java.util.concurrent.FutureTask < class > < / class >

    < line > 262 < / line >

    < / framework >

    < frame >

    java.util.concurrent.ThreadPoolExecutor < class > < / class >

    < line > 1145 < / line >

    < / framework >

    < frame >

    java.util.concurrent.ThreadPoolExecutor$ Worker < class > < / class >

    < line > 615 < / line >

    < / framework >

    < frame >

    java.lang.Thread < class > < / class >

    < line > 744 < / line >

    < / framework >

    < / exception >

    < / recording >

    account <>

    < date > 2014-03-16T 20: 49:17 < / date >

    oracle.dbtools.migration.workbench.core.MigrationLogResourceBundle < recorder > < / recorder >

    WARNING < level > < / level >

    oracle.dbtools.migration.workbench.core.ui.FullMigrateTask < class > < / class >

    <>error message: ORA-06550: line 1, column 14:

    PLS-00201: identifier ' SS2K5ALLPLATFORM. STAGECAPTURE' must be declared

    ORA-06550: line 1, column 7:

    PL/SQL: Statement ignored

    : FAILED: Database Migration: FAILURE < / message >

    oracle.dbtools.migration.workbench.core.logging.LogInfo@1e2c9b99 < param > < / param >

    < / recording >

    I try with model db (DB empty, just a single table), but the error is same. However, if I try to copy the acronym tabele from SQL Server to Oracle it works fine...

    I guess it's something with the configuration, but beacause I am new in Oracle still have no idea...

    Any help would be much appreciated

    I thank in advance

    Stefan

    Hello Stefan,

    did you create the repository Migration of your database to Oracle (Tools-> Migration-> repository management)?

    The SS2K5ALLPLATFORM package is usually created when you add the migration of the Oracle database repository and it contains the function StageCapture.

    So please make sure that you have created a repository of migration in an Oracle database and associate it with the first step of your migration.

    -Klaus

  • MySQL-&gt; table using SQL Developer Oracle

    Greetings,

    Currently, I am a (student) temporary employee who is responsible for the migration of the MySQL database of a company to their new (gr 11, 2) Oracle database.

    So far, I use SQL Developer, because I learned a few minor techniques with this application.

    I have tried different methods for the migration, including those of the Oracle (Migration of MySQL) page

    I however got no positive results with most of the methods.

    -J' have established a connection to the MySQL database Oracle database aswell, within SQL Developer

    Now, so far, I've copied manually (right click on the table, copy to Oracle) 90% of the tables from the MySQL to Oracle database successfully.

    However, these tables contain only about 5% of the data. The problem is in the 2 tables that actually have a decent amount of records.

    FOR INFO:

    File 1: 75MB file .csv, ~150.000 records (individual records contain all select queries, where the size)

    File 02:50 MB of files .csv, ~2.200.000 records

    My previous attempts to use the same copy for Oracle option to right click on one of the two largest tables resulted in the following error:

    The table of queries down. Message: java.io.IOException: IO error: socket read timed out

    My first action to prevent this error has been to add a second file data to the current storage space, giving it 200M maxsize.

    Okay it's coming, my real questions!

    This could be a possible solution to avoid the error mentioned earlier to return?

    What other issues are possible in case of failure?

    Uses an external table to a faster and more effective method?

    (The reason for which I have not yet tried external tables is because I had no SYS (TEM) privileges, so anything that requires privileges, I first have to discuss with my superior).

    Any help is appreciated! Although my next answer is maybe not earlier that come Monday 17.

    Welcome, Brent

    Hello

    I just discovered there is a csv Import Wizard in sqldeveloper also - don't know if you tried?

    tables in the destination database (oracle) - right-click and choose Import data - this will bring you in a Wizard of csv.

    However, I think that due to the volumes of data it may have similar problems.

    sqlldr is probably your best choice - it's pretty simple once you find a decent example - it seems to cover the basics of ok - Oracle SQL Stuff (for example): SQL-Loader: the tutorial step by step - example 1 (CSV file)

    See you soon,.

    Rich

Maybe you are looking for

  • Merger of retina 21.5 "iMac does not Bootcamp for Windows 10 drivers / auto diagnosis repair

    Hi all Hoping someone has encountered this before. We have a 15 Apple 21.5 "iMac with a 1 TB fusion drive that must have bootcamp for a classroom environment. I am trying to build at least one of them. Here's the context: 1 El Capitan for Mac environ

  • Play Google store has stopped

    I improve my OS to 4.0.3 version. I try to download apps, but there is an error message "Google play store ceased. So, I can install any application again now. Could someone help or answer me? Thank you.

  • Pavilion Elite 170f: SATA power connector

    SATA power cable has three connectors.  One is connected to the HARD drive.  Other two are as in photo.  What do I need connect another SATA drive to this cable?

  • Cannot get the DV6 recovery disk to run.

    I have a Pavilion DV6 2110ea.I just set up a new hard drive.I wanted a new installation of the operating system without all the extras of HP. So I downloaded the correct version of Windows 7 which was pre-installed when I bought the laptop (Home Prem

  • Order to get emails

    2 days ago I stopped getting emails.  As far as I know that I have nothing else. I use outlook 2007 I'll occasianally get one or two but I usually get more than 100 per day. I don't get them on my iphone either.