To convert the "IBM DB2 Store Procs written in C" to Oracle PL-SQL

Hi, Is it possible to convert the "IBM DB2 Store Procs written in C" to Oracle PL-SQL. If you have any info, PL do let me know. Thanks in advance.
EG :
/* SMG Stored Procedures */
/* DB2 Stored Procedure: OrganisationExists */
/* Linkage: SIMPLE (no NULLs permitted) */
/* Load module name: SMGEC00 */
/* Purpose: DELETE FROM SSE_LOOKUP_MAP */
/* to run. */
/* Parameters: argvÝ1¨ short - return error code - OUT */
/* argvÝ2¨ char - return error message - OUT */
/* argvÝ3¨ char - BLEID - IN */
/* Reason for edit Date Who */
/* Initial version 09/04/03 Arockia */
#pragma runopts(plist(os))
#include <stdlib.h>
#include <string.h>
void main (int argc, char *argvݨ)                                             
EXEC SQL INCLUDE SQLCA;
EXEC SQL BEGIN DECLARE SECTION;
char bleid??(12??);
EXEC SQL END DECLARE SECTION;
/* Set defaults for error code (argvÝ1¨) and error message (argvÝ2¨) */
strcpy(argv??(2??)," ");
*(int *)argv??(1??) = 0;
strcpy(bleid,argv??(3??));
EXEC SQL
DELETE FROM SSE_LOOKUP_MAP
WHERE BLEID = :bleid;
/* Set error code to record status of last SQL command */
*(int *)argv??(1??) = SQLCODE;
return;

For this program, you could do some thing like:
SQL> CREATE TABLE sse_lookup_map(BLEID varchar2(10));
Table created.
SQL> CREATE or replace PROCEDURE test(p_bleid_in IN varchar2)
  2  AS
  3  BEGIN
  4  DELETE FROM sse_lookup_map
  5  WHERE BLEID = p_bleid_in;
  6  END;
  7  /
Procedure created.
SQL> ed
Wrote file afiedt.buf
  1* INSERT INTO sse_lookup_map values('test1')
SQL> /
1 row created.
SQL> ed
Wrote file afiedt.buf
  1* INSERT INTO sse_lookup_map values('test2')
SQL> /
1 row created.
SQL> SELECT * FROM sse_lookup_map;
BLEID
test1
test2
2 rows selected.
SQL> EXEC test('test1')
PL/SQL procedure successfully completed.
SQL>  SELECT * FROM sse_lookup_map;
BLEID
test2
1 row selected.
SQL>

Similar Messages

  • Convert from IBM DB2 and IBM Net.Data

    We currently have an DB2 database that will be converted to Oracle. We have developed a web based application using IBM's Net.Data to access the DB2 database. Has anyone converted a Net.Data application for use with Oracle directly of converted the application to something else that would allow access to an Oracle database. Thanks in advance

    Hello,
    unfortunately there is no plugin for DB2 on OS/390 or z/OS.
    Migrations of DB2 needed to be done with the old Oracle Migration Workbench. But that excluded the OS/390 or z/OS platform:
    From the following note in My Oracle Support: Migration from DB2 to Oracle (Doc ID 200288.1):
    At the moment there is not a plug-in for DB2 on OS390/zOS.
    Starting with SQL Developer 2.1, DB2 databases can be migrated using the SQL Developer Migration Workbench. But the "New Feature List 2.1" at http://www.oracle.com/technology/products/database/sql_developer/files/NewFeatureList21.htm is telling us:
    +9. Migrations and Third Party Database Support      Third Party Browsing      DB2 UDB+
    Consult the following My Oracle Support note for further alternatives: Options for Connecting to Foreign Data Stores and Non-Oracle Databases (Doc ID 233876.1)
    One chapter in the mentioned note says:
    If OMWB cannot be used for the migration then other options include a manual
    migration. This could be done using a transparent gateway or generic connectivity
    to copy tables, or by loading data into flat files and loading into the Oracle
    database using SQL*Loader.
    Oracle Consulting can help you to do this.
    Best regards
    Wolfgang
    Edited by: wkobargs on Mar 2, 2010 4:00 AM

  • Configuring  ODI with the IBM db2

    Hi all,
    I am new to this technology.I want to configure my IBM db2 data base with oracle data integrator.I have installeled IBM db2 & ODI on my machine.I am trying to create repositories but how to do it for IBM db2.
    My task is..
    1)creating the repository for IBM db2.
    2)Configuring it with ODI
    3)Exporting the dump data to IBM db2 database
    Thanks in advance.

    Hi Cezar,
    Thanx again for ur reply...
    I have done as you said but still getting error as "Connection Failed" as follows
    *com.ibm.db2.jcc.am.yn: [jcc][t4][2043][11550][3.57.82] Exception java.net.ConnectException: Error opening socket to server localhost/127.0.0.1 on port 50,000 with message: Connection refused: connect. ERRORCODE=-4499, SQLSTATE=08001*
    Regards,
    Mandar

  • Convert IBM DB2 v9.5 to Oracle 11gR2

    I am trying to migrate a DB2 v9.5 database to Oracle 11g and am having a few problems with the conversion process. I am running Oracle SQL Developer 2.1. The developer captures the DB2 database model just fine. When it converts the captured model it says that it succeeds with a success code of "16", but when I go inspect the converted model, it appears to be exactly the same and the captured model. The converted model has column types of Integer, Character and Varchar, when they should have been converted to Number, char, and varchar2. What is going wrong with the conversion process?
    I have double checked the mapping table and it is correct. I have verified that the connecting user has all the correct privileges.
    Converting From
    IBM DB2 v9.5
    Solaris OS
    Converting To
    Oracle 11g R2
    Linux Fedora 12 64bit

    Hi,
    What was the resolution, Do share with us

  • IBM DB2 Migration

    Does anyone here have experience with IBM DB2 Migration to Oracle? If so, what information can you tell me? I've read the IBM DB2 Migration Guide, but reading real success stories here would be great.
    My company is exploring a couple of home-grown solutions, but it seems to me the Oracle Migration tool would be the preferred way.
    Thanks,
    Houffle

    Thanks, RP.
    1. What exactly is it that you intend to migrate? The tables and data? The stored procedures and packages? User or application code including reports that might have their own embedded SQL?
    Tables - both physical and logical.  No stored triggers or procedures.  We'll be converting our RPG code, which most of he last several years has been written in SQLRPGLE, which uses embedded SQL.  The front-end GUI is written Smalltalk, they will convert to Java.
    2. Who will be architecting, designing, implementing and testing the migration? The current DB2 developers? Developers with existing Oracle expertise?
    We are bringing in a consultant who specializes in replatform projects as the director.  Current DB2 developers are the guardians of the database.  Two of us have previous Oracle experience and all of us are learning more before the project kicks off.  Four team members have been on the project over 11 years.  Two other over five.  One newbie has three years.  We have two Oracle developers in our office to consult with.  hey won't be on the project, but will be our "wise men."
    3. How many mods/upgrades and new functionality will be part of this project?
    Great question.  It's going over 'as is'.  We'll parallel processing for six to eight weeks and be happy if that works.  I don't think we will be utilizing the power of Oracle, due to time constraints.
    In my opinion the biggest issue that needs to be well understood before you select a solution is the fundamental operational differences between DB2 and Oracle. In DB2 writers block readers so there is a lot of (or should be a lot of) manual transaction management that isn't necessary in Oracle.
    We lock tables and rows as needed. Should be similar commands to issue in Oracle
    Sql developer supports some migration functionality.
    Yes, we'd be happy to get our data and indexes over.  That seems like a fundamental task that must be 100% accurate

  • IBM DB2 to Oracle Database Migration Using SQL Developer

    Hi,
    We are doing migration of the whole database from IBM DB2 8.2 which is running in WINDOWS to Oracle 11g Database in LINUX.
    As part of pre-requisites we have installed the Oracle SQL Developer 4.0.1 (4.0.1.14.48) in Linux Server with JDK 1.7. Also Established a connection with Oracle Database.
    Questions:
    1) How can we enable the Third Party Database Connectivity in SQL Developer?
    I have copied the files db2jcc.jar and db2jcc_license_cu.jar from the IBM DB2 (Windows) to Oracle (Linux)
    2) Will these JAR files are universal drivers? will these jar files will support in Linux platform?
    3) I got a DB2 full privileged schema name "assistdba", Shall i create a new user with the same name "assistdba" in the Oracle Database & grant DBA Privillege? (This is for Repository Creation)
    4) We have around 35GB of data in DB2, shall i proceed with ONLINE CAPTURE during the migration?
    5) Do you have any approx. estimation of Time to migrate a 35 GB of data?
    6) In-case of any issue during the migration activity, shall i get an support from Oracle Team (We have a Valid Support ID)?
    7) What are all the necessary Test Cases to confirm the status of VALID Migration?
    Request you to share the relevant metalink documents!!!
    Kindly guide me in-order to go-ahead with the successful migration.
    Thanks in Advance!!!
    Nagu
    [email protected]

    Hi Klaus,
    Continued with the above posts - Now we are doing another database migration from IBM DB2 to Oracle, which is very less of data (Eg: 20 Tables & 22 Indexes).
    As like previous database migration, we have done the pre-requirement steps.
    DB Using SQL Developer
    Created Migration Repository
    Connected with the created User in SQL Developer
    Captured the Source Database
    Converted Captured Model to Oracle
    Before Translation Phase we have clicked on the "Proceed Summary"
    Captured Database Objects & Converted Database Objects has been created under PROJECT section.
    Here while checking the status of captured & converted database objects, It's showing the below chart as sample:
    OVERVIEW
    PHASE               TABLE DETAILS          TABLE PCT
    CAPTURE               20/20                              100%
    CONVERT               20/20                              100%
    COMPILE                 0/20                                   0%
    TARGET STATUS
    DESC_OBJECT_NAME
    SCHEMANAME
    OBJECTNAME
    STATUS
    INDEX
    TRADEIN1
    SQLDEV:LINK:&SQLDEVPREF_TARGETCONN:null:TRADEIN1:INDEX:ARG_I1:oracle.dbtools.migration.workbench.core.ConnectionAwareDrillLink
    Missing
    INDEX
    TRADEIN1
    SQLDEV:LINK:&SQLDEVPREF_TARGETCONN:null:TRADEIN1:INDEX:H0INDEX01:oracle.dbtools.migration.workbench.core.ConnectionAwareDrillLink
    Missing
    INDEX
    TRADEIN1
    SQLDEV:LINK:&SQLDEVPREF_TARGETCONN:null:TRADEIN1:INDEX:H1INDEX01:oracle.dbtools.migration.workbench.core.ConnectionAwareDrillLink
    Missing
    INDEX
    TRADEIN1
    SQLDEV:LINK:&SQLDEVPREF_TARGETCONN:null:TRADEIN1:INDEX:H2INDEX01:oracle.dbtools.migration.workbench.core.ConnectionAwareDrillLink
    Missing
    INDEX
    TRADEIN1
    SQLDEV:LINK:&SQLDEVPREF_TARGETCONN:null:TRADEIN1:INDEX:H3INDEX01:oracle.dbtools.migration.workbench.core.ConnectionAwareDrillLink
    Missing
    INDEX
    TRADEIN1
    SQLDEV:LINK:&SQLDEVPREF_TARGETCONN:null:TRADEIN1:INDEX:H4INDEX01:oracle.dbtools.migration.workbench.core.ConnectionAwareDrillLink
    Missing
    INDEX
    TRADEIN1
    SQLDEV:LINK:&SQLDEVPREF_TARGETCONN:null:TRADEIN1:INDEX:H4INDEX02:oracle.dbtools.migration.workbench.core.ConnectionAwareDrillLink
    Missing
    INDEX
    TRADEIN1
    SQLDEV:LINK:&SQLDEVPREF_TARGETCONN:null:TRADEIN1:INDEX:H5INDEX01:oracle.dbtools.migration.workbench.core.ConnectionAwareDrillLink
    Missing
    INDEX
    TRADEIN1
    SQLDEV:LINK:&SQLDEVPREF_TARGETCONN:null:TRADEIN1:INDEX:H7INDEX01:oracle.dbtools.migration.workbench.core.ConnectionAwareDrillLink
    Missing
    INDEX
    TRADEIN1
    SQLDEV:LINK:&SQLDEVPREF_TARGETCONN:null:TRADEIN1:INDEX:H7INDEX02:oracle.dbtools.migration.workbench.core.ConnectionAwareDrillLink
    Missing
    INDEX
    TRADEIN1
    SQLDEV:LINK:&SQLDEVPREF_TARGETCONN:null:TRADEIN1:INDEX:MAPIREP1:oracle.dbtools.migration.workbench.core.ConnectionAwareDrillLink
    Missing
    INDEX
    TRADEIN1
    SQLDEV:LINK:&SQLDEVPREF_TARGETCONN:null:TRADEIN1:INDEX:MAPISWIFT1:oracle.dbtools.migration.workbench.core.ConnectionAwareDrillLink
    Missing
    INDEX
    TRADEIN1
    SQLDEV:LINK:&SQLDEVPREF_TARGETCONN:null:TRADEIN1:INDEX:MAPITRAN1:oracle.dbtools.migration.workbench.core.ConnectionAwareDrillLink
    Missing
    INDEX
    TRADEIN1
    SQLDEV:LINK:&SQLDEVPREF_TARGETCONN:null:TRADEIN1:INDEX:OBJ_I1:oracle.dbtools.migration.workbench.core.ConnectionAwareDrillLink
    Missing
    INDEX
    TRADEIN1
    SQLDEV:LINK:&SQLDEVPREF_TARGETCONN:null:TRADEIN1:INDEX:OPR_I1:oracle.dbtools.migration.workbench.core.ConnectionAwareDrillLink
    Missing
    INDEX
    TRADEIN1
    SQLDEV:LINK:&SQLDEVPREF_TARGETCONN:null:TRADEIN1:INDEX:PRD_I1:oracle.dbtools.migration.workbench.core.ConnectionAwareDrillLink
    Missing
    INDEX
    TRADEIN1
    SQLDEV:LINK:&SQLDEVPREF_TARGETCONN:null:TRADEIN1:INDEX:S1TABLE01:oracle.dbtools.migration.workbench.core.ConnectionAwareDrillLink
    Missing
    INDEX
    TRADEIN1
    SQLDEV:LINK:&SQLDEVPREF_TARGETCONN:null:TRADEIN1:INDEX:STMT_I1:oracle.dbtools.migration.workbench.core.ConnectionAwareDrillLink
    Missing
    INDEX
    TRADEIN1
    SQLDEV:LINK:&SQLDEVPREF_TARGETCONN:null:TRADEIN1:INDEX:STM_I1:oracle.dbtools.migration.workbench.core.ConnectionAwareDrillLink
    Missing
    INDEX
    TRADEIN1
    SQLDEV:LINK:&SQLDEVPREF_TARGETCONN:null:TRADEIN1:INDEX:X0IAS39:oracle.dbtools.migration.workbench.core.ConnectionAwareDrillLink
    Missing
    We have seen only "Missing" in the chart, also we couldn't have any option to trace it in Log file.
    Only after the status is VALID, we can proceed with the Translation & Migration PHASE.
    Kindly help us how to approach this issue now.
    Thanks
    Nagu

  • IBM DB2 JDBC Universal Driver

    Hello,
    On page 36 of the DF XI3.0 Installation Guide, there is a link for the IBM DB2 JDBC Universal Driver. When I click on this link I get the following error:
    Downloads Message
    2005-01-13 12:10:16.882164R download was not found in the database
    Thanks for the help!
    Jason

    Hello
    Thanks Scott for your reply. We have resolved this issue in house as follows:
    - our Systems Support team installed the DB2 Connect client software on the DF server
    - copied the jar file to the leselect/drivers directory
    Also, because we are using the z series we needed an additional driver db2jcc_license_cisuz.jar which was copied into the same drivers dir.
    Thanks!
    Jason

  • SAP AL- IBM Common store: Incomplete url returned by FM 'SCMS_DOC_URL_READ'

    We are calling standard FM SCMS_DOC_URL_READ from a program started in the SAP GUI in order to retrieve the URL for an image stored in our document archive of type IBM Common store (HTTP communication via the Archive Link inteface). 
    When calling the FM with the parameters defined below, the returned value (url) is too short; the returned security key in the url has been cut off.
    (The returned parameter lv_url is defined as CHAR 4096, so it should be long enough.)
    The connection to the archive is working fine. Images kan be displayed via OAAD, so there is no communication problem between SAP and the IBM archive.
    The same source code is used successfully in another installation of rel 4.6C with an integration to a SAP HTTP content server.
    The only adjustments we have made for this installation integrated with IBM common store are :
    - value of “comp_id” was set to space
    - value of “force_get” was set to ‘X’. 
    The call to FM SCMS_DOC_URL_READ is defined as follows:
    DATA:   lv_url TYPE SAPB-URI,       “char4096
    Get URL.
           CALL FUNCTION 'SCMS_DOC_URL_READ'
               EXPORTING
                   stor_cat             = space
                   crep_id              = iv_archiv_id
                   doc_id               = iv_archiv_doc_id
                   comp_id            = space
                   security             = 'F'
                   http_url_only      = 'X'
                   force_get           = 'X'
               IMPORTING
                    url                  = lv_url               " char 4096
               EXCEPTIONS
                    error_config                = 1
                    error_parameter          = 2
                    error_signature           = 3
                    http_not_supported     = 4
                    docget_not_supported = 5
                    not_accessable          = 6
                    data_provider_error      = 7
                    tree_not_supported     = 8
                    not_supported            = 9
                    OTHERS                   = 10
    When analyzing the result of this FM call we can see that the returned value (url) has been cut off; i.e the security key in the returned url is not complete.
    The expected result was a complete url including a complete security key.
    The actual result was an url with a cutted secKey, see below:
    (server id of the IBM common store archive was replaced with “xxxxxx” in the url below).
    http://xxxxx:5590/cs?get&pVersion=0046&contRep=T1&docId=47A5A913D5EC00EBE10080000A14B620&accessMode=r&authId=CN%3DTST,OU%3DSAPWebAS,O%3DSAPTrustCommunity,C%3DDE&expiration=20080313203953&secKey=MIIBNAYJKoZIhvcNAQcCoIIBJTCCASECAQExCzAJBgUrDgMCGgUAMAsGCSqGS
    Any ideas on why the complete length of the security key is not returned in the url?
    // Kind regards
    Viveka Schwartz
    Edited by: Viveka Schwartz on Mar 14, 2008 8:46 AM
    Edited by: Viveka Schwartz on Mar 14, 2008 8:47 AM

    Hi,
    Did you try Office control UI element? It supports MS word and Excel files.
    [Office Control UI element|http://help.sap.com/saphelp_nw70/helpdata/en/d1/af8841349e1909e10000000a155106/content.htm]
    Best regards,
    Chinnu

  • Opinions on IBM DB2 Intelligent Miner for Data...

    I'm going to be getting into Oracle data mining or the IBM DB2
    Intelligent Miner for Data. The info given out by IBM (online at
    http://www-3.ibm.com/software/data/iminer/fordata) indicates
    that it ought to be okay if I've got an Oracle database. I've
    installed Oracle8i Enterprise Edition (8.1.7) on Windows 2000; &
    I've got the 9i installer cd's (I've not gotten that far yet).
    For now, I'm interested in opinions on if/whether I ought to go
    with Oracle Data Mining (9i, I guess...is this an option in 8i?)
    or the IBM data mining option. I'm looking for an intuitive
    interface, obvious & easy-to-follow instructions (if this
    exists); & features, I guess. Is one going to offer a nicer
    overall interface but be limiting?, etc. Thanks,
    Noel Whelan

    Update
    i had another hanpup in BW.
    Our AIX level is :  6100-05-01-1016  (released in 4/2010)
    I find an APAR for TL4 from 4/2010, which shows the same behaviour.
    So i'll try db2_use_iocp=off
    Info to APAR:
    APAR Number: IZ74508
    APAR status
    Closed as program error.
    Error description
    When IOCP is on and used by DB2 at AIX 6.1 TL04, DB2
    calls
    sqloGetMultipleCompletionStatus() which in turn
    calls AIX's IOCP extension.
    The IOCP call GetMultipleCompletionStatus() never returns
    causing I/O to stop when DB2 is in it's page cleaning
    routines.
    Local fix
    1. Stay at 6.1 TL03 and below
    or
    2. Do not activate IOCP in DB2.
    We will see how it works.
    ingo

  • Schedule a store proc to run with different values

    Hi ALL ,
    I have a store Proc i need to schedule it using the sql agent that i can do but the requirement is to exec the same store proc for different values at same time .
    like for eg i need to run the below same store proc for 3 different values at the same time.
    exec getIPs 'US'
    exec getIPs 'IND'
    exec getIPs 'UK'
    So for instance time is 02:30 am .
    The Same Store Proc should exec for values like US,IND & UK . If the exec for one of the values fail it should still continue .
    Like for eg if by chance due to some reason US fails it should move to next value IND in short continue with the exec.
    These values US,IND,Uk am getting from a table called Countries .
    Kindly help with this requirement.
    Thanks 
    Priya

    I am unable to test but you can try something like this,
    DECLARE @COUNTRYID INT
    SET @COUNTRYID = 1WHILE @COUNTRYID <= (SELECT MAX(COUNTRY_ID) FROM COUNTRY)
    BEGIN
    DECLARE @COUNTRY_CODE VARCHAR
    BEGIN TRY
    SELECT @COUNTRY_CODE = COUNTRY_CODE FROM COUNTRY WHERE COUNTRY_ID = @COUNTRYID
    EXEC getIPs @COUNTRY_CODE
    END TRY
    BEGIN CATCH
    INSERT INTO [dbo].[ERROR_LOG]
    SELECT
    GETDATE(),
    ERROR_NUMBER() AS ErrorNumber
    ,ERROR_SEVERITY() AS ErrorSeverity
    ,ERROR_STATE() AS ErrorState
    ,ERROR_PROCEDURE() AS ErrorProcedure
    ,ERROR_LINE() AS ErrorLine
    ,ERROR_MESSAGE() AS ErrorMessage
    END CATCH;
    SET @COUNTRYID = @COUNTRYID + 1
    END
    Regards, RSingh

  • How to send sortorder info to Store Proc

    Hi
    I have a Store Proc in SQL Server
    Now i want to give the Sort Order dynamically for this Store
    Proc.
    When i am trying to send the SortOrder, in the query it is
    saying that i cant give the parameter.
    It is forcing me to give field names directly.
    i cant able to give the Order by dynamically.
    how can i do this.?
    i need to change the Order By dynamically in Store Proc.
    i can send the paramter to Store Proc, but its not accespting
    in the query.

    Try this stored procedure.
    CREATE PROCEDURE [dbo].[myProcedure]
    @OrderParam VARCHAR(20)
    AS
    Declare @sQuery as VARCHAR(100)
    SET @sQuery = 'select * from myTable order by ' +
    CAST(@OrderParam AS VARCHAR(15))
    EXEC(@sQuery)
    GO
    Thanks
    Sankalan
    (www.mindfiresolutions.com)

  • Convert the money datatype to a 2 decimal point format.

    Whats the best way to convert the money datatype to a 2 decimal point format in ms sql 2005 for use in my applications.
    this?
    CAST(tr.depositReceivedAmount AS decimal(10 , 2))

    I respectfully disagree with the notion that you should change the SQL column from a 'money' data-type to something else.
    In most database servers, 'money' is a data type that is designed to provide very consistent behavior with regard to arithmetic accuracy.  In Microsoft Access, the representation is a scaled-integer.  In MS SQL Server, it is obviously similar.  Ditto Oracle and all the others.
    You want the money data-type in the database to have this accuracy, because "hell hath no fury like an accountant in search of one lousy penny."   The database column storage-formats are designed to satisfy accountants, and that is a Good Thing.
    Meanwhile, you also want to take care as to exactly how you deal with the values.  There are several points where rounding could take place.  You do not have at your disposal the strongest possible handling of floating data-types in ColdFusion.  You are also somewhat at the mercy of whatever interface software may lie between you and whatever SQL server you may use.  "It's okay to round values once, but not multiple times."
    I suggest rounding the value right before display, and stipulating that the user's input must be two decimal places.
    Then, you might have to do some things at the SQL server's end.  For instance, when you update a value in the table, you may need to use server-side logic to explicitly truncate the value to two decimal-points, so that an update of "$34.56" explicitly updates the column to "$34.5600."  (This sort of thing has to happen within the SQL server context.)  You know that the user's input has exactly two significant digits, but maybe (maybe not...!) the SQL server might not know this.  You want to ensure that the server's internally-stored value represents exactly two significant digits, when the value originates from a user-input.
    Don't err on the side of "your convenience" or "what looks good on-screen."  (If you do, get ready to get phone-calls from the accountants, always at inopportune hours of the night.)

  • How do i convert the following case statement to a table and still implement it in the store procedure.

    if @CustNo = '0142'          begin              insert #custnos (CustNo, ClientNo)              values ('0142', '1100')                      ,('0142', '1200')                      ,('0142', '1201')                      ,('0142', '1700')                      ,('0142', '1602')                      ,('0142', '1202')                      ,('0142', '1603')                      ,('0142', '2002')          endstore procUSE ODSSupport
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_NULLS ON
    GO
    if exists (select * from dbo.sysobjects where id = object_id(N'dbo.pr_Load_PASOArgusClaims_Work') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
    BEGIN
    drop procedure dbo.pr_Load_PASOArgusClaims_Work
    IF OBJECT_ID ('dbo.pr_Load_PASOArgusClaims_Work') IS NOT NULL
    PRINT '<<< FAILED DROPPING PROCEDURE dbo.pr_Load_PASOArgusClaims_Work >>>'
    ELSE
    PRINT '<<< DROP PROCEDURE dbo.pr_Load_PASOArgusClaims_Work >>>'
    END
    GO
    CREATE PROC dbo.pr_Load_PASOArgusClaims_Work
    @BatchNo varchar(7) = null,
    @CustNo char(4) = null,
    @NewBatchNo varchar(7) = null
    AS
    /* Object dbo.pr_Load_PASOArgusClaims_Work 2006234 */
    -- SSR# : 2242
    -- Date : 12/23/2005
    -- Author : Roxy Newbill
    -- Description : Add new PASO BCAT 1602
    -- SSR# 1932 - 2/22/2006 SEN - Add logic to include only ArgusCustNo - 0142
    -- and change PharmacyClaim.ProcessDate to DateWritten
    -- SSR# : 2419
    -- Date : 08/22/2006
    -- Author : Betty Doran
    -- Description : PASO reports project
    -- Correct mapping of Dispense fee amt from 'AmtProfFee' to 'DispenseFee' -
    -- Mapping changed by Argus - did not inform PHP. Used in calcs for mClaimTotAmtCharge and
    -- mClaimAmtAllowed fields.
    -- SSR# : 2496
    -- Date : 06/27/2007
    -- Author : Roxy Newbil
    -- Description : PASO Reporting Project
    -- Add data load for new columns: Prescription No, Drug Name, NDC
    -- SSR# : PEBB PROJECT
    -- Date : 10/13/2009
    -- Author : Tj Meyer
    -- Description : Add BCAT 1201 for new PEBB business--
    -- SSR# : 132707
    -- Date : 12/17/2009
    -- Author : Terry Phillips
    -- Description : PASO Reporting Project
    -- Fix data length issues for Argus_SubGroupId,Argus_PlanCode,vchParticipantId,
    -- vchProviderId
    -- SSR# : 3253
    -- Date : 03/28/2011
    -- Author : Susan Naanes
    -- Description : PrescriptionNo increased in size from 7 to 12 characters
    -- SSR# : SPOCK project
    -- Date : 08/09/2012
    -- Author : Raymond Beckett
    -- Description : Modifed to bring in RxKey from PharmacyClaim instead of using identity value for iRecId
    -- Also, modified to load any new batches since last batch loaded into PASOArgusClaims
    -- if @BatchNo not supplied
    -- Various 'fixes'
    -- - removed grouping from initial query due to unique grouping caused by BatchNo, ClaimNumber, ClaimType
    -- SSR# : TFS 5264 - Premera Remediation -(3997)
    -- Date : 12/21/2012
    -- Author : Satish Pandey
    -- Description : Add BCATs 1202 and 1603 to the Where clause selecting pharmclm.ArgusClientNo as BCAT
    -- SSR# : TFS 10286
    -- Date : 1/15/2014
    -- Author : Raymond Beckett
    -- Description : Add HRI Customer Number and BCAT's. Also add Customer Number and alternate batchno to parameters
    -- Only use '@NewBatchNo' if adding data from missed custno and the batchno already exists in PASOArgusClaims
    -- ITSM Ticket : 1800925
    -- Date : 4/15/2014
    -- Author : Roxy Newbill
    -- Description : Silverton Hospital had new BCAT (2002) with start of 2014 business. This was never accomodated for
    -- Adding this BCAT in so that we can start capturing these claims (Note, special insert being done to capture
    -- all BCAT 2002 claims prior to this fix.)
    -- ITSM Ticket : TFS 14587 -Intel BCAT Remediation
    -- Date : 08/14/2014
    -- Author : Andrew Omofonma
    -- Description : Added BCAT's (1604,& 2103) for Intel
    SET NOCOUNT ON
    DECLARE @iCount int
    create table #tmpArgusWork (
    iRecId int,
    BatchNo varchar (7) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
    BatchDateTime datetime NULL ,
    BatchStatus varchar (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    ReadyDateTime datetime NULL ,
    Argus_GroupId varchar (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
    Argus_SubGroupId varchar (4) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    Argus_ClassId varchar (4) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    Argus_PlanCode varchar (8) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    Argus_BusinessCategory varchar (8) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
    FacetsClaimSubType varchar (4) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    PASOClaimType varchar (20) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
    vchClaimNumber varchar (14) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
    dtPaidDate datetime NULL ,
    dtProcessDate datetime NULL ,
    dtServiceDate datetime NULL ,
    vchParticipantId varchar (14) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
    vchProviderId varchar (12) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    vchProviderName varchar (55) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    mClaimTotAmtCharge money NULL ,
    mClaimAmtDiscount money NULL ,
    mClaimAmtAllowed money NULL ,
    mClaimAmtDenied money NULL ,
    mClaimAmtDeduct money NULL ,
    mClaimAmtCoinsurance money NULL ,
    mClaimAmtCopay money NULL ,
    mClaimAmtPaid money NULL ,
    PASO_GroupId varchar (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    PASO_SubGroupId varchar (4) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    PASO_ClassID varchar (4) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    PASO_PlanCode varchar (8) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    PASO_BusinessCategory varchar (8) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    RecordStatus varchar (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    ErrorDesc varchar (128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
    PrescriptionNo char(12) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
    DrugName varchar(30)COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
    NDC char(11) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
    create table #batches (
    BatchNo char(7) not null
    primary key (BatchNo))
    create table #custnos (
    CustNo char(4),
    ClientNo char(5), -- bcats associated with the customer
    primary key (CustNo, ClientNo)
    DECLARE
    @len_Argus_SubGroupId smallint,
    @len_Argus_PlanCode smallint,
    @len_vchParticipantId smallint,
    @len_vchProviderId smallint
    --Get field lengths for the following fields
    SELECT @len_Argus_SubGroupId = 4, --datalength([@tmpArgusWork].[Argus_SubGroupId]),
    @len_Argus_PlanCode = 8, --datalength(@tmpArgusWork.Argus_PlanCode),
    @len_vchParticipantId = 14, --datalength(@tmpArgusWork.vchParticipantId),
    @len_vchProviderId = 12 --datalength(@tmpArgusWork.vchProviderId)
    declare @maxbatch char(7)
    IF @BatchNo IS NULL
    begin
    -- assume normal run. Add ClientNo's and custno's to tables
    insert #custnos (CustNo, ClientNo)
    values ('0142', '1100')
    ,('0142', '1200')
    ,('0142', '1201')
    ,('0142', '1700')
    ,('0142', '1602')
    ,('0142', '1202')
    ,('0142', '1603')
    ,('0142', '2002')
    ,('0142', '1604')
    ,('0142', '2103')
    ,('0669', '*')
    -- get batches loaded since last batch loaded into PASOArgusClaims
    SELECT @maxbatch=Max(BatchNo)
    FROM ODSSupport.dbo.PASOArgusClaims
    declare @dt datetime
    declare @ds datetime
    select @dt = MIN(DateTimeStamp)
    from ODS.dbo.PharmacyClaim_Common
    where BatchNo <= @maxbatch
    and DateTimeStamp > DATEADD(dd,-16,getdate())
    insert #batches (BatchNo)
    select distinct BatchNo
    from ODS.dbo.PharmacyClaim_Common pcc
    inner join #custnos ct
    on ct.CustNo = pcc.ArgusCustNo
    and (
    ct.ClientNo = '*'
    or
    ct.ClientNo = pcc.ArgusClientNo
    where DateTimeStamp > @dt
    ; -- batch may have had a claim altered since last load, drop any batches already loaded into PASOArgusClaims
    with pba as (
    select distinct BatchNo
    from ODSSupport.dbo.PASOArgusClaims
    delete ba
    from #batches ba
    inner join pba
    on pba.BatchNo = ba.BatchNo
    end
    else if @NewBatchNo is not null and @CustNo is not null
    begin
    --make sure we haven't already done this batch number/customer combination
    set @maxbatch = @NewBatchNo
    SELECT @iCount=count(*)
    FROM PASOArgusClaims
    WHERE BatchNo=@maxbatch
    and Argus_BusinessCategory = @CustNo
    IF @iCount > 0
    begin
    PRINT 'Msg: Batch ' + @maxbatch + ' already exists for CustNo ' + @CustNo + '.'
    end
    else
    begin
    if @CustNo = '0142'
    begin
    insert #custnos (CustNo, ClientNo)
    values ('0142', '1100')
    ,('0142', '1200')
    ,('0142', '1201')
    ,('0142', '1700')
    ,('0142', '1602')
    ,('0142', '1202')
    ,('0142', '1603')
    ,('0142', '2002')
    ,('0142', '1604')
    ,('0142', '2103')
    end
    if @CustNo = '0669'
    begin
    insert #custnos (CustNo, ClientNo)
    values ('0669', '*')
    end
    insert #batches (BatchNo)
    values (@BatchNo)
    end
    end
    else
    begin
    --make sure we haven't already done this batch number
    set @maxbatch = @BatchNo
    SELECT @iCount=count(*)
    FROM PASOArgusClaims
    WHERE BatchNo=@maxbatch
    IF @iCount > 0
    begin
    PRINT 'Msg: Batch ' + @maxbatch + ' already loaded.'
    end
    else
    begin
    insert #batches (BatchNo)
    values (@maxbatch)
    end
    end
    ** Insert Pharmacy Claims to temporary table
    INSERT INTO #tmpArgusWork
    SELECT
    pharmClm.RxKey,
    isnull(@NewBatchNo, pharmClm.BatchNo),
    pharmclm.OrigDateTimeStamp as BatchDateTime,
    'PENDING' as BatchStatus,
    NULL as ReadyDateTime,
    substring(pharmClm.GrpNumber,1,8)as Argus_GroupID,
    left(pharmClm.ArgusSubgroup1,@len_Argus_SubGroupId) as Argus_SubgroupID,
    substring(pharmClm.GrpNumber,9,4) as Argus_ClassId,
    substring(pharmClm.GrpNumber,13,@len_Argus_PlanCode) as Argus_PlanCode,
    pharmClm.ArgusClientNo as Argus_BusinessCategory,
    '' as vchFacetsClaimSubtype,
    PASOClaimType = CASE WHEN pharmClm.ClaimType='A'
    THEN 'PHARMACY-ADJUST'
    ELSE 'PHARMACY'
    END,
    pharmClm.ClaimNo,
    pharmClm.DateCutoff as dtPaidDate,
    pharmClm.DateWritten as dtProcessDate,
    NULL as dtServiceDate,
    left(pharmClm.MemberId,@len_vchParticipantId) as vchParticipantId,
    left(pharmClm.PharmacyNo,@len_vchProviderId) as vchProviderId,
    vchProviderName = CASE WHEN pharmclm.PayMemberInd = 'Y'
    THEN 'Member Reimbursement'
    ELSE pharm.PharmName
    END,
    mClaimTotAmtCharge = CASE WHEN pharmclm.PayMemberInd = 'Y' -- When this is a member reimbursement use the amt paid
    THEN isnull(pharmClm.IngredientCostPaid,0) + isnull(pharmClm.DispenseFee,0) + isnull(APSFee,0) -- as amt charged.
    ELSE isnull(pharmClm.AmtBilled,0)
    END,
    case when pharmclm.PayMemberInd = 'Y'
    then isnull(pharmClm.AmtRejected,0) * -1
    else isnull(pharmClm.AmtBilled,0) - isnull(pharmClm.IngredientCostPaid,0) - isnull(pharmClm.DispenseFee,0) - isnull(APSFee,0) -isnull(pharmClm.AmtRejected,0)
    end as mClaimAmtDiscount,
    isnull(pharmClm.IngredientCostPaid,0) + isnull(pharmClm.DispenseFee,0) + isnull(APSFee,0) as mClaimAmtAllowed,
    isnull(pharmClm.AmtRejected,0) as mClaimAmtDenied,
    isnull(pharmClm.MemberPaidAmt,0) - isnull(pharmClm.MemberCopayAmt,0) as mClaimAmtDeduct,
    0 as mClaimAmtCoinsurance,
    isnull(pharmClm.MemberCopayAmt,0) as mClaimAmtCopay,
    isnull(pharmClm.AmtPaid,0) + isnull(APSFee,0) as mClaimAmtPaid,
    NULL as PASO_GroupID,
    NULL as PASO_SubgroupID,
    NULL as PASO_ClassID,
    NULL as PASO_PlanCode,
    NULL as PASO_BusinessCategory,
    'OK' as RecordStatus,
    NULL as ErrorDesc,
    PrescriptionNo = pharmClm.PrescriptionNo,
    DrugName = pharmClm.DrugName,
    NDC = pharmClm.NDC
    FROM ODS..PharmacyClaim as pharmClm
    LEFT JOIN ODS..pharmacy as pharm on
    pharmClm.PharmacyNo = pharm.PharmacyNo
    INNER join #batches ba
    on ba.BatchNo = pharmClm.BatchNo
    INNER join #custnos ct
    on ct.CustNo = pharmClm.ArgusCustNo
    and (
    ct.ClientNo = '*'
    or
    ct.ClientNo = pharmClm.ArgusClientNo
    WHERE pharmClm.ClaimType in ('P','A') -- Processed or Adjusted
    --AND pharmClm.ProcessCode <> 'MC' --code doesn't exist
    --GROUP BY
    -- pharmClm.BatchNo,
    -- substring(pharmClm.GrpNumber,1,8),
    -- substring(pharmClm.GrpNumber,9,4) ,
    -- substring(pharmClm.GrpNumber,13,@len_Argus_PlanCode),
    -- pharmClm.ArgusSubgroup1,
    -- pharmClm.ClaimNo,
    -- pharmClm.ArgusClientNo,
    -- pharmClm.DateCutoff,
    -- pharmClm.DateWritten,
    -- pharmClm.MemberId,
    -- pharmClm.PayMemberInd,
    -- pharmClm.PharmacyNo,
    -- pharm.PharmName,
    -- pharmClm.OrigDateTimeStamp,
    -- pharmClm.ClaimType,
    -- pharmClm.PrescriptionNo,
    -- pharmClm.DrugName,
    -- pharmClm.NDC
    IF @@RowCount=0
    BEGIN
    PRINT 'Msg: No records found.'
    RETURN
    END
    --Update the Discount column for these Pharmacy Claims
    --UPDATE @tmpArgusWork
    --SET mClaimAmtDiscount=mClaimTotAmtCharge-mClaimAmtAllowed-mClaimAmtDenied
    ** Get the lowest service Date for each claim and update temp table
    UPDATE #tmpArgusWork
    SET dtServiceDate = (SELECT min(pharmclm.DateSvc)
    FROM ODS..pharmacyClaim AS pharmclm
    WHERE pharmclm.ClaimNo = tcpr.vchClaimNumber
    AND pharmclm.MemberID = tcpr.vchParticipantId)
    FROM #tmpArgusWork as tcpr
    ** Copy over the eligibility fields that Argus provided
    UPDATE #tmpArgusWork
    SET PASO_GroupId = Argus_GroupID,
    PASO_SubGroupId = Argus_SubGroupId,
    PASO_ClassID=Argus_classid,
    PASO_PlanCode=Argus_PlanCode,
    PASO_BusinessCategory=Argus_BusinessCategory
    FROM #tmpArgusWork pw
    WHERE COALESCE(Argus_GroupID,'') <> ''
    OR COALESCE(Argus_SubGroupId,'') <> ''
    OR COALESCE(Argus_classid,'') <> ''
    OR COALESCE(Argus_PlanCode,'') <> ''
    OR COALESCE(Argus_BusinessCategory,'') <> ''
    ** If Argus did not provide all 5 eligibility fields, get them from faEnrollmentHistory
    ** based on the group, member, date of service
    UPDATE #tmpArgusWork
    SET PASO_GroupId = eh.GroupId,
    PASO_SubGroupId = eh.SubGroupId,
    PASO_ClassID=eh.Class,
    PASO_PlanCode=eh.PlanCode,
    PASO_BusinessCategory=eh.BusinessCategory
    FROM #tmpArgusWork pw
    INNER JOIN ODS..FAEnrollmentHistory eh
    ON eh.MemberID =pw.vchParticipantID
    AND eh.Groupid =pw.Argus_GroupID
    AND eh.eligind='Y'
    AND eh.ProcessCode<>'ID'
    AND pw.dtServiceDate BETWEEN eh.EligEffDate AND eh.EligTermDate
    WHERE COALESCE(Argus_GroupID,'') = ''
    OR COALESCE(Argus_SubGroupId,'') = ''
    OR COALESCE(Argus_classid,'') = ''
    OR COALESCE(Argus_PlanCode,'') = ''
    OR COALESCE(Argus_BusinessCategory,'') = ''
    ** If we have eligibility for all records, go ahead and set the ready date to today.
    IF NOT EXISTS ( SELECT *
    FROM #tmpArgusWork
    WHERE COALESCE(PASO_GroupID,'') = ''
    OR COALESCE(PASO_SubGroupID,'') = ''
    OR COALESCE(PASO_ClassID,'') = ''
    OR COALESCE(PASO_PlanCode,'') = ''
    OR COALESCE(PASO_BusinessCategory,'') = '')
    BEGIN
    UPDATE #tmpArgusWork
    SET ReadyDateTime=convert(varchar(10),GetDate(),101),
    BatchStatus='READY'
    END
    ELSE
    BEGIN
    PRINT 'Msg: Exceptions found.'
    UPDATE #tmpArgusWork
    SET RecordStatus='ERR',
    ErrorDesc='No valid Eligible span for this Member/Group/Subgroup at time of Service'
    WHERE COALESCE(PASO_GroupID,'') = ''
    OR COALESCE(PASO_SubGroupId,'') = ''
    OR COALESCE(PASO_ClassID,'') = ''
    OR COALESCE(PASO_PlanCode,'') = ''
    OR COALESCE(PASO_BusinessCategory,'') = ''
    END
    ** Insert the records into the final table.
    INSERT INTO PASOArgusClaims
    SELECT * FROM #tmpArgusWork
    SET NOCOUNT OFF
    END
    GO
    -- Verify that the stored procedure was created successfully.
    IF OBJECT_ID ('dbo.pr_Load_PASOArgusClaims_Work') IS NOT NULL
    PRINT '<<< CREATED PROCEDURE dbo.pr_Load_PASOArgusClaims_Work >>>'
    ELSE
    PRINT '<<< FAILED CREATING PROCEDURE dbo.pr_Load_PASOArgusClaims_Work >>>'
    GO
    GRANT EXECUTE ON dbo.pr_Load_PASOArgusClaims_Work to role_ODSLoad
    GO
    SET QUOTED_IDENTIFIER OFF
    GO
    SET ANSI_NULLS ON

    this part of the code below
    if@CustNo
    = '0142'
       begin
    insert #custnos(CustNo,
    ClientNo)
    values ('0142',
    '1100')
    ,('0142',
    '1200')
    ,('0142',
    '1201')
    ,('0142',
    '1700')
    ,('0142',
    '1602')
    ,('0142',
    '1202')
    ,('0142',
    '1603')
    ,('0142',
    '2002')
       end
    store proc
    How do I covert it to a common table where the values can be selected from when needed.

  • Adobe Acrobat XI pro version, Windows 7, running on iMac parallels, converting pdf to a pdf with reduced size is not possible, error: error in converting the file! What to do? Its a bit annoying not to be able to store pdf files in reduced size, any idea?

    Adobe Acrobat XI pro version, Windows 7, running on iMac parallels, converting pdf to a pdf with reduced size is not possible, error: error in converting the file! What to do? Its a bit annoying not to be able to store pdf files in reduced size, any idea?? Thanks, Jörg

    Hi Jorg ,
    Are you trying to reduce the file size with the "Reduced size PDF" in the save as other option.
    Give it a try if you haven't done it prior.
    Open that PDF>File>Save as Other>Reduced size PDF.
    If possible ,please share the snapshot of the error message with us so that we can have a look in order to assist you further.
    Regards
    Sukrit Dhingra

  • I have a problem with your app store, always I want to update a new app, I want to know what Schiffer and novelty app! Most of my applications are in English, and they write what the improvement and renewal are written in English, and I do not speak the

    Hi
    I have a problem with your app store, always I want to update a new app, I want to know what Schiffer and novelty app! Most of my applications are in English, and they write what the improvement and renewal are written in English, and I do not speak the language! I try to copy the text, color (gray) is not successful, the variance can it, so we can copy the text and translate?
    I thank you for your help, it can help to humanize

    You are right, but how could i send it to Apple? when the phone company first replaced my iphone they had in stock alots of iphones and they just sent mine back to Apple and gave me a new one, so all i did is to give them my phone, but now how could i sent it to Apple? and i cant send it by myself, and the store wont do that, its a lost for them.. so sending it to Apple wasnt an option from the begining.
    and for the record, i dont think the store where i bought it is an authorized shop.. its just a store who boughts phone's from Apple in a low price and sells it in much more money..

Maybe you are looking for