Optimize an Store Procedure

Hi, I have created a table and a package to perform several maintenance tasks.While creating a procedure to retrieve information. I would like to optimize the sp
Please considere that this sp is employed with a VB interface.
CREATE TABLE D_METEREOLOG (
cod_fundo CHAR(3) NOT NULL,
fecha DATE NOT NULL,
temp_max INTEGER NULL,
temp_min INTEGER NULL,
porc_humedad NUMBER(6,3) NULL,
evaporacion NUMBER(6,3) NULL,
prec_pluvial NUMBER(6,3) NULL,
velvient_min NUMBER(6,3) NULL,
velvient_max NUMBER(6,3) NULL,
usuario CHAR(12) NULL,
fech_act DATE NULL,
estado CHAR(1) NULL
ALTER TABLE D_METEREOLOG
ADD ( PRIMARY KEY (cod_fundo, fecha) ) ;
CREATE OR REPLACE PACKAGE BODY upkg_mrp
AS
AS
TYPE t_cfundo IS TABLE OF d_metereolog.cod_fundo%TYPE
INDEX BY BINARY_INTEGER;
TYPE t_fecha IS TABLE OF VARCHAR2(20)
INDEX BY BINARY_INTEGER;
TYPE t_tmax IS TABLE OF d_metereolog.temp_max%TYPE
INDEX BY BINARY_INTEGER;
TYPE t_tmin IS TABLE OF d_metereolog.temp_min%TYPE
INDEX BY BINARY_INTEGER;
TYPE t_phumedad IS TABLE OF d_metereolog.porc_humedad%TYPE
INDEX BY BINARY_INTEGER;
TYPE t_evaporacion IS TABLE OF d_metereolog.evaporacion%TYPE
INDEX BY BINARY_INTEGER;
TYPE t_ppluvial IS TABLE OF d_metereolog.prec_pluvial%TYPE
INDEX BY BINARY_INTEGER;
TYPE t_vmax IS TABLE OF d_metereolog.velvient_max%TYPE
INDEX BY BINARY_INTEGER;
TYPE t_vmin IS TABLE OF d_metereolog.velvient_min%TYPE
INDEX BY BINARY_INTEGER;
TYPE t_usuario IS TABLE OF d_metereolog.usuario%TYPE
INDEX BY BINARY_INTEGER;
TYPE t_fact IS TABLE OF VARCHAR2(20)
INDEX BY BINARY_INTEGER;
TYPE t_estado IS TABLE OF d_metereolog.estado%TYPE
INDEX BY BINARY_INTEGER;
PROCEDURE usp_getdata_dmetereolog
(p_cfundo IN OUT d_metereolog.cod_fundo%TYPE,
p_fecha IN OUT d_metereolog.fecha%TYPE,
p_tmax OUT d_metereolog.temp_max%TYPE,
p_tmin OUT d_metereolog.temp_min%TYPE,
p_phumedad OUT d_metereolog.porc_humedad%TYPE,
p_evaporac OUT d_metereolog.evaporacion%TYPE,
p_ppluvial OUT d_metereolog.prec_pluvial%TYPE,
p_vmax OUT d_metereolog.velvient_max%TYPE ,
p_vmin OUT d_metereolog.velvient_min%TYPE ,
p_usuario OUT d_metereolog.usuario%TYPE ,
p_fact OUT d_metereolog.fech_act%TYPE,
p_estado OUT d_metereolog.estado%TYPE
CREATE OR REPLACE PACKAGE BODY upkg_mrp
AS
PROCEDURE usp_getdata_dmetereolog
(p_cfundo IN OUT d_metereolog.cod_fundo%TYPE,
p_fecha IN OUT d_metereolog.fecha%TYPE,
p_tmax OUT d_metereolog.temp_max%TYPE,
p_tmin OUT d_metereolog.temp_min%TYPE,
p_phumedad OUT d_metereolog.porc_humedad%TYPE,
p_evaporac OUT d_metereolog.evaporacion%TYPE,
p_ppluvial OUT d_metereolog.prec_pluvial%TYPE,
p_vmax OUT d_metereolog.velvient_max%TYPE ,
p_vmin OUT d_metereolog.velvient_min%TYPE ,
p_usuario OUT d_metereolog.usuario%TYPE ,
p_fact OUT d_metereolog.fech_act%TYPE,
p_estado OUT d_metereolog.estado%TYPE
IS
CURSOR aux_cur IS
SELECT cod_fundo,fecha,temp_max,temp_min,porc_humedad,evaporacion,
prec_pluvial,velvient_max,velvient_min,usuario,fech_act,estado
FROM d_metereolog
WHERE cod_fundo = p_dmetereolog.cod_fundo AND
fecha = TO_DATE(p_dmetereolog.fecha,'DD/MM/YYYY');
BEGIN
FOR dyn_cur IN aux_cur
LOOP
p_dmetereolog.cod_fundo:=dyn_cur.cod_fundo;
p_dmetereolog.fecha:=dyn_cur.fecha;
p_dmetereolog.temp_max:=dyn_cur.temp_max;
p_dmetereolog.temp_min:=dyn_cur.temp_min;
p_dmetereolog.porc_humedad:=dyn_cur.porc_humedad;
p_dmetereolog.evaporacion:=dyn_cur.evaporacion;
p_dmetereolog.prec_pluvial:=dyn_cur.prec_pluvial;
p_dmetereolog.velvient_max:=dyn_cur.velvient_max;
p_dmetereolog.velvient_min:=dyn_cur.velvient_min;
p_dmetereolog.usuario:=dyn_cur.usuario;
p_dmetereolog.fech_act:=dyn_cur.estado;
END LOOP;
END usp_getdata_dmetereolog;
Best regards
Benjamin

1. I am trying to return just a single row of data
2. this should be
TO_DATE(p_fecha,'DD/MM/YYYY');
I tried to work with a single type to make it easier
/*============================================*/
CREATE OR REPLACE PACKAGE upkg_mrp
AS
TYPE t_dmetereolog IS TABLE OF d_metereolog%ROWTYPE
INDEX BY BINARY_INTEGER;
PROCEDURE usp_getdata_dmetereolog
(p_cfundo IN d_metereolog.cod_fundo%TYPE,
p_fecha IN VARCHAR2,
p_dmetereolog OUT t_dmetereolog);
END;
/*============================================*/
CREATE OR REPLACE PACKAGE BODY upkg_mrp
AS
PROCEDURE usp_getdata_dmetereolog
(p_cfundo IN d_metereolog.cod_fundo%TYPE,
p_fecha IN VARCHAR2,
p_dmetereolog OUT t_dmetereolog);
IS
CURSOR aux_cur IS
SELECT cod_fundo,fecha,temp_max,
temp_min,porc_humedad,
evaporacion,prec_pluvial,
velvient_max,velvient_min,
usuario,TO_CHAR(fech_act,'DD/MM/YYYY HH24:MI:SS'),
fech_act ,estado
FROM d_metereolog
WHERE
cod_fundo=p_cfundo AND
fecha =TO_DATE(p_fecha,'DD/MM/YYYY');
BEGIN
FOR dyn_cur IN aux_cur
LOOP
p_dmetereolog(1).cod_fundo:=dyn_cur.cod_fundo;
p_dmetereolog(1).fecha:=dyn_cur.fecha;
p_dmetereolog(1).temp_max:=dyn_cur.temp_max;
p_dmetereolog(1).temp_min:=dyn_cur.temp_min;
p_dmetereolog(1).porc_humedad:=dyn_cur.porc_humedad;
p_dmetereolog(1).evaporacion:=dyn_cur.evaporacion;
p_dmetereolog(1).prec_pluvial:=dyn_cur.prec_pluvial;
p_dmetereolog(1).velvient_max:=dyn_cur.velvient_max;
p_dmetereolog(1).velvient_min:=dyn_cur.velvient_min;
p_dmetereolog(1).usuario:=dyn_cur.usuario;
p_dmetereolog(1).fech_act:=dyn_cur.fech_act;
p_estado(1):=dyn_cur.estado;
END LOOP;
END usp_getdata_dmetereolog;
END upkg_mrp;
Show me my flaws please. How can I optimize this sp

Similar Messages

  • I want to know the top 10-20 Store procedures used in the table.

    Hello All, 
    There are total 3500+ Store procedures created in the server. So,  I want to know the top 10-20 Store procedures used in the table. Like which store procedures are important and what are they, is there any code to find them? 
    I think the question might be very silly, but i don't know which store procedure to look at it. 
    Please help me on this issue.
    Thanks.
    Thanks, Shyam.

    By what? CPU? Memory? Execution count?
    Glenn Berry wrote this
    -- HIGH CPU ************
          -- Get Top 100 executed SP's ordered by execution count
          SELECT TOP 100 qt.text AS 'SP Name', qs.execution_count AS 'Execution Count',  
          qs.execution_count/DATEDIFF(Second, qs.creation_time, GetDate()) AS 'Calls/Second',
          qs.total_worker_time/qs.execution_count AS 'AvgWorkerTime',
          qs.total_worker_time AS 'TotalWorkerTime',
          qs.total_elapsed_time/qs.execution_count AS 'AvgElapsedTime',
          qs.max_logical_reads, qs.max_logical_writes, qs.total_physical_reads, 
          DATEDIFF(Minute, qs.creation_time, GetDate()) AS 'Age in Cache'
          FROM sys.dm_exec_query_stats AS qs
          CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) AS qt
          WHERE qt.dbid = db_id() -- Filter by current database
          ORDER BY qs.execution_count DESC
          -- HIGH CPU *************
          -- Get Top 20 executed SP's ordered by total worker time (CPU pressure)
          SELECT TOP 20 qt.text AS 'SP Name', qs.total_worker_time AS 'TotalWorkerTime', 
          qs.total_worker_time/qs.execution_count AS 'AvgWorkerTime',
          qs.execution_count AS 'Execution Count', 
          ISNULL(qs.execution_count/DATEDIFF(Second, qs.creation_time, GetDate()), 0) AS 'Calls/Second',
          ISNULL(qs.total_elapsed_time/qs.execution_count, 0) AS 'AvgElapsedTime', 
          qs.max_logical_reads, qs.max_logical_writes, 
          DATEDIFF(Minute, qs.creation_time, GetDate()) AS 'Age in Cache'
          FROM sys.dm_exec_query_stats AS qs
          CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) AS qt
          WHERE qt.dbid = db_id() -- Filter by current database
          ORDER BY qs.total_worker_time DESC
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • HOW TO EXECUTE A STORE PROCEDURE THAT RETURN MULTIPLE ROWS FROM A QUERY

    I NEED TO CREATE AND USE A STORE PROCEDURE THAT IS GOING TO DO A SELECT STATEMENT AN THE RESULT OF THE SELECT STATEMENT IS RETURN IN SOME WAY TO THE REQUESTER.
    THIS CALL IS MADE BY AN EXTERNAL LANGUAGE, NOT PL/SQL OR FORMS APPLICATION. USING FOR EXAMPLE ODBC AND VISUAL BASIC. WHAT I NEED TO DO IS ADD A DATA ACCESS LAYER TO MY APPLICATION AND I ALREADY HAVE IT DONE FOR MS SQL SERVER, BUT I NEED THE SAME FUNCTIONALITY ACCESSING AN ORACLE DATABASE.
    FLOW:
    1. VB CREATE A ODBC CONNECTION TO A ORACLE DATABASE
    2. VB EXECUTE A STORE PROCEDURE
    3. THE STORE PROCEDURE RETURNS TO THE VB APPLICATION THE RESULT OF THE QUERY THAT IS INSIDE OF THE STORE PROCEDURE.(I.E. THE STORE PROCEDURE IS A BASIC SELECT, NOTHING COMPLEX)
    4. VB DISPLAY THE RESULT IN A GRID
    FOR SURE I CAN DO THE SELECT DIRECTLY TO ORACLE, BUT FOR PERFORMANCE REASONS AND SCALABILITY, I'LL LIKE IT TO DO IT USING A STORE PROCUDURES
    IS THIS POSIBLE?, HOW?
    THANKS

    Certainly, it's possible. First, define a stored procedure that includes an OUT parameter which is a REF CURSOR. Then, call the stored procedure via ODBC omitting the OUT parameter from the list of parameters. IT will automatically be returned as a result set. Syntax for both is below...
    CREATE PROCEDURE foo (inParam in varchar2, resultSet OUT REF CURSOR )
    In ODBC:
    {call foo( 'someData' )}
    Justin

  • UNABLE TO EXECUTE THE CMDSQL SCRIPT IN A STORE PROCEDURE.

    I am trying to call a .sql file from sql cmd mode.
    The requirement is to pass the .sql file as parameter value to the cmd script which I have able to achieve,here is the code which is working fine .
    declare @x sysname
    set @x = 'C:\Users\testuser\Desktop\testing.sql'
    :OUT $(TEMP)\GetServerName1.sql
    PRINT ':SETVAR FilePath'+ ' ' + @x
    GO
    :OUT stdout
    :r $(TEMP)\GetServerName1.sql
    GO
    :r $(FilePath)
    But when I try to wrap this code in store procedure it is giving the message fatal error but when I run it without wrapping it in store proc it is doing its job with no error . When I looked into the store proc I found the code as
    ALTER proc [dbo].[testing]
    as
    declare @x sysname
    set @x = 'C:\Users\testuser\Desktop\testing.sql'
    PRINT ':SETVAR FilePath'+ ' ' + @x
    It seems like the sqlcmd code disappears automatically. I have no clue why it is happening. 
    Can anyone help in letting me knw how to wrap the above code in store proc.
    Thanks Saurav 

    It is important to keep in mind that you have two entities in play here. One client and one server. The lines that start with a colon never sent to SQL Server, nor are the lines which reads "go". They are intercepted client-side. For instance :r
    instructs SSMS to read a local file and out: redirects the output. And "go" breaks up the code in batches.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Front-End Service Starup Error: Store procedure to GET progress vector failed.

    Hi,
    We have a two front end servers in our Lync deployment and I'm getting an interesting error message on one of the servers when the "Lync Server Front-End Service" is starting up. All the services on that server will eventually start but I'm pretty
    sure it's affecting users in some way.
    Here is the error message in the Event Viewer:
    Log Name:      Lync Server
    Source:        LS User Services
    Date:          2013-09-17 8:00:32 AM
    Event ID:      32194
    Task Category: (1006)
    Level:         Error
    Keywords:      Classic
    User:          N/A
    Computer:      BGC-VAN-LYNC2.domain.ca
    Description:
    Store procedure to GET progress vector failed.
    Execution Error: 0x00000000(ERROR_SUCCESS).
    Native Error: 8144.
    Error Details: [# [Microsoft][SQL Server Native Client 11.0][SQL Server]Procedure or function SyncReplicationGetProgressVector has too many arguments specified. #].
    Cause: This may indicate a problem with connectivity to local database or some unknown product issue.
    Resolution:
    Ensure that connectivity to local database is proper. If the error persists, please contact product support with server traces.
    Event Xml:
    <Event xmlns=>
      <System>
        <Provider Name="LS User Services" />
        <EventID Qualifiers="50158">32194</EventID>
        <Level>2</Level>
        <Task>1006</Task>
        <Keywords>0x80000000000000</Keywords>
        <TimeCreated SystemTime="2013-09-17T15:00:32.000000000Z" />
        <EventRecordID>16971</EventRecordID>
        <Channel>Lync Server</Channel>
        <Computer>BGC-VAN-LYNC2.domain.ca</Computer>
        <Security />
      </System>
      <EventData>
        <Data>0x00000000(ERROR_SUCCESS)</Data>
        <Data>8144</Data>
        <Data>[# [Microsoft][SQL Server Native Client 11.0][SQL Server]Procedure or function SyncReplicationGetProgressVector has too many arguments specified. #]</Data>
      </EventData>
    </Event>
    The error happens 15 times every minute, following with this event:
    Name:      Lync Server
    Source:        LS User Services
    Date:          2013-09-17 8:23:46 AM
    Event ID:      32189
    Task Category: (1006)
    Level:         Information
    Keywords:      Classic
    User:          N/A
    Description:
    The following Fabric service for routing groups have been closed:
    {F515134C-71B7-52FD-B0C3-6A9DB39CF750}
    {8A5D6B36-2A01-53DB-BC4E-3286C05E0836}
    {B35AAFC9-F6BF-5FFE-8C31-4AA5C36B2065}
    {69223418-78DC-5066-81A8-78E05914EC7B}
    {80414C96-1137-5DDC-8387-C3EA7A54B078}
    {641E6ABD-B862-55A1-B1B1-C83BC92D2F85}
    {1EA68EA4-77F7-5CFC-B781-0093CBC18403}
    {2FDE333D-FF7F-5D6A-B85B-93ADC1EAC12A}
    {A43BBA3A-8963-51C4-BD7A-19E1EC3DDFDB}
    {D3F4532F-61C8-5072-9B3B-3E2CCF15442F}
    {4449243E-5E96-56AC-AB6B-C5E785543542}
    {58B30261-65B6-5F6A-BC50-60F85782D052}
    {DB4B76B0-2510-5BF8-A7B1-8B37BD3AA7B9}
    {917CC217-966B-56AC-A912-97BA64BA13EB}
    Anyone knows what this is about and how to resolve this?
    Thanks,
    VH.

    Hi,
    Please try to reset registrar state:
    http://tsoorad.blogspot.in/2013/04/lync-2013-ee-pool-wont-start.html
    Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make
    sure that you completely understand the risk before retrieving any suggestions from the above link.
    Kent Huang
    TechNet Community Support

  • Select all values from Rule in Store Procedure

    Hi
    I have a rule like this
    CREATE RULE [dbo].[Rle_Currency_Lst]
    AS
    @List IN
    ('PKR','USD')
    GO
    Now i want to make simple "Currency List" report for which i need to select values from above rule in Store Procedure which i will use in SSRS to fill my report.
    Please help
    Zubair Afridi | Please mark as answered or vote helpful if this post help resolved your issue. Thanks!

    One way to get the values.
    declare @definition nvarchar(max);
    select @definition = m.definition
    from sys.objects o
    inner join sys.sql_modules m on o.object_id = m.object_id
    where schema_name(o.schema_id) = 'dbo' and o.name = 'Rle_Currency_Lst';
    set @definition = SUBSTRING(@definition, CHARINDEX('''', @definition), LEN(@definition));
    set @definition = LEFT(@definition, CHARINDEX(')', @definition) - 1);
    declare @myXML AS XML;
    set @myXML = N'<H><r>' + REPLACE(SUBSTRING(@definition, CHARINDEX('''', @definition), LEN(@definition)), ',', '</r><r>') + '</r></H>'
    declare @result table(myvalues nvarchar(100));
    insert @result(myvalues)
    SELECT Vals.id.value('.', 'NVARCHAR(100)') AS val
    FROM @myXML.nodes('/H/r') AS Vals(id)
    update @result set myvalues = REPLACE(myvalues, '''', '');
    select * from @result;
    Note that rules is a deprecated feature and will be removed in a future version of SQL Server.  The replacement for rules is CHECK CONSTRAINTS.  You may well want to consider a plan to migrate your current rules to check constraints.
    Tom

  • How to build a report in web Intelligence using Store procedure under Microsoft SQL Server 2000

    Post Author: ltkin
    CA Forum: WebIntelligence Reporting
    Hi,
    How to build a report in web Intelligence using Store procedure under Microsoft SQL Server 2000 ?
    Regards,

    Hi ltkin,
    Unfortunately, it is not possible in Xir2 to create Webi reports from stored procedures.
    Webi reports can only be created from Universe. So in Business Objects XIR3 we can create a special universe that enables Web Intelligence user's to access stored procedures residing in the database. This is the only way that Web Intelligence user's can access stored procedures.
    Please let me know if the above information helps.
    Regards,
    Pavan

  • How can i pass NULL value in Store Procedure?

    Hi guys,
    I am calling one store procedure from MS SQL Server 200, i had create the follow layout:
    But i need pass to MSQL SEVER the CPF = NULL, when i execute the procedre the CPF send empty value (not null).
    I already changed Communication Channel parammeter "Interpretation of Empty String Values" to "Null Value" value.
    But the interface always send empty string instead of null.
    How can anybody help me, please?
    Edited by: João Noberto dos Santos Junior on Jun 24, 2009 5:00 PM

    Hi,
    To achieve this through "Interpretation of Empty String Value" in the cc, you will have to implement a patch which is sent to you by SAP when an OSS is raised. By default its not available, i mean you can configure it but it will actually not work.
    As a temporary solution you can map your element with a constant/mapwithdefault field with value mentioned as NULL.
    Regards,
    Anshul

  • How to get a recordset in vb to access a oracle store procedure.

    I have a store procedure(sproc) that needs to be called from a VB Application. I was being told that I would have to create a PL/SQL table in my store procedure for the VB Developer to access information from my store procedure. This is beacasue he wants it as a record set. Is that the way to get info for a VB front end. My sproc is a very basic one
    My sproc looks like
    create or replace PROCEDURE SP_TBLINFO
    (ID out TBLINFO.id%type,
    ACCOUNT_NUMBER out TBLINFO.account_number%type)
    AS
    CURSOR TBLINFO_CURSOR IS
    SELECT * FROM TBLINFO;
    V_TBLINFO_CURSOR TBLINFO_CURSOR%ROWTYPE;
    BEGIN
    OPEN TBLINFO_CURSOR ;
    Loop
    FETCH TBLINFO_CURSOR INTO V_TBLINFO_CURSOR;
    EXIT WHEN TBLINFO_CURSOR %NOTFOUND;
    ID := V_TBLINFO_CURSOR.id;
    ACCOUNT_NUMBER:= V_TBLINFO_CURSOR.account_number;
    END LOOP;
    CLOSE TBLINFO_CURSOR ;
    END SP_TBLINFO;
    Thanks.

    Use a REF_CURSOR, something like the following:
    create or replace package SP_TBLINFO as
    CURSOR TBLINFO_CURSOR IS SELECT * FROM TBLINFO;
    create type TBLINFO_CURSOR_TYPE is TBLINFO_CURSOR%ROWTYPE;
    procedure PROC_TBLINFO(Info out TBLINFO_CURSOR_TYPE);
    end;
    create or replace package body SP_TBLINFO as
    PROCEDURE PROC_TBLINFO
    (Info out TBLINFO_CURSOR_TYPE)
    AS
    BEGIN
    OPEN ACCOUNT_NUMBER as SELECT * FROM TBLINFO ;
    END SP_TBLINFO;
    END;
    Then bind it in OO4O as ORATYPE_CURSOR.

  • Unable to run Store Procedure based deski report in Infoview

    Hi All,
    I have a Deski report which is created using Store Procedure. I am able to run report in Full Client Deski. But I am unable to run / schedule same report thorough infoview.
    More details about report
    - Report uses 3 store procedures. When I ran report in infovew I get error message as "SP2 Dataprovider did not refresh properly".  -- SP2 is Dataprovider name.
    - Same report I am able to run in Dev environment. After migration to Model, report fails to run in model infoview.
    - I am able to Run report only for 1st. When I refresh and run with same parameter report shows error.
    Any input will be great help.
    Thanks,
    NV

    Hi,
    Could you please test the following solutions to resolve the issue.
    Solution1:
    Test the issue by inserting the following parameter in .SBO file.
    <Parameter Name="Force SQLExecute">Always</Parameter> .
    Solution2
    Just put SET NOCOUNT OFF in the end of the stored procedure SQL.
    If the above doesnu2019t works then please try the following solution.
    Solution3
    Make the new connection from the scratch using ODBC connection and test the issue.
    I hope this will help you.
    Regards,
    Sarbhjeet Kaur

  • Error while executing store procedure

    we are using JSQLConnect jdbc driver 3.0 verson.
    When we trued to excute store procedures its giving error like
    com.jnetdirect.jsql.w: Stored procedures called with static parameters cannot return output parameter values, please use CallableStatement.setXXX() to set the values of all input parameters.
    we are using SQLServer2000.
    Could anybody tell me why this is error is coming and how to solve this.
    Thanks
    Hemanth

    Obviously it doesn't like the stored procedure. If you posted the signature for that it might help.
    You are using a CallableStatement right?

  • Error when run crystal report with store procedure in JSP

    I try to run report which is developed by crystal report XI and store procedure (SQL 2005) with JSP.
    But it occurs error that is "com.crystaldecisions.reports.reportengineinterface.JPEReportSource - failed to process getPage request: No results were returned by the query."
    How can I do for solving this problem? Pls, help me !!!!!
    (In other report which is not used store procedure I can run fine.)
    Message was edited by:
    Bonds_Identity

    What version of CR are you using?
    What CR updates are you using?
    See sample apps here:
    https://wiki.sdn.sap.com/wiki/display/BOBJ/CrystalReportsfor.NETSDK+Samples
    in particular check out vbnet_win_pass_dataset_main_sub.zip
    The [Crystal Reports for Visual Studio 2005 Walkthroughs|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/2081b4d9-6864-2b10-f49d-918baefc7a23] will also be good to look at.
    Ludek
    Follow us on Twitter
    http://twitter.com/SAPCRNetSup

  • Permission problem calling a java object from a store procedure

    When I run my store procedure
    CREATE OR REPLACE PACKAGE BODY confirms_write_to_file
    AS
    FUNCTION translate(in_en_var in VARCHAR2)
    RETURN VARCHAR2
    AS LANGUAGE JAVA
    NAME 'translate.translatePath(java.lang.String) return java.lang.String';
    PROCEDURE write_to_file(in_file_name IN VARCHAR, in_en_var IN VARCHAR)
    IS
    file_handle               UTL_FILE.FILE_TYPE;
    file_location VARCHAR2(50);
    BEGIN
    file_location := translate(in_en_var);
    dbms_output.put_line ('opened file location' ||file_location);
    END write_to_file;
    END confirms_write_to_file;
    I get the following error:
    exec confirms_write_to_file.write_to_file('zzzz','$RIMS_LOG');
    SQL> exec confirms_write_to_file.write_to_file('zzzz','$RIMS_LOG');
    Exception java.security.AccessControlException: the Permission
    (java.io.FilePermission <<ALL FILES>> execute) has not been granted by
    dbms_java.grant_permission to
    SchemaProtectionDomain(RIMS|PolicyTableProxy(RIMS))
    opened file locationProcess problem
    PL/SQL procedure successfully completed.
    When I try to to grant myself the permissions
    begin
    dbms_java.grant_permission('rims','java.io.FilePermission','*','execute');
    dbms_java.grant_permission('rims', 'java.lang.RuntimePermission', '*','writeFileDescriptor' );
    end;
    I get the following Error:
    oracle.aurora.vm.IdNotFoundException: rims is not a user or role
    at oracle.aurora.rdbms.DbmsRealm.getId(DbmsRealm.java)
    at oracle.aurora.rdbms.DbmsRealm.getId(DbmsRealm.java)
    at
    oracle.aurora.rdbms.security.PolicyTableManager.findAll(PolicyTableManager.java)
    at oracle.aurora.rdbms.security.PolicyTableManager.find(PolicyTableManager.java)
    at
    oracle.aurora.rdbms.security.PolicyTableManager.activate(PolicyTableManager.java
    at
    oracle.aurora.rdbms.security.PolicyTableManager.grant(PolicyTableManager.java)
    begin
    ERROR at line 1:
    ORA-29532: Java call terminated by uncaught Java exception:
    oracle.aurora.vm.IdNotFoundException: rims is not a user or role
    ORA-06512: at "SYS.DBMS_JAVA", line 0
    ORA-06512: at line 2
    My java code is as follows
    import java.io.*;
    import java.util.*;
    class translate
         public static String translatePath(String envar)
              Runtime rt = Runtime.getRuntime();
              int bufSize = 4096;
              byte buffer[] = new byte[bufSize];
              String path = null;
              Process p = null;
              int len = 0;
              try
                   p = rt.exec("echo "+envar);
                   BufferedInputStream bis = new BufferedInputStream(p.getInputStream());
                   while ((len = bis.read(buffer, 0, bufSize)) != -1)
                        System.out.write(buffer, 0, len);
                   path = new String(buffer);
                   p.waitFor();
              catch(Exception e)
                   System.out.println("Exception "+e);
                   return "Process problem ";
              return path;

    Tony,
    I answered this very same question that you posted at the JavaRanch forum.
    Good Luck,
    Avi.

  • Error message when issuing a COMMIT in a store procedure

    Hello experts,
    Please help.
    I have a problem where i cannot specify a COMMIT in a store
    procedure. I have the following error message:
    =================================================================
    00034, 00000, "cannot %s in current PL/SQL session"
    // *Cause:  An attempt was made to issue a commit or rollback
    from a PL/SQL
    // object (procedure, function, package) in a session
    which has this
    // disabled (by 'alter session disable commit in
    procedure')
    // *Action: enable commits from PL/SQL in this session, or don't
    attempt
    // to use commit or rollback in PL/SQL when they are
    disabled
    // in the current session.
    =================================================================
    Thanks very much for a reply
    Kind regards
    Yogeeraj

    The solution is to issue the statement
    alter session enable commit in procedure;
    However, I'd think carefully about doing this. Procedures are
    often called as part of a wider transaction. If the procedure
    issues a commit ALL the preceding work is also commited. If
    there is something subsequent in the transaction that fails and
    issues a rollback, it will onlt rollback the work done after the
    procedure. This may lead to your database being in an
    inconsistent state.
    rgds, APC

  • Oracle JBDC error while calling the store procedure

    HI All,
    I am get one strange error while calling a store procedure which has two parameter in and out.
    I am pass the correct XML file which reaches the RDB and then PI receives a exception error message saying:
    oracle.rdb.jdbc.common.RdbException: Closed Resultset
    where as no error log is availble in RBD for the same.
    Can anybody tell me what can be the cause of the error.
    Let me know if you requires more information on this.
    -adi

    Hi Kiran,
    Thanks..
    But I am not able to understand you. I am calling a store procedure not a table. and we not doing anything in the store procedure except return one constant value in Out parameter.
    -Adi

Maybe you are looking for