Line number in a stored procedure

Hello All,
In a stored procedure, as a part of logging the debugging information, I want to store the current line number in a variable (say line_number) and return it from the stored procedure as a output paramater. I would like to update line_number with the current line number in the stored procedure code at certain intervals. This would help me to know till where the procedure executed in case of failure.
Now my question is as follows:
Is there any standard variable in Oracle which gives the current line number in the stored procedure?
Please see the example code below
CREATE OR REPLACE PROCEDURE XXXXX
(line_number OUT NUMBER)
AS
line_number = <current line number in the code>
line_number = <current line number in the code>
line_number = <current line number in the code>
EXCEPTION
WHEN OTHERS THEN
BEGIN
ROLLBACK;
END;
END XXXXX;
Best Regards,
Ramesh

Hi,
No, is not. Try to use all_source for this.

Similar Messages

  • Retrieve a number from a stored procedure

    I need to retrieve the number of rows returned from a query in a stored procedure. This is what I currently have:
    PACKAGE PART_DATA AS
    FUNCTION GetPartDataRowCount(Company IN PART_DATA.PART1_CO_SITE%TYPE) RETURN NUMBER;
    END;
    PACKAGE BODY PART_DATA AS
    FUNCTION GetPartDataRowCount
    Company IN PART_DATA.PART1_CO_SITE%TYPE
    RETURN NUMBER
    IS
    RecordCount NUMBER;
    BEGIN
    SELECT COUNT(*)
    INTO RecordCount
    FROM PART_DATA
    WHERE PART1_CO_SITE = Company;
    RETURN RecordCount;
    END GetPartDataRowCount;
    END;
    And the .NET part:
    Public Function GetPartDataRowCount(ByVal Company As String) As Integer
    Dim con As New OracleConnection(MyConnectionString)
    'Open the connection
    con.Open()
    'Set the command text, type and connection
    Dim cmd As New OracleCommand("PART_DATA.GetPartDataRowCount", con)
    cmd.CommandType = CommandType.StoredProcedure
    'Create parameter objects
    Dim returnValue As New OracleParameter
    returnValue.Direction = ParameterDirection.ReturnValue
    returnValue.DbType = DbType.Int32
    cmd.Parameters.Add(returnValue)
    Dim pCompany As New OracleParameter
    pCompany.Direction = ParameterDirection.Input
    pCompany.DbType = DbType.AnsiStringFixedLength
    pCompany.Value = Company
    cmd.Parameters.Add(pCompany)
    'Execute the query
    cmd.ExecuteNonQuery()
    'Capture the returned value
    Dim rowCount As Integer = Convert.ToInt32(returnValue.Value)
    'Return the returned value
    Return rowCount
    'Clean up objects
    returnValue.Dispose()
    cmd.Dispose()
    con.Dispose()
    End Function
    I am using this as the SelectCountMethod on an ObjectDataSource for custom paging a GridView. Everything is working but because I'm new to Oracle I can't help thinking that there is a better way to achieve what I need, also I am confused as to whether I should be using a Function or a Procedure in my Package for this.
    I would be grateful if someone could either confirm that what I am doing is the best/correct method or show me what I should be doing instead.
    Any help much appreciated.

    Thanks Eric, that is a big help and has made things clearer for me. However I cannot get this to work using a Procedure instead of a Function. Just for the sake of completeness I would also like to make it work with a Procedure.
    Here is what I have:
    PACKAGE PART_DATA AS
    PROCEDURE GetPartDataRowCount(mtmsCompany IN PART_DATA.PART1_CO_SITE%TYPE,rowCount OUT NUMBER);
    END;
    PACKAGE BODY PART_DATA AS
    PROCEDURE GetPartDataRowCount
    mtmsCompany IN PART_DATA.PART1_CO_SITE%TYPE,
    rowCount OUT NUMBER
    IS
    BEGIN
    SELECT COUNT(*)
    INTO rowCount
    FROM PART_DATA
    WHERE PART1_CO_SITE = mtmsCompany;
    END GetPartDataRowCount;
    END;
    And the .NET code:
    Public Function GetPartDataRowCount(ByVal Company As String) As Integer
    'Open the connection
    con.Open()
    'Set the command text and type
    Dim cmd As New OracleCommand("PART_DATA.GetPartDataRowCount", con)
    cmd.CommandType = CommandType.StoredProcedure
    cmd.BindByName = True
    'Create parameter objects
    Dim rowCount As New OracleParameter
    rowCount.Direction = ParameterDirection.Output
    rowCount.DbType = DbType.Int32
    cmd.Parameters.Add(rowCount)
    Dim mtmsCompany As New OracleParameter
    mtmsCompany.Direction = ParameterDirection.Input
    mtmsCompany.DbType = DbType.AnsiStringFixedLength
    mtmsCompany.Value = Company
    cmd.Parameters.Add(mtmsCompany)
    (Exception handling is done in Global.asax hence no Try/Finally)
    'Execute the query
    cmd.ExecuteScalar()
    'Capture the returned value
    Dim returnValue As Integer = Convert.ToInt32(rowCount.Value)
    'Return the returned value
    Return returnValue
    'Clean up objects
    RowCount.Dispose()
    cmd.Dispose()
    con.Dispose()
    End Function
    The package compiles without errors, but when I run the app I get the following error:
    Oracle.DataAccess.Client.OracleException: ORA-06550: line 1, column 39: PLS-00103: Encountered the symbol ">" when expecting one of the following:
    It then gives a long list of things it was expecting. Do I also need to return a Ref Cursor?
    Once again any help much appreciated.

  • Issue with Oracle.sql.NUMBER in Java Stored Procedure

    When we try to make a call to the Oracle.sql.NUMBER(String) inside a java stored procedure and pass values from '01' to '09', it throws java.lang.StringIndexOutOfBoundsException: String index out of range: 3
    We use Oracle 9.2.0.6 - JServer Release 9.2.0.6.0.
    It works fine for other values. Please find below the code used for simulating the issue outside the application. Thanks.
    create or replace and compile java source named testNumber as
    import oracle.sql.NUMBER;
    import java.sql.SQLException;
    public class TestNumber
           public static String convertNumber(String parm) {
                     NUMBER nTest;
                     try {
                             nTest = new NUMBER(parm);
                             return "TRUE";
                     }catch (SQLException sqle) {
                             return "FALSE";
    create or replace function test_number (p_str in varchar2) return varchar2 as
    language Java name 'TestNumber.convertNumber(java.lang.String) return
    java.lang.String';
    select test_number('05') from dual;  - Throws exception ORA-29532: Java call terminated by uncaught Java exception: java.lang.StringIndexOutOfBoundsException: String index out of range: 3
    select test_number('5') from dual; - Works fine
    select test_number('010') from dual; - Works fine

    Siva,
    I'm only guessing, but it could be an Oracle bug, in which case I suggest checking with Oracle Support.
    (You do have a support contract, don't you? ;-)
    Did you try compiling and running your java class "TestNumber" outside the database?
    Class "oracle.sql.NUMBER" should be in Oracle's JDBC driver, I believe.
    Good Luck,
    Avi.

  • Stored Procedure for Batch Number Format and Block Duplicate Batch Number

    Hi Experts !
    I am new one in forum asking question.. I want Stored procedure for Batch Number Format. I want fix one Batch number format in Stored Procedure.
    Example :
    My Batch number format Like  BATCH00001 - It should be first five digit is text format and next five is Numeric.
    IF create Goods receipt PO or Goods receipt stage I create batch number like BATCH 00001 or any other number means don't add that document and also duplicated batch number also does not allowed. please give me the solutions. I am sorry for my bad english .

    Dear Nagarajan K.
                         Thanks for your replay ..
    IF @transaction_type IN ('A','U') AND (@object_type = '106' )
    BEGIN
    set @item = LEFT( @list_of_cols_val_tab_del, CHARINDEX(CHAR(9),  @list_of_cols_val_tab_del,1) - 1)
    set @batch = substring(@list_of_cols_val_tab_del, len(@item)+1, (CHARINDEX(CHAR(9),  @list_of_cols_val_tab_del,len(@item)+2)) - (len(@item)+1))
    --set @base =( select basetype from ibt1 where batchnum = ltrim(rtrim(replace(@batch,char(9),''))))
    set @count = (select count(*) from oibt quantity > 0 and where  batchnum = ltrim(rtrim(replace(@batch,char(9),''))))
    if @count > 1
    begin
    set @error = 1
    set @error_message = 'Please enter different Batch Code for batch ''' + @batch + ''' for item ' + @item 
    select @error, @error_message
    END
    END
                  I used above Stored Procedure. here we can use one batch number for different item but  i want to block one batch we should use one item and one time only after than we never use that batch number for same item and another item.
             After that I want format for Batch, we should follow unique Batch number for all items.

  • Inserting Multiple Line Items To Stored Procedure

    Hi
    I need to insert line item values to one of the argument in stored procedure.what data type do i need to pass for type attribute.I tried with different datatypes from sap help but no luck.Please guide me how should i proceed.
    Interface is : Idoc to JDBC (stored procedure)
    Target structure:
                                     DT_Orderstatus_Trgt
                                         --> StatementName
                                                 -->SP Name
                                                        action--->Attribute
                                                        table--->Attribute
                                                         --->Argument (to insert multiple line items)
                                                                 isInput
                                                                 isOutput
                                                                 type
    Just i am showing only one argumnet which needs to be inserted multiple line items.
    Thanks

    Hi,
    Stored procedure can support the below data types
    INTEGER, BIT, TINYINT, SMALLINT, BIGINT, FLOAT, REAL, DOUBLE, NUMERIC, DECIMAL, CHAR, VARCHAR, STRING, LONGVARCHAR, DATE, TIME, TIMESTAMP, BINARY, VARBINARY, LONGVARBINARY, BLOB (input and output),CLOB (input and output), CURSOR (output; only in conjunction with the Oracle JDBC driver).
    But
    Instead of passing multiple line items / array of input value in stored procedure, You can go for the below option as having 2 statements in your mapping with below structures and those 2 statements should be linked with the primary key say col1.
    <root>
    <StatementName1>
    <dbTableName action=u201DINSERTu201D>
    <table>realDbTableName</table>
    <access>
    <col1>val1</col1>
    <col2>val2</col2>
    </access>
    <access>
    <col1>val11</col1>
    </access>
    </dbTableName>
    </StatementName1>
    <StatementName2>
    <dbTableName action=u201DINSERTu201D>
    <table>realDbTableName</table>
    <access>
    <col1>val1</col1>
    <col2>val2</col2>
    </access>
    <access>
    <col1>val11</col1>
    </access>
    </dbTableName>
    </StatementName2>
    </root>

  • Creation of DB Adaptert for calling stored procedure in MS SQL server

    Hi,
    I need to create a DB adapter to call a stored procedure in MS SQL Server.
    I have gone thru the thread MS SQL Server database connection
    It mentions that we need to use a command line utility for generating the wsdl and xsd for calling stored procedures in MS SQL server. Please provide information where to find this utility and how to use it.
    Any links to tutorials are welcome.
    Thanks !!.
    Silas.

    Command line is required for stored procedures, if you are using the basic options you don't need to worry.
    (1) Download MS SQL Server 2005 JDBC Driver from Microsoft Site. http://msdn.microsoft.com/en-us/data/aa937724.aspx
    (2) The download is self extracting exe file. Extract this into Program Files on your machine. It should create folder as "Microsoft SQL Server 2005 JDBC Driver"
    (3) In above mentioned folder search for sqljdbc.jar copy this file into JDeveloper\JDBC\lib folder.
    (4) Open JDeveloper/jdev/bin/jdev.conf file add following entry.
    AddJavaLibPath C:/Program files/Microsoft SQL Server 2000 Driver for JDBC/lib
    While executing this step make sure that your JDeveloper is closed.
    (5) On command prompt go to J Developer folder and execute following command
    jdev -verbose
    This will open JDeveloper.
    (6) Now go to JDeveloper > Connections > Database Connections > New Database Connection
    (7) Select Third Party JDBC
    (8) Specify MS Sql Server User Name, password and Role.
    (9) In connection page specify following
    - Driver Class: com.microsoft.sqlserver.jdbc.SQLServerDriver
    - For class path browse to C:/Program files/Microsoft SQL Server 2000 Driver for JDBC/lib folder, select sqljdbc.jar add it as library.
    - Specify URL as following.
    jdbc:sqlserver://SERVERNAME:1433;databaseName=MSSQLDBNAME;
    (10) Go to Test page and test it.
    cheers
    James

  • Error : The label 'http' has already been declared. Label names must be unique within a query batch or stored procedure.

    Hi all,
        I have created one SP for sending mail with formatting the HTML code inside script whenever i am individually declaring it and printing its expected but the problem at time of executing SP its giving error like this
    Msg 132, Level 15, State 1, Line 47
    The label 'http' has already been declared. Label names must be unique within a query batch or stored procedure.
    what is the possibilities to overcome this problem follwing is my stored procedure code 
    ALTER PROCEDURE [dbo].[USP_DataLoadMailsend_essRules]
    AS
    BEGIN
    SET NOCOUNT ON;
    SET XACT_ABORT ON;
    BEGIN TRY
    ---BEGIN TRANSACTION T1
    DECLARE @packagelogid INT
    DECLARE @batchlogid INT
    DECLARE @packagestatus CHAR(2)
    select @batchlogid =19870
    --print(@batchlogid)
    DECLARE @script VARCHAR(MAX)
    DECLARE @tableHTML VARCHAR(MAX)
    DECLARE @mailheader VARCHAR(50)
    DECLARE @count INT
    DECLARE @recipients1 VARCHAR(50)
    DECLARE @subject1 VARCHAR(200)
    DECLARE @sql VARCHAR(MAX)
    Declare @UserId varchar(Max)
    Declare @Information varchar(max)
    Declare @TableHTML1 varchar(max)
    Declare @TableHTML2 varchar(max)
    SET @mailheader = ''
    SET @mailheader = (select case
    WHEN FileUpload = 'F'
    THEN 'BussinessRules is Aborted'
    WHEN (InRule = 'S')
    AND (
    SELECT sum(isnull(ErrorRecords, 0)) tot
    FROM abc.FileUploadSummary z
    WHERE z.BatchId = bts.BatchId
    GROUP BY BatchId
    ) > 0
    THEN 'BussinessRules is Processed with Errors'
    WHEN InRule = 'F'
    THEN 'BussinessRules is Failed'
    WHEN (InRule = 'S')
    AND (
    SELECT sum(isnull(ErrorRecords, 0)) tot
    FROM abc.FileUploadSummary z
    WHERE z.BatchId = bts.BatchId
    GROUP BY BatchId
    ) = 0
    THEN 'BussinessRules is Succeeded'
    end
    from abc..BatchStatus bts where BatchId=@batchlogid)
    /* Selecting Person Mail as Recipient */
    SELECT TOP 1 @recipients1 = EmailId FROM abc.PersonEmail
    WHERE PersonId = ( SELECT TOP 1 personid FROM abc.FileUploadSummary WHERE BatchId = @batchlogid )AND EmailTypeId = 1
    /* Selecting UserId*/
    select top 1 @UserId=loginid from abc.FUS where BatchId=@batchlogid
    /*Selecting Information about the Status */
    Set @Information=
    (select case
    WHEN FileUpload = 'F'
    THEN 'BussinessRules is Aborted'
    WHEN (InRule = 'S')
    AND (
    SELECT sum(isnull(ErrorRecords, 0)) tot
    FROM abc.FileUploadSummary z
    WHERE z.BatchId = bts.BatchId
    GROUP BY BatchId
    ) > 0
    THEN 'BussinessRules is Processed with Errors'
    WHEN InRule = 'F'
    THEN 'BussinessRules is Failed'
    WHEN (InRule = 'S')
    AND (
    SELECT sum(isnull(ErrorRecords, 0)) tot
    FROM abc.FileUploadSummary z
    WHERE z.BatchId = bts.BatchId
    GROUP BY BatchId
    ) = 0
    THEN 'BussinessRules is Succeeded'
    end + N' <br> <B>BatchId= '+ convert(varchar(250),(select @batchlogid)) +'</B>'
    from abc..BatchStatus bts where BatchId=@batchlogid )
    /*Selecting the Error Reason*/
    if exists (select 1 from BatchStatus where BatchId=@batchlogid and ( InRule='f'))
    begin
    set @TableHTML1 = '<table border=1><tr><th>Sr.No.</th><th><P>Error Reason :</th></tr>'+
    cast((select td= ROW_NUMBER()over (order by (select 1)),'',
    td=isnull(e.ErrorDescription, '')
    from abc.x.tbPackageErrorLog e --50594
    join abc.x.tbPackageLog p -- 10223
    on p.PackageLogID=e.PackageLogID
    where p.BatchLogID= @batchlogid FOR XML PATH('tr'), TYPE )
    as NVarchar(max)) +'</table>'
    -- print @tableHTML
    if not exists (select 1 from BatchStatus where BatchId=@batchlogid and ( InRule='f'))
    set @TableHTML2 = 'Error Reason :N/A'
    end
    -- insert into #tmp values ( @TableHTML1)
    --select * from #tmp
    Set @tableHTML= 'Hello '+@UserId+', <br>Information:'+isnull(@Information,'') +
    '<Table Border=1><Tr><th>Sr No</th><th>Uploaded files </th>:'+
    CAST ((select td= ROW_NUMBER()over(order by f.FileUploadId), '',
    td = f.TableName , ''
    from abc.FileUploadSummary F where BatchId=@batchlogid
    FOR XML PATH('tr'), TYPE ) AS NVARCHAR(max) )
    +'</table>'+
    'Error Reason :'+isnull(isnull(@TableHTML1,'')+ isnull(@TableHTML2,''),'N/A')+ --concat (isnull(@TableHTML1,''),isnull(@TableHTML2,'')
    '<br> Please login to Your Account for further Details..!'
    +'<br>@Note: This is system generated message, Do not reply to this mail. <br>Regards,<br>'+
    'Admin'
    print @tableHTML
    SET @sql = ' EXEC msdb.dbo.sp_send_dbmail @profile_name = ''DBA_mail_test''
    ,@recipients = ''' + isnull(@recipients1,'''') + ''',@subject = ''' + isnull(@mailheader,'''') + ''',
    @body = ''' +isnull(@tableHTML,'''')+ ''',
    @body_format = ''HTML'''
    Exec(@sql)
    END TRY
    BEGIN CATCH
    PRINT error_message()
    -- Test whether the transaction is uncommittable.
    -- IF (XACT_STATE()) = - 1
    -- ROLLBACK TRANSACTION --Comment it if SP contains only select statement
    DECLARE @ErrorFromProc VARCHAR(500)
    DECLARE @ErrorMessage VARCHAR(1000)
    DECLARE @SeverityLevel INT
    SELECT @ErrorFromProc = ERROR_PROCEDURE()
    ,@ErrorMessage = ERROR_MESSAGE()
    ,@SeverityLevel = ERROR_SEVERITY()
    --INSERT INTO dbo.ErrorLogForUSP (
    -- ErrorFromProc
    -- ,ErrorMessage
    -- ,SeverityLevel
    -- ,DateTimeStamp
    --VALUES (
    -- @ErrorFromProc
    -- ,@ErrorMessage
    -- ,@SeverityLevel
    -- ,GETDATE()
    END CATCH
    END
    please help me to solve this problem
    Niraj Sevalkar

    This is no string http in your procedure. Then again the error message points to a line 47 outside a stored procedure. I can't tell it is outside, since there is no procedure name.
    But I see that you have this piece of dynamic SQL:
    SET @sql = ' EXEC msdb.dbo.sp_send_dbmail @profile_name = ''DBA_mail_test''
    ,@recipients = ''' + isnull(@recipients1,'''') + ''',@subject = ''' + isnull(@mailheader,'''') + ''',
    @body = ''' +isnull(@tableHTML,'''')+ ''',
    @body_format = ''HTML'''
     Exec(@sql)
    Why is this dynamic SQL at all? Why not just make plain call to sp_send_dbmail?
     EXEC msdb.dbo.sp_send_dbmail @profile_name = 'DBA_mail_test'
    ,@recipients = @recipients1, @subject = @mailheader, @body = @tableHTML
    Erland Sommarskog, SQL Server MVP, [email protected]

  • How pass progressive in a stored procedure

    Hi,
    I've 3 procedures:
    procedure EXEC_STOR_A;
    procedure EXEC_STOR_B (SERV_IN VARCHAR2, NAME_IN VARCHAR2);
    procedure EXEC_STOR_C (SERV_IN VARCHAR2, NAME_IN VARCHAR2);
    and I've created one stored procedure that run the 3 procedures simultaneously
    CREATE OR REPLACE PROCEDURE EXEC_MORE_PROC
    IS
    ERR_MSG VARCHAR2(300);
    ERR_NUM NUMBER;
    PROG NUMBER;
    BEGIN
    EXEC_STOR_A;
    EXEC_STOR_B ('OC', 'MY_STOR_B'));
    EXEC_STOR_C ('OC', 'MY_STOR_C'));
    EXCEPTION
    WHEN OTHERS THEN
         err_msg:= SUBSTR(SQLERRM, 1, 300);
         err_num:= SQLCODE;
         INSERT INTO REP_MESS (proc_name, err_code, err_msg, err_date)
    VALUES ('EXEC_MORE_PROC', err_num, err_msg, sysdate);
    COMMIT;
    END;
    EXEC_STOR_B and EXEC_STOR_C insert the value NAME_IN in the tables MY_TAB_B, MY_TAB_C and progressive starting from 0:
    CREATE TABLE MY_TAB_B (
    ID VARCHAR2 (12),
    NAME VARCHAR2 (32)
    PROGRESSIVE NUMBER);
    CREATE TABLE MY_TAB_B (
    ID VARCHAR2 (12),
    NAME VARCHAR2 (32)
    PROGRESSIVE NUMBER);
    for example when I execute the proc EXEC_MORE_PROC the first time I get (in MY_TAB_B):
    ID.........NAME........PROGRESSIVE
    1.........MY_STOR_B.........0
    10........MY_STOR_B.........0
    88........MY_STOR_B.........0
    99........MY_STOR_B.........0
    when I execute the proc EXEC_MORE_PROC the second time I get (in MY_TAB_B):
    ID.........NAME........PROGRESSIVE
    1.........MY_STOR_B.........1
    10........MY_STOR_B.........1
    88........MY_STOR_B.........1
    99........MY_STOR_B.........1
    Now I'd like to create my stored procedure, inserting into column NAME the value NAME_IN + progressive:
    for example when I execute the proc EXEC_MORE_PROC the first time I get (in MY_TAB_B):
    ID.........NAME..........PROGRESSIVE
    1.........MY_STOR_B_0.........0
    10........MY_STOR_B_0.........0
    88........MY_STOR_B_0.........0
    99........MY_STOR_B_0.........0
    when I execute the proc EXEC_MORE_PROC the second time I get (in MY_TAB_B):
    ID.........NAME..........PROGRESSIVE
    1.........MY_STOR_B_1.........1
    10........MY_STOR_B_1.........1
    88........MY_STOR_B_1.........1
    99........MY_STOR_B_1.........1
    How can I pass varchar2+number in my stored procedure??
    Thanks in advance!!

    and I've created one stored procedure that run the 3
    procedures simultaneouslyActually, you've create one procedure that runs the three procedures sequentially. If you want parallelism, you would have to do something like spawning three background jobs via DBMS_JOB.
    w I'd like to create my stored procedure, inserting
    into column NAME the value NAME_IN + progressive:
    How can I pass varchar2+number in my stored
    procedure??This looks to be the only question you're asking. The answer would seem to be to add a numeric parameter to the stored procedure(s). If the question is how to concatenate a number to a string, that's just
    <<string>> := <<string>> || to_char(<<number>>)Justin

  • SQL Developer Bug: NVL() function error when debug/run stored procedure

    Version:
    SQL Developer: 1.5.3 (build main-5783)
    Oracle DB connected: Oracle9i Enterprise Edition Release 9.2.0.6.0
    Stored procedure code like this:
    procedure search(V_STATUS_IN IN CHAR(1)) is
    begin
    declare
    V_STATUS CHAR(1) := NULL;
    begin
    V_STATUS := NVL(V_STATUS_IN, '%'); -- error line
    end;
    end;
    The stored procedure runs well (I mean no oracle exception) when called through Java code (and in TOAD). But when debug/run in SQL Developer, following error at the error line:
    $Oracle.EXCEPTION_ORA_6502:
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    --------------------------------------------------*/

    What parameter are you passing in? It is possible you are trying to cram a multibyte character into a singlebyte container. What are the nls settings for the database and for sqldeveloper?

  • Extended stored procedures

    Hi All,
    We are in a process of migrating our SQL 7 databases to Oracle 8i, We are using the OWB tool. And have migrated some of the database objects.
    Our SQL 7 database has around 50 extended stored procedures, doing various important things. We need to migrate these extended procedures to oracle. But we are unable to find out the equivalent for these SQL 7 Extended Stored Procs in Oracle.
    Can you please let us know what is the equivalent for these in Oracle ? Will I be able to call a C/C++ DLL from within Oracle ? If I can, then how do I do it ? If I cant whats the workaround for that ? Do we have any white paper/links which explains these ?
    Thanks in advance.
    Cheeni
    null

    I think this equivalent to Oracle's External Stored procedures, where you can call OS command line from an Oracle Stored procedure. This is discussed in the PL/SQL User's guide and reference, Chapter 10

  • SSRS Calling a Stored Procedure error : PLS-00306: wrong number or types of arg...

    Hi,
    My Problem is when im adding dataset with stored procedure, im getting this error.
    I Can access database, 
    Could not create a list of fields for the query. Verify that you can connect to the data source and that your query syntax is correct.
    ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'PROCEDURE_NAME' ORA-06550: line 1, column 7: PL/SQL:
    Statement ignored
    stored procedure is simple select :
    CREATE OR REPLACE PROCEDURE [PROCEDURE_NAME](L_CURSOR out SYS_REFCURSOR)
    is
    Begin
    open L_CURSOR for
    SELECT [columnname] FROM
    [tablename]
    End;
    Configuration Details:
    DB: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64biOracle Developer Tools for Visual Studio Copyright (c) 2005,2014 SQL Server Data Tools Type: Oracle , Data Provider : .Net Framework Data Provider For Oracle

    The answer is of inside question. It is about provider. Change my provider ODTwithODAC for 10g (my database version). And problem resolved.
    Thank you for your helps,
    Regards,
    Arda

  • Stored Procedure to delete a number of tables with a common name attribute

    Hi All,
    This is my first post so I hope I have posted to the required level with sufficient information. This is my first stored procedure (SP) and is for Oracle 10.
    I am trying to write a script to delete 11 tables and some rows from another 3 tables, all of which are named with a number that I would like to input at the point of creation of the SP. Below is the script I have written and edited. My original has been lost by crashing servers!
    When I run the script it gives me the following output:
    "Warning: execution complete with warning
    procedure ScenarioDelete compiled"
    The SP hasn't deleted any of the tables and I'm not sure if it's because my script is poor or because of something else. Any help is greatly appreciated!!
    -- table delete SP
    -- Run begin ScenarioDelete ('x'); with x as the ScenarioId
    create or replace procedure ScenarioDelete (ScenarioNo IN varchar2);
    countstable := 'C_' || ScenarioNo;
    changetable := 'CG_' || ScenarioNo;
    countsinfotable := 'CI_' || ScenarioNo;
    datatable1 := 'D_0_' || ScenarioNo;
    datatable2 := 'D_1_' || ScenarioNo;
    datatable3 := 'D_2_' || ScenarioNo;
    hietable1 := 'HI_0_' || ScenarioNo;
    hietable2 := 'HI_1_' || ScenarioNo;
    hietable3 := 'HI_2_' || ScenarioNo;
    hielinktable1 := 'HL_1_' || ScenarioNo;
    hielinktable2 := 'HL_2_' || ScenarioNo;
    AS
    execute immediate 'drop table ' || countstable;
    execute immediate 'drop table ' || changetable;
    execute immediate 'drop table ' || countsinfotable;
    execute immediate 'drop table ' || datatable1;
    execute immediate 'drop table ' || datatable2;
    execute immediate 'drop table ' || datatable3;
    execute immediate 'drop table ' || hietable1;
    execute immediate 'drop table ' || hietable2;
    execute immediate 'drop table ' || hietable3;
    execute immediate 'drop table ' || hielinktable1;
    execute immediate 'drop table ' || hielinktable2;
    execute immediate 'delete from USERACESS where SCENARIOID = ' || ScenarioNo;
    execute immediate 'delete from SCENARIO where SCENARIOID = ' || ScenarioNo;
    execute immediate 'delete from SCENARIOINFO where SCENARIOID = ' || ScenarioNo;
    -- or --
    execute immediate 'delete from USERACESS where SCENARIOID = '' || ScenarioNo || ''';
    execute immediate 'delete from SCENARIO where SCENARIOID = '' || ScenarioNo || ''';
    execute immediate 'delete from SCENARIOINFO where SCENARIOID = '' || ScenarioNo || ''';
    END;

    Hi,
    Welcome to the forum!
    When you compile a stored procedure, you get only the vaguest of error messages by default.
    Always say SHOW ERRORS immediately after compiling, to get more detailed error messages. (And, of course, post the complete error message, including line number, when you need help.)
    Remember to specify a datatype (and, in the case of VARCHAR2 variables, a maximum length) for all local variables you declare:
    create or replace procedure ScenarioDelete (ScenarioNo IN varchar2)     -- no semicolon here
    AS  -- AS or IS (it doesn't matter which) required here
        countstable  VARCHAR2 (50) := 'C_'  || ScenarioNo;
        changetable  VARCHAR2 (50) := 'CG_' || ScenarioNo;
    ...You're not actually wasting any space if you decalre the variable as 50 characters, but only use 3.
    It really helps if you format code, so that, for example,
    all the local variables are indented before the word BEGIN
    everything between BEGIN and its corresponding END is indented
    everything between IF and its corresponding END IF is indented,
    and so on.
    You're probably already doing that, but it doesn't show up on this site unless you type these 6 characters
    (small letters only, inside curly brackets) before and after the formatted text.
    That's what I did for the code fragement above.
    Edited by: Frank Kulash on Mar 23, 2009 12:04 PM
    Formatting stuff added.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • No line numbers in stack trace from Java Stored Procedure exception

    I have a Java Stored Procedure which can generate an exception. In one database (11.1.0.6) the Java stack trace contains line numbers for my code, but not for the classes loaded by default with the JVM. In another database (same version) the Java stack trace does NOT contain line numbers for my code, but does contain them for some of the classes loaded by default with the JVM!
    Neither of the schemas where I am running the the Java stored procedure has a JAVA$OPTIONS tables as described here:
    http://download.oracle.com/docs/cd/B28359_01/java.111/b31225/chtwo.htm#BABIGFGA
    So the Java should have been compile "-debug" by default in both schemas. I specifically set the debug option to true using:
    exec dbms_java.set_compiler_option('', 'debug', 'true');
    but this had no effect.
    Can anyone explain this behavior or tell me how to always get line number in the Java stack trace?

    Hi,
    Try using java.util.logging package. Using these packages you can configure your logging information to include context down to the class name. Then each log message would be unique enough to know where it came from.
    -Priyanka

  • How to determine number of records in recordset returned by stored procedure?

    In TestStand 3.0 I am calling an SQL stored procedure where the stored
    procedure returns a recordset. Everything appears to work (I can
    iterate through the recordset and see that the data is valid).
    However, I can not figure out how to easilly determine how many
    records are actually in the recordset. Unlike the 'Open SQL
    Statement' step, in the 'Data Operation' step that actually invokes
    the stored procedure, there is no 'Number of Records Selected' option
    to specify a TestStand variable to accept this value. I know I could
    iterate through the returned recordset incrementing a counter until a
    Fetch fails, but for larger recordsets, traversing the table multiple
    times would be quite time consuming
    . I am hoping to avoid this if
    possible. Is there an easier way to get the number of records in a
    recordset returned from a stored procedure call?
    Bob

    Bob -
    The cursor type of the ADO Recordset object affects whether the number of records can be determined. The Recordset.RecordCount property will return -1 for a forward-only cursor; the actual count for a static or keyset cursor; and either -1 or the actual count for a dynamic cursor, depending on the data source.
    Because ADO does not let me set the cursor type for command objects which is what a stored procedure requires, it is up to the data source to determine the type of cursor and the support for record count.
    Scott Richardson (NI)
    Scott Richardson
    National Instruments

  • How to run stored procedure in DOS command line????

    Hi,
    I want to run a stored procedure in DOS command line?
    (My_Stored_Procedure is the stored procedure that I want to run )
    This is what I did in DOS prompt
    C:\>sqlplus scott/tiger exec lMy_Stored_Procedure <Return>
    Obviously it is NOT working. Please send me the correct way to fix this.
    Thanks so much in advance for helping.
    Cuong

    Billy  Verreynne  wrote:
    BluShadow wrote:
    True Billy, but even Windows hasn't completely got away from using the "DOS" word...Yeah - the command line/shell environment is based on that of the old DOS command interpreter. But Microsoft does not make the mistake of call it DOS.
    In fact, with earlier versions of Windows NT, a 16bit DOS real-mode virtual machine was supported. This was very kewl.
    Running a large BBS with multiple nodes back then required a DOS machine per node, an IPX network, and a Novell file server.Novell Netwars. ;)
    Ahhhh! good old DOS... so many good programs written at that low level, outside the Windoze environment.Yeah.. cut my teeth on writing code for DOS. Still have all my old BIOS and assembler manuals for it. Wrote my own screen s/w (write to a buffer and then move it into the video buffer, instead of writing char wise to the video buffer via interrupts), mucking about with my own concurrent threading model (using very simplistic cooperative multitasking) and so on. Heck, wrote tons of s/w on DOS... :-)Yeah I've still got a copy of my old machine code programs for writing to buffers and screen memory switching for smooth animation. Run them nowadays and they run like sh!t off a shovel. And all my old coursework including writing an interpreted language and multi-window (dos based windows) editor, parser and the code to execute the language and display the output. Oooo, and so much other stuff.
    Awesome back then as you got really intimate with the o/s and hardware. This is sorely lacking today in environments like Java. And I think the reason why so much code written today is less than optimal - to put it kindly.Exactly. Started for me on the Sinclair zx81 (writing Basic), then the Sinclair Spectrum (Basic and Assembly), then Sinclair QL (yes I really had one!) and then the BBC Master 128K (where I got to writing my own rom filing system and creating my own eproms, to integrate with the word processor for additional printing features etc. as well as storing games on rom for speedy loading - and I still have it and it still works!)
    It's that level of working with the underlying memory and assembly language that gives you the understanding of how values are passed between code using the stack and registers, and how memory allocation and referencing is done etc. As you say... it's missed in a lot of todays teaching, which just seems too high level and misses the basic concepts of things such as datatypes and why they are different. I bet half the modern programmers wouldn't have a clue how to do multiplication or division of binary numbers using the carry flag.

Maybe you are looking for

  • FULL SCREEN DISPLAY problema

    Hello everybody! I've written my first code for J2ME MIDP. I'm learning about paint method of Canvas class. I put below code in the paint method: g.drawString("Width: "+Integer.toString(getwidth()),0,0,Graphics.TOP|Graphics.LEFT); g.drawString("Width

  • Adding an image in a pdf using samsung note 10.1

    Can somebody advise on how I can add a photo using my samsung galaxy 10.1?

  • QM Manual Inspection Lot - with Inspection lot origin 89

    Hi QM Guru, I did maintain inspection type 10 in this material but while i would like to create the inspection lot manually. I try to create manual inspection lot manually , i encounter this error with Inspection lot origin 89. No valid inspection ty

  • ORA-07445 during Partition Split in Oracle 10g

    Hi I'm getting the following trace file generated when I try and split a partition with 4 or more partition keys. The environment is 10g enterprise edition on Redhat Enterprise Server 3. ORA-07445: exception encountered: core dump [msqopnws()+37] [SI

  • Do you know how bigoted your company appears now?

    You are what you accused Brendan Eich of being. You are bigots. Full blown cowards. I hope your company experiences a huge loss because of your actions.