Pass customer parameter to oem_exec_template.sql

Hello
i have created on process flow using OWB9.2.0.8. This process flow is having an external activity that calls one MS-Dos batch file for the renaming of flat files
i am passing the SYDATE to this process flow so that the batch file receives this value and renames the files accordingly.
i have set a parameter at START and bind that parameter with the External activity.
When i execute this process flow using deployment manager i can see the prompt window for that parameter. Passing the parameter value is working perfectly fine.
but how can i pass the value to this process flow when i register this process flow through OEM.
i am passing the following parameters for scheduling thorough OEM to oem_exec_template.sql
RUNTIME_REP WF_LOC PROCESS SAMPLE_PF “param1” “,”

I can see the topic is raised here, but......what's the answer? ( I have the same problem )
I have a mapping input parameter, use the oem_exec_template.sql to run the mapping, but fail to see where to enter the mapping input parameter. The documentation I read through doesn't refer to this possibility whatsoever.
Anyone? :-)

Similar Messages

  • How do I Pass a parameter to a SQL Component Task where the source SQL statement is also a variable

    Hi,
    I have been tasked with making a complex package more generic.
    To achieve this I need to pass a parameter to a SQL Component Task where the source SQL statement is also a variable.
    So to help articulate my question further I have create a package and database as follows; -
    USE [KWPlay]
    GO
    /****** Object: Table [dbo].[tblTest] Script Date: 05/14/2014 17:08:02 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE TABLE [dbo].[tblTest](
    [ID] [bigint] IDENTITY(1,1) NOT NULL,
    [Description] [nvarchar](50) NULL,
    CONSTRAINT [PK_tblTest] PRIMARY KEY CLUSTERED
    [ID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    I populated this table with a single record.
    I unit tested the SQL within SSMS as follows;
    SELECT * FROM dbo.tblTest
    Result; -
    ID           
    Description
    1             
    Happy
    DECLARE @myParam NVARCHAR(100)
    SET @myParam = 'Sad'
    UPDATE dbo.tblTest SET [Description] = @myParam FROM dbo.tblTest WHERE ID = 1
    SELECT * FROM dbo.tblTest
    Result; -
    ID   
    Description
    1    
    Sad
    Within the package I created two variables as follows; -
    Name: strSQL
    Scope: Package
    Data Type: String
    Value: UPDATE dbo.tblTest SET [Description] = @myParam FROM dbo.tblTest WHERE ID = 1
    Name: strStatus
    Scope: Package
    Data Type: String
    Value: Happy
    I then created a single ‘Execute SQL Task’ component within the control flow as follows; -
    However when I run the above package I get the following error; -
    SSIS package "Package.dtsx" starting.
    Error: 0xC002F210 at Execute SQL Task, Execute SQL Task: Executing the query "UPDATE dbo.tblTest SET [Description] = @myParam FR..." failed with the following error:
    "Parameter name is unrecognized.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
    Task failed: Execute SQL Task
    Warning: 0x80019002 at Package: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED. 
    The Execution method succeeded, but the number of errors raised (1) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches the number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the
    errors.
    SSIS package "Package.dtsx" finished: Failure.
    I also tried; - 
    Name: strSQL
    Scope: Package
    Data Type: String
    Value: UPDATE dbo.tblTest SET [Description] = ? FROM dbo.tblTest WHERE ID = 1
    However I received the error; - 
    SSIS package "Package.dtsx" starting.
    Error: 0xC002F210 at Execute SQL Task, Execute SQL Task: Executing the query "UPDATE dbo.tblTest SET [Description] = ? FROM dbo...." failed with the following error: "Parameter name is unrecognized.". Possible failure reasons: Problems with
    the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
    Task failed: Execute SQL Task
    Warning: 0x80019002 at Package: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED.  The Execution method succeeded, but the number of errors raised (1) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches
    the number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the errors.
    SSIS package "Package.dtsx" finished: Failure.
    Kind Regards,
    Kieran.
    Kieran Patrick Wood http://www.innovativebusinessintelligence.com http://uk.linkedin.com/in/kieranpatrickwood http://kieranwood.wordpress.com/

    Tried; - 
    Name: strSQL
    Scope: Package
    Data Type: String
    Value: UPDATE dbo.tblTest SET [Description] = ? FROM dbo.tblTest WHERE ID = 1
    and; - 
    Result; - 
    SSIS package "Package.dtsx" starting.
    SSIS package "Package.dtsx" finished: Success.
    Therefore the answer was to put the parameter number rather than the parameter name under the parameter mapping tab-> parameter name column. 
    Kieran Patrick Wood http://www.innovativebusinessintelligence.com http://uk.linkedin.com/in/kieranpatrickwood http://kieranwood.wordpress.com/

  • Passing  Time Parameter to a SQL Script

    I am trying to create an SSIS package that will extract data from a non BPC database  to load into BPC. I am calling the package from DM prompting for the time parameter.  However,   I am having problems passing the parameter to the SQL script.  I am using OLEDB Data source task using the SQL command - Using the following scrip where the '?'' is the prompt for the BPC time parameter.  Any suggestions on how to resolve would be greatly appreciated.
    SELECT
             CASE
                      WHEN LEN(GLAccountNumber)=10
                      THEN LEFT(GLAccountNumber,6)
                      ELSE GLAccountNumber
             END                                                   AS ACCOUNT     ,
             'F_CLO'                                               AS ACCTDETAIL  ,
             'ACTUAL'                                              AS CATEGORY    ,
             RTRIM(CompanyCode)                             AS COMPANY     ,
             RTRIM(CompanyDepartment)                              AS COSTCENTER  ,
             'FM'                                                  AS DATASRC     ,
             'NON_INTERCO'                                         AS INTERCO     ,
             'NOMAT'                                               AS MATERIALS   ,
             'NOPC'                                                AS PROFITCTR   ,
             'LC'                                                  AS RPTCURRENCY ,
             CAST(YearNumber AS CHAR(4)) + '.' + MonthAbbreviation AS [TIME]      ,
             SUM(TransactionAmount)                                AS SIGNEDDAA
    FROM     dbo.GLTransactionDimension a WITH (nolock)
             JOIN dbo.GLTransactionFacts b WITH (nolock)
             ON       a.GLTransactionDimensionKey = b.GLTransactionDimensionKey
             JOIN dbo.DateDimension c WITH (nolock)
             ON       b.EntryDateDimensionKey = c.DateDimensionKey
    WHERE    EntryDateDimensionKey         LIKE
              CASE
                      WHEN RIGHT(?,3)='APR' THEN '200904%'
                      WHEN RIGHT(?,3)='MAY' THEN '200905%'
               END
             AND      RowType = 'T'
    GROUP BY CompanyCode ,
             DepartmentCode     ,
             CompanyDepartment  ,
             GLAccountNumber    ,
             YearNumber         ,
             MonthAbbreviation
    ORDER BY CompanyCode ,
             DepartmentCode     ,
             GLAccountNumber    ,
             YearNumber         ,
             MonthAbbreviation

    Hi Steven,
    Use SQL task without parameter
    Into DM package into Modify script Build a variable where you will build the entire sql string and of course you will be able to pass also the variable.
    After that you will call into Modify scrip something like:
    TASK( Yourtask, SQL, "the entire SQL with parameter")
    Regards
    Sorin

  • How to pass a parameter into execute sql task and later use it into dataflow task?

    i am in a situation, where i have a logging table in which i have a primary key called ETL_log_ID which is an identity column and acts as a foreign key for various fact table and dimension tables which are populated using SSIS packages. Now i wanna use the
    ETL_log_ID as a parameter in the execute sql task which populates the log table and pass the same value in the data flow task which populates the facts and dimension. Can you let me know how to pass the parameter in a step by step procedure.
    Thanks,
    Nikhil
      

    Nikhil,
    You can check the following :
    http://www.programmersedge.com/post/2013/03/05/ssis-execute-sql-task-mapping-parameters-and-result-sets.aspx
    http://stackoverflow.com/questions/7610491/how-to-pass-variable-as-a-parameter-in-execute-sql-task-ssis
    Regarding the usage in Dataflow task, Can you elaborate on that a little?
    Thanks,
    Jay
    <If the post was helpful mark as 'Helpful' and if the post answered your query, mark as 'Answered'>

  • How to pass a parameter into a sql expression?

    How to pass a report parameter into a sql expression?

    Hi Donald,
        The functionality of using a parameter in a function is only available in the formula editor and not in SQL Expression. Parameters cannot be passed to the SQL Expression, the main purpose of the SQL Expression is to make use of Database functions to make calculations at the database level but the current functionality of the product only allows you to use Database fields.
    There is an article that talks on SQL Expressions and can be useful http://technicalsupport.businessobjects.com/KanisaSupportSite/search.do?cmd=displayKC&docType=kc&externalId=c2016184&sliceId=&dialogID=6018612&stateId=1%200%206020316
    Regards,
    Vinay

  • Passing int[] parameter to PL/SQL stored proc via SQLJ

    This should be easy. I want to pass an array of Java integers i.e. int[] as an IN parameter to a PL/SQL stored procedure that expects a TABLE OF INTEGER.
    But SQLJ keeps giving me an error when I try to call the procedure, saying that int[] is an unsupported Java type.
    Is this true? Is it really impossible to pass a simple int array into a PL/SQL procedure via SQLJ?
    All help will be gratefully received.
    Chris

    Yes, you cannot pass int[], since index-by-tables are not supported by either JDBC or by SQLJ.
    (Well, I lied just a little bit: if you use an 8.1.7 or later JDBC-OCI driver, then there is some support for scalar index-by-tables. But not with thin, kprb drivers, or with SQLJ.)
    null

  • How to pass custom parameter to WebGui

    Hello,
    we have ITS Standalone and we are using WebGui execution to launch a custom transaction. We would like to pass via URL a value to put into a custom field on the dynpro. For example, in our custom dynpro there is the file P_FIELD1 and we want to pass the value to put into this filed when the transaction is loaded.
    The parameter ~webgui is set to the value 1 into the ztest.srvc service.
    Following our url:
    http://itsserver/scripts/wgate/ztest/!
    We have tried to pass a value into the URL, like http://itsserver/scripts/wgate/ztest/!?P_FIELD1=my_value but It doesn't work.
    Thanks and best regards.

    Salve Matteo,
    Could you please review the following [Wiki|http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=22375]? An excerpt:
    For ITS 6.20 standalone with i.e. R/3 Enterprise 4.7 the URL would be
    http://ITS_HOST:ITS_PORT/scripts/wgate/webgui/!?~transaction=*se38 RS38M-PROGRAMM=rsparam;DYNP_OKCODE=SHOP
    I hope this helps.
    Buona giornata,
    Cristiano

  • Passing user parameter into your sql query

    I've created two user parameters...'Order_date_from' and 'Order_date_to'
    I've written a simple query to list the total order amount, order number, party name and ordered date
    Select sum ((unit_selling_price)*(ordered_quantity)), count(line_number), oe_order_headers_all.order_number, hz_parties.party_name, oe_order_headers_all.ordered_date
    from oe_order_lines_all,
    oe_order_headers_all,
    hz_parties,
    hz_cust_accounts
    where oe_order_lines_all.header_id=oe_order_headers_all.header_id
    and oe_order_headers_all.sold_to_org_id = hz_cust_accounts.cust_account_id
    and hz_cust_accounts.party_id = hz_parties.party_id
    group by order_number, party_name, ordered_date;
    I want to know how I can pass the value for the above mentioned parameters into my sql query so that it reflects as the 'ordered_date' in the report and only shows the data for the dates that the user inputs.
    Any feedback would be appreciated. Thanks.

    I want to know how I can pass the value for the above
    mentioned parameters into my sql query so that it
    reflects as the 'ordered_date' in the report and only
    shows the data for the dates that the user inputs.
    Any feedback would be appreciated. Thanks.And how does the "user" input these dates?

  • Can't pass a parameter to an SQL Query

    I've looked for about an hour or more now on the web, java.sun.com, but can't find what I need:
    I have a page called display.jsp, and I call it from the browser
    http://localhost/display.jsp?libnum=1
    In the page I have the following code:
    <sql:query var="profileQuery" dataSource="${profileDS}">
    SELECT * FROM singles.profile where libnum=?
    <sql:param value="${libnum}"/>
    </sql:query>
    However, the database sees the query as
    " SELECT * FROM singles.profile where libnum=null"
    So, my question is how do I make this line work ? :
    " <sql:param value="${libnum}"/> "
    can you help ?
    thanks !
    Dennis

    Dude .....
    Here's my code now -- solved it... phew..
    Just to think of it ... what a difference between "libnum" and "param.libnum". That was like 3-4, if not 5 hour difference for me.
    <sql:query var="profileQuery" dataSource="${profileDS}">
    SELECT * FROM singles.profile where libnum=?
    <sql:param value="${param.libnum}"/>
    </sql:query>
    Dennis

  • Parameter value in sql statement (Custom Folder)

    Hi ,
    I want to formulate a custom folder - consisting of a sql statement , inside of which there is a parameter. Then in Desktop , the users can select a number as the searching criteria and this value will replace the parameter in sql statement , as in the following:
    select CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE , SUM_POSOTITA from
    select CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE , SUM_POSOTITA , row_number() over (order by sum_posotita desc) rw  from
      (SELECT CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, TO_DATE(DATES_EKTELESIS,'DD/MM/RRRR') DATES ,SUM(POSOTITA) SUM_POSOTITA
              FROM  EKTELESI_AT_SINT_CLINIC A, MITROO_FARMAKOU B
               WHERE CODE_FARMAKOU = FARMAK_CODE
               GROUP BY CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, DATES_EKTELESIS))
      where rw<=&p
      order by SUM_POSOTITA desc The problem is that the use of parameter , whereas in sql*plus is valid, in Discoverer is not....
    What can i do in this situation...????
    Thanks , a lot
    Simon

    However , a peculiar event happens....
    whereas the sql statement is:
    select CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE , SUM_POSOTITA,RW from
    select CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE , SUM_POSOTITA , row_number() over (order by sum_posotita desc) rw  from
      (SELECT CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, TO_DATE(DATES_EKTELESIS,'DD/MM/RRRR') DATES ,SUM(POSOTITA) SUM_POSOTITA
              FROM  EKTELESI_AT_SINT_CLINIC A, MITROO_FARMAKOU B
               WHERE CODE_FARMAKOU = FARMAK_CODE
               GROUP BY CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, DATES_EKTELESIS
      UNION ALL
      SELECT CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, TO_DATE(DATES_EKTELESIS,'DD/MM/RRRR') DATES,SUM(POSOTITA) SUM_POSOTITA
              FROM  EKTELESI_AT_SINT_EX_IATR A, MITROO_FARMAKOU B
               WHERE CODE_FARMAKOU = FARMAK_CODE
               GROUP BY CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, DATES_EKTELESIS
      UNION ALL
      SELECT CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, TO_DATE(DATES_EKTELESIS,'DD/MM/RRRR') DATES,SUM(POSOTITA) SUM_POSOTITA
              FROM  EKTELESI_AT_SINT_FOREON_MS A, MITROO_FARMAKOU B
               WHERE CODE_FARMAKOU = FARMAK_CODE
               GROUP BY CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, DATES_EKTELESIS
      UNION ALL
      SELECT CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, TO_DATE(DATES_EKTELESIS,'DD/MM/RRRR') DATES,SUM(POSOTITA) SUM_POSOTITA
              FROM  EKTELESI_GEN_SINT_KLIN A, MITROO_FARMAKOU B
               WHERE CODE_FARMAKOU = FARMAK_CODE
               GROUP BY CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, DATES_EKTELESIS
      UNION ALL
      SELECT CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, TO_DATE(DATES_EKTELESIS,'DD/MM/RRRR') DATES,SUM(POSOTITA) SUM_POSOTITA
              FROM  EKTELESI_GEN_SINT_EX_IATR A, MITROO_FARMAKOU B
               WHERE CODE_FARMAKOU = FARMAK_CODE
               GROUP BY CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, DATES_EKTELESIS))
      order by RW ascand produces the results....
    CODE_FARMAKOU                            EMP_NAME                                                                         PACKTYPE                     PACKSIZE                  SUM_POSOTITA         RW
    1000003279                               MOXACEF                                                                          BT                           40(BLIST10X4)                       45          1
    0000014071                               DOPAMINE HYDROCHLORIDE                                                           VIAL                         5 ML X 25                           30          2
    1000016655                               KABIVEN                                                                          BT                           50ÖÕÓ.×1,7ML                        21          3
    1000014127                               DEPON VIT. C                                                                     BT                           2TUBX10                              6          4
    0000002419                               FACTREL INJECTION                                                                VIAL                         2 ML                                 5          5
    0000086289                               DETUSSIN EXPECTORANT                                                             BOT                          120 ML                               3          6
    1000016655                               KABIVEN                                                                          BT                           50ÖÕÓ.×1,7ML                         2          7
    1000014127                               DEPON VIT. C                                                                     BT                           2TUBX10                              2          8
    1000000760                               DEPON                                                                            BT                           20(BLIST2X10)                        2          9
    1000003279                               MOXACEF                                                                          BT                           40(BLIST10X4)                        1         10
    1000003279                               MOXACEF                                                                          BT                           40(BLIST10X4)                        1         11
    1000000760                               DEPON                                                                            BT                           20(BLIST2X10)                        1         12
    12 rows selectedIn Discoverer , even i select to see -as parameter- let's say the 10 first records, the system displays the 7 first records , whereas when i want to see the 1,2,3,4,5,6,7 first records the system works fine....and displays accordingly 1,2,3,4,5,6,7 first records. The problem occurs above the 8th record-as parameter selected..!!!!!
    I defined the parameter as :Rw<=:Rw
    What may be the problem...????
    SORRY!!!!! I FOUND THE PROBLEM ....!!!!
    Regards and many thanks,
    Simon
    Message was edited by:
    sgalaxy

  • Web link to pass the parameter to custom web app then update the field

    Hi,
    I have created the web link in service request object to refer Account Object. I want to let user able to select the account from web link then base on the current SR no and account that have created update the record in CRMOD. My question is how to pass the parameter out to my external web app so that they can update my SR correctly?
    Thank you

    Hi Messer,
    I have put in the syntax as below :-
    https://secure-ausomxega.crmondemand.com/OnDemand/user/AssocAccountPopup?mapBC=Service+Request&OACTRL=Account&ophi=PopupNewForm.Account+Id&pfid=PopupNewForm&OMTHD=AssocPopup&OMTGT=PopupSearchList&assocInit=Y&opht=4&OAOBJ=Service+Request&mapField=Account&ophd=PopupNewForm.Account&ophpd=3&disableclear=Y&ophr=AssocAccountPopup&assocval=&ParentType=Edit
    This pop up screen wil let the user to select the account then i will pass the account and the SR to external web app to update back the CRMOD. I am not too sure the above syntax is correct or maybe can you give some example.
    I am new in CRMOD, hope that you can advice on this.
    Thank you,
    SK

  • How to pass a structure in PL/SQL external proc.

    This is for educational purpose only. I am trying to implement kernel32.dll and shell32.dll in PL/SQL using external proc. Everything is working fine, except When there is a structure in OUT parameter.
    My database version.
    SQL> SELECT * FROM v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
    PL/SQL Release 10.2.0.3.0 - Production
    CORE    10.2.0.3.0      Production
    TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
    NLSRTL Version 10.2.0.3.0 - ProductionI have set up the listner.ora and tnsnames.ora and written a package called dbms_kernel32sb.
    There are 9 program units.
    1. CreateFile -- working fine
    2. CloseFile -- working fine
    3. GetSize -- working fine
    4. FindFirstFile -- NOT working, because one OUT parameter has the structure type WIN32_FIND_DATA.
    5. GetFileTime -- NOT working, because one OUT parameter has the structure type FILETIME
    6. GetDiskFreeSpace -- working fine
    7. GetDriveType -- working fine.
    8. GetLastError -- working fine
    9. ExecuteCommand -- working fine.
    Here is the package specification:
    CREATE OR REPLACE PACKAGE dbms_kernel32sb AS
        Name: dbms_kernel32sb.pks
        Author: Saubhik Banerjee
        Date: 24th Jan 2011
        Version: 1.0
        Comment: This package is to implement some functionality from kernel32.dll.
                 Usng extproc
    OPEN_EXISTING_FILE CONSTANT PLS_INTEGER :=3;
    FILE_ATTRIBUTE_NORMAL CONSTANT PLS_INTEGER :=128;
    DISABLE_FILE_SHARE_MODE CONSTANT PLS_INTEGER :=0;
    NO_FILE_SECURITY_ATTRIBUTE CONSTANT PLS_INTEGER :=0;
    NO_TEMPLATE_FILE CONSTANT PLS_INTEGER :=0;
    GENERIC_FILE_ACCESS CONSTANT PLS_INTEGER :=0;
    FILE_SIZE_HIGH CONSTANT PLS_INTEGER :=400000000;
    EXECUTE_FILE CONSTANT VARCHAR2(4):='open';
    PRINT_FILE CONSTANT VARCHAR2(5):='print';
    NO_PARAMATER CONSTANT VARCHAR2(2):=' ';
    FUNCTION CreateFile(pi_FileName VARCHAR2 --1, File name
                ,pi_DesiredAccess BINARY_INTEGER --2, Type of access required (read/write ect)
                ,pi_ShareMode BINARY_INTEGER --3,  share mode
                ,pi_SecurityAttributes BINARY_INTEGER --4, securoty attribute
                ,pi_CreationDisposition BINARY_INTEGER --5, open existing, create new etc
                ,pi_FlagsAndAttributes BINARY_INTEGER --6, File attribute- normal
                ,pi_TemplateFile BINARY_INTEGER) --Not required.
        Return BINARY_INTEGER;
    FUNCTION CloseFile (pi_FileHandle BINARY_INTEGER)
                         Return BINARY_INTEGER;
    FUNCTION GetSize (pi_FileHandle BINARY_INTEGER,
                       pio_FileSizeHigh IN OUT BINARY_INTEGER)
                   RETURN BINARY_INTEGER;
    FUNCTION FindFirstFile ( pi_FileName VARCHAR2
                             ,pio_Win32_Find_data OUT 
                                 WIN32_FIND_DATA
    RETURN BINARY_INTEGER;                                             
    FUNCTION GetFileTime ( pi_FileHandle BINARY_INTEGER
                           ,pio_FileCreationTime IN OUT FILETIME
                           ,pio_LastAccessTime   IN OUT FILETIME
                           ,pio_LastWriteTime    IN OUT FILETIME
    RETURN BINARY_INTEGER;
    FUNCTION GetDiskFreeSpace ( pi_RootPathName VARCHAR2
                                ,pio_SectorsPerCluster  OUT BINARY_INTEGER
                                ,pio_BytesPerSector   OUT BINARY_INTEGER
                                ,pio_NumberOfFreeClusters  OUT BINARY_INTEGER
                                ,pio_TotalNumberOfClusters  OUT BINARY_INTEGER
    RETURN BINARY_INTEGER;    
    FUNCTION GetDriveType( pi_driveLetter VARCHAR2) RETURN VARCHAR2;
    FUNCTION GetLastError RETURN BINARY_INTEGER;   
    FUNCTION ExecuteCommand ( pi_OperationType VARCHAR2
                              ,pi_FileName VARCHAR2
                              ,pi_Parameters VARCHAR2
                              ,pi_DefaultDirectory VARCHAR2
    RETURN VARCHAR2;
    END dbms_kernel32sb;
    Here is the package body:
    CREATE OR REPLACE PACKAGE BODY dbms_kernel32sb AS
    /* Name: dbms_kernel32sb.pkb
        Author: Saubhik Banerjee
        Date: 24th Jan 2011
        Version: 1.0
        Comment: This package is to implement some functionality from kernel32.dll.
                 Usng extproc
      FUNCTION
      CreateFile( pi_FileName VARCHAR2 --1
                , pi_DesiredAccess BINARY_INTEGER --2
                , pi_ShareMode BINARY_INTEGER --3
                , pi_SecurityAttributes BINARY_INTEGER --4
                , pi_CreationDisposition BINARY_INTEGER --5
                , pi_FlagsAndAttributes BINARY_INTEGER --6
                , pi_TemplateFile BINARY_INTEGER) --7
        Return BINARY_INTEGER IS EXTERNAL LIBRARY kernel32 Name "CreateFileA"
        PARAMETERS(  pi_FileName STRING
                   , pi_DesiredAccess long
                   , pi_ShareMode long
                   , pi_SecurityAttributes long
                   , pi_CreationDisposition long
                   , pi_FlagsAndAttributes long
                   , pi_TemplateFile long
                   , return long);
    FUNCTION CloseFile (pi_FileHandle BINARY_INTEGER)
                         Return BINARY_INTEGER
         IS EXTERNAL
         LIBRARY kernel32 Name "CloseHandle"
         PARAMETERS (pi_FileHandle long, return long);
    FUNCTION GetSize (pi_FileHandle BINARY_INTEGER,
                       pio_FileSizeHigh IN OUT BINARY_INTEGER)
                   RETURN BINARY_INTEGER
         IS EXTERNAL
        LIBRARY kernel32 NAME "GetFileSize"
        PARAMETERS (pi_FileHandle long, pio_FileSizeHigh long, return long );
      FUNCTION GetFileTime ( pi_FileHandle BINARY_INTEGER
                           ,pio_FileCreationTime IN OUT FILETIME
                           ,pio_LastAccessTime   IN OUT FILETIME
                           ,pio_LastWriteTime    IN OUT FILETIME
       RETURN BINARY_INTEGER
         IS EXTERNAL
        LIBRARY kernel32 NAME "GetFileTime"
        WITH CONTEXT
        PARAMETERS ( CONTEXT,
                      pi_FileHandle long
                    , pio_FileCreationTime  OCIColl
                    , pio_FileCreationTime INDICATOR SHORT
                    , pio_LastAccessTime  OCIColl
                   , pio_LastAccessTime INDICATOR SHORT
                    , pio_LastWriteTime OCIColl
                    , pio_LastWriteTime INDICATOR SHORT
                    , return long );                  
    FUNCTION FindFirstFile ( pi_FileName VARCHAR2
                             ,pio_Win32_Find_data OUT 
                                 WIN32_FIND_DATA
    RETURN BINARY_INTEGER
    IS EXTERNAL
        LIBRARY kernel32 NAME "FindFirstFileA"
        --WITH CONTEXT
        PARAMETERS
                    ( --CONTEXT,
                     pi_FileName STRING--, pi_FileName INDICATOR SHORT
                    , pio_Win32_Find_data  BY REFERENCE OCIColl--,pio_Win32_Find_data INDICATOR long
                    , return long );
    FUNCTION GetDiskFreeSpace ( pi_RootPathName VARCHAR2
                                ,pio_SectorsPerCluster  OUT BINARY_INTEGER
                                ,pio_BytesPerSector   OUT BINARY_INTEGER
                                ,pio_NumberOfFreeClusters  OUT BINARY_INTEGER
                                ,pio_TotalNumberOfClusters  OUT BINARY_INTEGER
    RETURN BINARY_INTEGER
      IS EXTERNAL
        LIBRARY kernel32 NAME "GetDiskFreeSpaceA"
        PARAMETERS (  pi_RootPathName STRING
                    , pio_SectorsPerCluster BY REFERENCE long
                    , pio_BytesPerSector BY REFERENCE long
                    , pio_NumberOfFreeClusters BY REFERENCE long
                    , pio_TotalNumberOfClusters BY REFERENCE long
                    , return long );   
      FUNCTION GetDriveTypeA( pi_driveLetter VARCHAR2) RETURN BINARY_INTEGER   
      IS EXTERNAL
      LIBRARY kernel32 NAME "GetDriveTypeA"
      PARAMETERS (pi_driveLetter STRING, RETURN long);
    FUNCTION GetDriveType( pi_driveLetter VARCHAR2) RETURN VARCHAR2 IS
    BEGIN
      CASE  GetDriveTypeA(pi_driveLetter) 
       WHEN 2 THEN RETURN 'Removable';
       WHEN 3 THEN RETURN 'Drive Fixed';
       WHEN 4 THEN RETURN 'Remote';
       WHEN 5 THEN RETURN 'Cd-Rom';
       WHEN 6 THEN RETURN 'Ram disk';
       ELSE RETURN 'Unrecognized';
    END CASE;                              
    END;
    FUNCTION GetLastError  RETURN BINARY_INTEGER
    IS EXTERNAL
    LIBRARY kernel32 NAME "GetLastError"
    PARAMETERS (return long);
    FUNCTION ShellExecute( pi_Hwnd BINARY_INTEGER
                          ,pi_Operation VARCHAR2
                          ,pi_FileName VARCHAR2
                          ,pi_Parameters VARCHAR2
                          ,pi_DefaultDirectory  VARCHAR2
                          ,pi_ShowCmd BINARY_INTEGER
                          ) RETURN BINARY_INTEGER
    IS EXTERNAL
    LIBRARY SHELL32 NAME "ShellExecuteA"
    PARAMETERS (pi_Hwnd long,pi_Operation STRING,pi_FileName STRING
                 ,pi_Parameters STRING,pi_DefaultDirectory STRING
                 ,pi_ShowCmd long, return long
    FUNCTION ExecuteCommand ( pi_OperationType VARCHAR2
                              ,pi_FileName VARCHAR2
                              ,pi_Parameters VARCHAR2
                              ,pi_DefaultDirectory VARCHAR2
    RETURN VARCHAR2 IS
      v_return_val BINARY_INTEGER;
    BEGIN
      v_return_val:= ShellExecute(0,pi_OperationType
                                 ,pi_FileName,pi_Parameters
                                 ,pi_DefaultDirectory,0
      IF v_return_val <=32 THEN
       RETURN 'Error!';
      ELSE RETURN 'Success!';
      END IF;
    END;
    END dbms_kernel32sb;
    Now the working demos:
    SQL> SET SERVEROUT ON
    SQL> /* Demo I:- How to obtain file size */
    SQL> DECLARE
      2    v_FileSize BINARY_INTEGER;
      3    v_FileSizeHigh PLS_INTEGER;
      4    v_FileHandle BINARY_INTEGER;
      5    v_filename VARCHAR2(500) :='C:\test2.csv';
      6    v_dummy BINARY_INTEGER;
      7  BEGIN
      8    v_FileSizeHigh := DBMS_KERNEL32SB.FILE_SIZE_HIGH;
      9    v_FileHandle:=DBMS_KERNEL32SB.CreateFile(v_filename -- File name
    10                            ,DBMS_KERNEL32SB.GENERIC_FILE_ACCESS
    11                            ,DBMS_KERNEL32SB.DISABLE_FILE_SHARE_MODE
    12                            ,DBMS_KERNEL32SB.NO_FILE_SECURITY_ATTRIBUT
    13                            ,DBMS_KERNEL32SB.OPEN_EXISTING_FILE
    14                            ,DBMS_KERNEL32SB.FILE_ATTRIBUTE_NORMAL
    15                            ,DBMS_KERNEL32SB.NO_TEMPLATE_FILE);
    16   v_FileSize := DBMS_KERNEL32SB.Getsize(v_FileHandle, v_FileSizeHigh)
    17   DBMS_OUTPUT.put_line('File Size in Bytes: ' ||v_FileSize);
    18   v_dummy:=DBMS_KERNEL32SB.CloseFile(v_FileHandle);
    19  END;
    20  /
    File Size in Bytes: 61
    PL/SQL procedure successfully completed.
    SQL>
    SQL> /* Demo II:- How to find free disk space  */
    SQL> DECLARE
      2    v_rootpath VARCHAR2(500) :='C:\';
      3    v_dummy BINARY_INTEGER;
      4    v_sectorspercluster BINARY_INTEGER;
      5    v_bytespersector BINARY_INTEGER;
      6    v_numberoffreeclusters BINARY_INTEGER;
      7    v_totalnumberofclusters BINARY_INTEGER;
      8    v_freespace NUMBER;
      9    v_totalspace NUMBER;
    10  BEGIN
    11    v_dummy:=DBMS_KERNEL32SB.GetDiskFreeSpace(v_rootpath
    12                                              ,v_sectorspercluster
    13                                              ,v_bytespersector
    14                                              ,v_numberoffreeclusters
    15                                              ,v_totalnumberofclusters
    16                                              );
    17                                              
    18    DBMS_OUTPUT.put_line('Sector pre Cluster: ' ||v_sectorspercluster);
    19    DBMS_OUTPUT.put_line('Bytes per sector: ' ||v_bytespersector);
    20    DBMS_OUTPUT.put_line('Number Of Free Clusters: ' ||v_numberoffreeclusters);
    21    DBMS_OUTPUT.put_line('Total Number Of Clusters: ' ||v_totalnumberofclusters);
    22    v_freespace:=v_numberoffreeclusters/1024/1024/1024;
    23    v_freespace:=ROUND(v_freespace*v_sectorspercluster*v_bytespersector,3);
    24    v_totalspace:=v_totalnumberofclusters/1024/1024/1024;
    25    v_totalspace:=ROUND(v_totalspace*v_sectorspercluster*v_bytespersector,3);
    26    DBMS_OUTPUT.put_line('Total Space (GB):' ||v_totalspace);
    27    DBMS_OUTPUT.put_line('Total number of Free space (GB): '||v_freespace );
    28  END;
    29  /
    Sector pre Cluster: 8
    Bytes per sector: 512
    Number Of Free Clusters: 739477
    Total Number Of Clusters: 9765622
    Total Space (GB):37.253
    Total number of Free space (GB): 2.821
    PL/SQL procedure successfully completed.
    SQL>
    SQL> /* Demo IV:- How to get drive type*/
    SQL> SELECT dbms_kernel32sb.GetDriveType('C:\') FROM dual;
    DBMS_KERNEL32SB.GETDRIVETYPE('C:\')
    Drive Fixed
    SQL> SELECT dbms_kernel32sb.GetDriveType('D:\') FROM dual;
    DBMS_KERNEL32SB.GETDRIVETYPE('D:\')
    Cd-Rom
    SQL> SELECT dbms_kernel32sb.GetDriveType('E:\') FROM dual;
    DBMS_KERNEL32SB.GETDRIVETYPE('E:\')
    Unrecognized
    SQL>
    SQL> /* Demo V:- How to execute an Operating System Command*/
    SQL> DECLARE
      2   v_FileToExecute VARCHAR2(20):='test.bat';
      3   v_Parameter VARCHAR2(20):='test1.csv';--dbms_kernel32sb.NO_PARAMATER
      4   v_DefaultDirectory VARCHAR2(20):='C:\';
      5   v_ReturnValue VARCHAR2(20);
      6  BEGIN
      7    v_ReturnValue:=dbms_kernel32sb.ExecuteCommand(dbms_kernel32sb.EXECUTE_FILE
      8                                                  ,v_FileToExecute
      9                                                  ,v_Parameter
    10                                                  ,v_DefaultDirectory
    11                                                  );
    12   DBMS_OUTPUT.put_line('Status: '||v_ReturnValue);                               
    13  END;
    14  /
    Status: Success!
    PL/SQL procedure successfully completed.
    SQL> Now the sub programs with structures are NOT getting called successfully.
    SQL> /* Demo III:- How to obtain file time */
    SQL> DECLARE
      2    v_FileHandle BINARY_INTEGER;
      3    v_filename VARCHAR2(500) :='C:\test2.csv';
      4    v_dummy BINARY_INTEGER;
      5    v_filecreationtime FILETIME;
      6    v_lastaccesstime FILETIME;
      7    v_lastwritetime FILETIME;
      8    v_err BINARY_INTEGER;
      9  BEGIN
    10    v_FileHandle:=DBMS_KERNEL32SB.CreateFile(v_filename -- File name
    11                            ,DBMS_KERNEL32SB.GENERIC_FILE_ACCESS
    12                            ,DBMS_KERNEL32SB.DISABLE_FILE_SHARE_MODE
    13                            ,DBMS_KERNEL32SB.NO_FILE_SECURITY_ATTRIBUTE
    14                            ,DBMS_KERNEL32SB.OPEN_EXISTING_FILE
    15                            ,DBMS_KERNEL32SB.FILE_ATTRIBUTE_NORMAL
    16                            ,DBMS_KERNEL32SB.NO_TEMPLATE_FILE);
    17   v_dummy := DBMS_KERNEL32SB.GetFileTime( v_FileHandle
    18                                          ,v_filecreationtime
    19                                          ,v_lastaccesstime
    20                                          ,v_lastwritetime
    21                                          );
    22   v_err:=DBMS_KERNEL32SB.GetLastError;                                
    23   DBMS_OUTPUT.put_line('File Size in Bytes: ' ||v_dummy);
    24   DBMS_OUTPUT.put_line('Error:'||v_err);
    25   v_dummy:=DBMS_KERNEL32SB.CloseFile(v_FileHandle);
    26  END;
    27  /
    File Size in Bytes: 0
    Error:203
    PL/SQL procedure successfully completed.
    SQL> So, I have noticed that, Where ever a STRUCTURE is involved in external routine, there is a problem. I want to know, How to implement functions with STRUCTURE as OUT parameter.
    Forgot to mention: This is my FILETIME object which corresponds to FILETIME structure of win32.
    CREATE OR REPLACE TYPE FILETIME_rec IS OBJECT
                              ( LowDateTime NUMBER
                               ,HighDateTime NUMBER
    CREATE OR REPLACE TYPE FILETIME IS TABLE OF  FILETIME_rec;Edited by: Saubhik on Feb 1, 2011 4:15 PM

    Saubhik wrote:
    This is for educational purpose only. I am trying to implement kernel32.dll and shell32.dll in PL/SQL using external proc. Interesting. Familiar with the Wn32 API, but do not run Oracle on Windows and never looked at this aspect of integration.
    So, I have noticed that, Where ever a STRUCTURE is involved in external routine, there is a problem. I want to know, How to implement functions with STRUCTURE as OUT parameter.
    Forgot to mention: This is my FILETIME object which corresponds to FILETIME structure of win32.The problem is that this passes the parameter by reference and not value. In a vanilla C/C++/Delphi program, you will create a variable of that struct and then pass a long pointer to that variable when making the API call. That pointer will be dereferenced and the memory it points to, populated. This is not a problem as the underlying DLL you call that does this, uses your process's data segment.
    Extproc is different. In order to protect the integrity of the database server process, an external call is done by a "proxy" process. It acts as the interface between your PL/SQL code and the actual external call.
    In this case, this "proxy" process will be doing the implicit LoadLibrary() call to load kernel32.dll interface - and the DLL will expect to dereference and access this process's memory struct to populate it. This "proxy" process in turn needs to know that despite it calling the interface by reference, it needs to return that parameter to PL/SQL by value - as your PL/SQL code cannot dereference a pointer passed back by that "proxy" process and access its memory to gain access to that struct.
    In basic terms - that argument is a 32 bit number containing a pointer. That is what the "proxy" process needs to pass to the interface call. Your code is passing a struct and not a pointer, right?
    And that is the basic problem I believe. How to address this.. not sure. You can have your own DLL as interface that does not use pointers but expect arguments to be passed by value. But this will suck as you then need to include a custom DLL to deploy and have PL/SQL call that, instead of simply accessing and calling the native kernel interface.
    Doubt that many Win32 programmers with OCI (Oracle Call Interface) frequents this forum. So perhaps this is not the best place to ask. I would be hitting Metalink (support.oracle.com) search function in your sho3s though as there should be support notes dealing with this subject matter.

  • How to pass dynamic parameter to a database function in OBIEE

    Hi,
    I have a requirement like this. I have to create one report in OBIEE which was in Discoverer. Now in discoverer report there are some calculated item in the worksheet based on database pkg.functions. The parameter which user gives at run time that parameters are then passed to the discoverer calculated items dynamically. But I am not able to do this in OBIEE answers.
    Can anyone tell me step by step how I can able to pass the user selected parameter values in OBIEE answer level.
    The example:
    GET_COMM_VALUE_PTD("AFE Cost & Commitment".Afe Id,:"Period Name(AFE)","AFE Cost & Commitment".Data Sel,"AFE Cost & Commitment".Org Id)
    GET_COMM_VALUE_PTD --- Function database
    ("AFE Cost & Commitment".Afe Id,:"Period Name(AFE)","AFE Cost & Commitment".Data Sel,"AFE Cost & Commitment".Org Id --- Parameters... :"Period Name(AFE)" is the dynamic parameter selected run time by user.
    Please help.
    Thanks
    Titas

    Hi,
    I already did that. But the existing discoverer re value report is showing correct value but the OBIEE report with EVALUATE function shows incorrect value.
    The requirement is to create a OBIEE Dashboard from a Discoverer existing report. Now in discoverer report theere are several calculated items in worksheet level where database custom function is used and user selected parameter value is passed run time in that function. But when that is created in OBIEE with EVALUATE function in RPD, the report shows incorrect data. Could not understand how to pass the parameter value runtime.
    Below is the discoverer 'Show SQL' query and EVALUATE function syntax which has been used.
    SELECT APPS.XXBG_PL_PROJ_ANALYSIS_AFE_PKG.GET_COMM_VALUE_PTD(XXBG_PL_PROJ_AFE_V.AFE_ID,
    :"Period Name(AFE)",
    XXBG_PL_PROJ_AFE_V.DATA_SEL,
    XXBG_PL_PROJ_AFE_V.ORG_ID),
    XXBG_PL_PROJ_AFE_V.AFE_DESC,
    XXBG_PL_PROJ_AFE_V.AFE_NUMBER,
    XXBG_PL_PROJ_AFE_V.APPROVED_AFE_AMOUNT
    FROM APPS.PA_PERIODS_ALL PA_PERIODS_ALL,
    APPS.XXBG_PL_PROJ_AFE_V XXBG_PL_PROJ_AFE_V
    WHERE ((XXBG_PL_PROJ_AFE_V.ORG_ID = PA_PERIODS_ALL.ORG_ID))
    AND (XXBG_PL_PROJ_AFE_V.DATA_SEL = :"Data Selection(AFE)")
    AND (PA_PERIODS_ALL.PERIOD_NAME = :"Period Name(AFE)")
    AND (XXBG_PL_PROJ_AFE_V.AFE_NUMBER = :"AFE Number(AFE)")
    AND (XXBG_PL_PROJ_AFE_V.OPERATING_UNIT = :"Operating Unit(AFE)")
    The EVALUATE function syntax is as below:
    EVALUATE('XXBG_PL_PROJ_ANALYSIS_AFE_PKG.GET_COMM_VALUE_PTD(%1,%2,%3,%4)' AS FLOAT , "BG PL Project Analysis Report_1"."AFE Cost & Commitment"."AFE Cost & Commitment.Afe Id", "BG PL Project Analysis Report_1"."Periods 1"."Periods 1.Period Name", "BG PL Project Analysis Report_1"."AFE Cost & Commitment"."AFE Cost & Commitment.Data Sel", "BG PL Project Analysis Report_1"."AFE Cost & Commitment"."AFE Cost & Commitment.Org Id")
    The PERIOD needs to be passed at run time which user will select.
    Please help to solve the issue.

  • Pass a parameter to Surikogiflex client

    Hello all,
    I'd like to know if it is possible to pass a parameter to Surikogiflex client, to be able to tell it to open a certain story.
    For example, I wonder if it is possible to have in an html page a link like
    <a href="localhost:8400/suribachi/clients/surikogiflex/?icml=/documents/doc1/story1.icml">Ed it story in Surikogi</a>
    and when the user clicks it have Surikogiflex client open loading the selected story, without passing from the Document browser window.
    Is something like this possible?
    Please assume that the correct <story> tags are present on the storylist.xml file in the /suribachiassets directory.
    Thanks.

    i am trying to pass the parent_id as a parameter to a portal page but am not able to... i can add it to the list of in parameters to the PL/SQL based parent id but when i add the parent id to the url then i get no result... i created a custom attribute for the parent id since there is no attribute build other then page group and page id... when I set the Parent ID attributes default value in the attribute properties of the item type based on PL/SQL it just brings back results for the default value and if i pass a different value for ithe parent id i dont get the correct result I get the result for the default parent id.
    I am using the followin url to pass the parent id
    http://localhost:7778/portal/page?_pageid=76,87832&_dad=portal&_schema=PORTAL&parentid=22223

  • Pass a parameter  to a 'portal page'

    I want to pass a parameter to a 'Portal' page. This parameter is a the title of the page. I found that in the page's properties a 'parameter' tab is there where we can add a parameter. But I don't know how the page will read the value of this parameter & display it.
    Thank you for your help.
    Jayasree

    i am trying to pass the parent_id as a parameter to a portal page but am not able to... i can add it to the list of in parameters to the PL/SQL based parent id but when i add the parent id to the url then i get no result... i created a custom attribute for the parent id since there is no attribute build other then page group and page id... when I set the Parent ID attributes default value in the attribute properties of the item type based on PL/SQL it just brings back results for the default value and if i pass a different value for ithe parent id i dont get the correct result I get the result for the default parent id.
    I am using the followin url to pass the parent id
    http://localhost:7778/portal/page?_pageid=76,87832&_dad=portal&_schema=PORTAL&parentid=22223

Maybe you are looking for