Procedure Parameter - Size of Varchar2

Hi,
I have a doubt regarding the procedure/Function parameter.
We can pass varchar2 as parameter in Procedure and function. What is it default size since in table it has 4000 bytes but in procedure/function what is it size?
Please advise.
Thanks in advance.

I think there is no restriction.
I think it is a best practise that ,instead of passing many arguments in procedure pass an object or record that holds many fields. It is more maintable
Regards...

Similar Messages

  • Help with Input/Output Parameter Size using OLE DB Provider

    I am using the OLE DB Provider for 9i in an Active Server Page to call a stored procedure in a 9i database. I pass have an input/output parameter (adVarChar with adSize=30) in which I pass a two digit number in, and expect to get a character value greater than 2 characters in return. However, when I execute the stored procedure call, it appears the value being returned in the parameter is being truncated to the size of the value I passed in (2 characters). Is there a way I can insure the parameter will return the entire length of the result regardless of the length of the input value?

    cmd.Parameters.Add("retstatus", OracleDbType.Varchar2, 200, ParameterDirection.InputOutput); It seems to me that you're trying to use an OracleParameter constructor with parameter name, parameter type, parameter SIZE, and parameter direction. But OracleParameter class does not have any such constructor. Therefore, your test tries to use another constructor incorrectly.
    OracleParameter has two constructors with four parameter ...
    public OracleParameter(string parameterName, OracleDbType type, object obj, ParameterDirection direction)
    public OracleParameter(string parameterName, OracleDbType type, int size, string srcColumn)
    ... and none of these matches your constructor. One way to solve this problem is to use appropriate constructor or OracleParameter properties.

  • What's the maximum size a varchar2  variable can hold for and NDS Stmnt?

    What's the maximum size a varchar2 variable can hold for and NDS Statement? I read that NDS is good for doing EXECUTE IMMEDIATE on statements that aren't too big. The 10g PL/SQL manual recommends using DBMS_SQL for statements that are too large, but it never gave a limit for what too large was. Does anyone know offhand?

    The limit is the same as the length of varchar2 variable within PL/SQL - that is varchar2(32767).It's not documented, but intermediate concatenation result can hold up to (64k-1) :
    Connected to:
    Oracle9i Enterprise Edition Release 9.2.0.8.0 - Production
    declare
      part1 varchar2(32767) := rpad('begin null;', 32767);
      part2 varchar2(32767) := lpad('end;',        32767);
    begin
      dbms_output.put_line(length(part1 || ' ' || /*' ' ||*/ part2));
      execute immediate part1 || ' ' || part2;
    end;
    65535
    PL/SQL procedure successfully completed.

  • How to call a script with procedure parameter

    I have a script my_script.sql in sqlplus and that script calls a procedure with one in parameter my_procedure (my_parameter IN VARCHAR2).
    I need to pass the parameter in the script call.
    sqlplus>@my_script my_parameter
    How can I do that?

    SQL> set serveroutput on
    SQL> create or replace procedure testpass (par1 in varchar2)
      2  is
      3  begin
      4     dbms_output.put_line(par1);
      5* end;
    SQL> get my_script
      1* exec testpass ('&1');
    SQL> @my_script 'This is the parameter'
    This is the parameter
    PL/SQL procedure successfully completed.
    SQL>                                                                                        

  • Best size of procedure cache size?

    here is my dbcc memusage output:
    DBCC execution completed. If DBCC printed error messages, contact a user with System Administrator (SA) role.
    Memory Usage:
                                       Meg.           2K Blks                Bytes
          Configured Memory:     14648.4375           7500000          15360000000
    Non Dynamic Structures:         5.5655              2850              5835893
         Dynamic Structures:        70.4297             36060             73850880
               Cache Memory:     13352.4844           6836472          14001094656
          Proc Cache Memory:        85.1484             43596             89284608
              Unused Memory:      1133.9844            580600           1189068800
    So if proc cache is too small? I can put used memory 1133M to proc cache. but as many suggested that proc cache should be 20% of total memory.
    Not sure it should be 20% of max memory or Total named cache memory?

    Hi
    Database size: 268288.0 MB
    Procedure Cache size is ..
    1> sp_configure 'procedure cache size'
    2> go
    Parameter Name                 Default     Memory Used  Config Value    Run Value         Unit                            Type
    procedure cache size           7000          3362132        1494221           1494221         Memory pages(2k)     dynamic
    1> sp_monitorconfig 'procedure cache size'
    2> go
    Usage information at date and time: May 15 2014 11:48AM.
    Name                      Num_free    Num_active  Pct_act Max_Used    Reuse_cnt   Instance_Name
    procedure cache size          1101704      392517  26.27       787437      746136 NULL
    1> sp_configure 'total logical memory'
    2> go
    Parameter Name           Default     Memory Used   Config Value      Run Value           Unit                         Type
    total logical memory        73728    15624170           7812085             7838533      memory pages(2k)     read-only
    I got to know that the oparameter 'Reuse_cnt' should be zero from an ASE expert.
    Suggest me if I need to increase the procedure cache with explanation
    Thanks
    Rajesh

  • Stored Procedure parameter (@Carrier) used in report and can't be set via code

    I have a report that has regular Crystal parameters that I am setting correctly via code.  However, one report actually uses one of the database parameters from the stored procedure that the report was created from.  It is the only report like this and I'm using the same code in an attempt to set it's value.  Although no error is thown, if I look at the parameter value in the IDE it is set correctly, but the field on the report just shows up blank.  I have changed the way the report is created.  Previously, I used the report.export method to create the actual file via a stored procedure.  Now, I'm running the stored procedure first and creating a datatable.  This allows me to execute the SP only once to see if it has data, because only then do I want to create the actual report.  I'm using the SetDataSource method to pass the datatable into Crystal and then using the report.export method to create the report with data.  Everything seems to work, except this stored procedure parameter (@Carrier) is not actually being populated to display on the report.
    Not sure what to look at.  Any suggestions?
    Thanks.

    crpe32.dll is version 13.0.5.891.  This was developed in VS2012 and VB.NET.  I'm using ADO.Net to connect to a MS SQL Server database.
    MainReport.SetDataSource(DTbl)
    bRC = PopulateAllSubReports(MainReport)
    If Not bRC Then Throw New Exception("Received an error in PopulateAllSubReports.")
    bRC = PopulateCrystalParameters(MainReport, SP)
    If Not bRC Then Throw New Exception("Received an error in PopulateCrystalParameters.")
    'Actually create the output file.
    bRC = ExportData(MainReport)
    Private Function PopulateCrystalParameters(myReportDocument As ReportDocument, SP As ReportStoredProcedureCrystal) As Boolean
         Dim myParameterFieldDefinitions As ParameterFieldDefinitions = Nothing
         Dim myParameterFieldDefinition As ParameterFieldDefinition = Nothing, ParamValue As String = ""
         Dim bRC As Boolean, Param As SqlParameter = Nothing
         Try
         myParameterFieldDefinitions = myReportDocument.DataDefinition.ParameterFields
    '*********************Report Parameters***************************
         For Each myParameterFieldDefinition In myParameterFieldDefinitions
              myParameterFieldDefinition.CurrentValues.Clear()
              Select Case myParameterFieldDefinition.ParameterFieldName.Trim.ToUpper
              Case "@CARRIER"
                   If SP.DBParameters.ContainsKey("@CARRIER") Then
                        Param = SP.DBParameters("@CARRIER")
                        ParamValue = NullS(Param.Value).Trim
                        bRC = SetCurrentValueForParameterField(myParameterFieldDefinition, ParamValue)
                        If Not bRC Then Return False
                   End If                           
              End Select
         Next
         Return True
         Catch ex As Exception
         GmcLog.Error("ReportKey = " & Me.ReportKey.ToString & ", " & ex.Message, ex)
         Return False
         End Try
    End Function
    Private Function SetCurrentValueForParameterField(myParameterFieldDefinition As ParameterFieldDefinition, submittedValue As Object) As Boolean
         Dim currentParameterValues As ParameterValues = Nothing
         Dim myParameterDiscreteValue As ParameterDiscreteValue = Nothing
         Try
         myParameterDiscreteValue = New ParameterDiscreteValue
         myParameterDiscreteValue.Value = NullS(submittedValue).Trim
         currentParameterValues = New ParameterValues
         currentParameterValues.Add(myParameterDiscreteValue)
         myParameterFieldDefinition.ApplyCurrentValues(currentParameterValues)
         Return True
         Catch ex As Exception
         GmcLog.Error("ReportKey = " & Me.ReportKey.ToString & ", " & ex.Message, ex)
         Return False
         Finally
         myParameterDiscreteValue = Nothing
         currentParameterValues = Nothing
         End Try
    End Function
    Private Function SetDBSourceForSubReport(mySubReport As ReportDocument) As Boolean
         Dim myTables As Tables = Nothing, myTable As Table = Nothing, DTbl As DataTable, SP As StoredProcedure = Nothing
         Try
         myTables = mySubReport.Database.Tables
         For Each myTable In myTables
              Dim SPName As String = myTable.Location.Substring(0, myTable.Location.IndexOf(";"c))
              SP = New StoredProcedure(ConnectionString, SPName, CommandType.StoredProcedure)
              DTbl = SP.FillTable
              mySubReport.SetDataSource(DTbl)
              SP = Nothing
         Next
         Return True
         Catch ex As Exception
         GmcLog.Error("ReportKey = " & Me.ReportKey.ToString & ", " & ex.Message, ex)
         Return False
         Finally
         If Not SP Is Nothing Then SP = Nothing
         If Not myTable Is Nothing Then myTable = Nothing
         If Not myTables Is Nothing Then myTables = Nothing
         End Try
    End Function
    Private Function PopulateAllSubReports(myReportDocument As ReportDocument) As Boolean
         Try
         Dim mySections As Sections = myReportDocument.ReportDefinition.Sections
         For Each mySection As Section In mySections
              Dim myReportObjects As ReportObjects = mySection.ReportObjects
              For Each myReportObject As ReportObject In myReportObjects
                   If myReportObject.Kind = ReportObjectKind.SubreportObject Then
                        Dim mySubreportObject As SubreportObject = CType(myReportObject, SubreportObject)
                        Dim subReportDocument As ReportDocument = mySubreportObject.OpenSubreport(mySubreportObject.SubreportName)
                        Dim bRC = SetDBSourceForSubReport(subReportDocument)
                        If Not bRC Then Return False
                   End If
              Next
         Next
         Return True
         Catch ex As Exception
         GmcLog.Error("ReportKey = " & Me.ReportKey.ToString & ", " & ex.Message, ex)
         Return False
         End Try
    End Function

  • How can I find out if the rollback optimal parameter size has been set ?

    What is the command to find out if the rollback optimal parameter size has been set? And what is the command to find out what is the rollback optimal parameter set to?

    You can find the OPTIMAL size in v$rollstat.optsize

  • Character parameter size

    hi,
    what is the maximum size for a character parameter. I set a user parameter size to 64000 and compiling works. But when I run the report, it works only for strings having size less than about 32700.
    Is it possible to pass a report a CLOB parameter? thanks

    Hi,
    i use datapump on a regular manner to transfer a database from one server to another. Normaly not with the intention to change block size or character sets. But i think, that does not matter.
    It works perfectly.
    I will recommend to use the character set change tool from oracle to check the compatibility of your data with the new character set before you expdp and impdp the data. But if there is no problem reported from csscan you can just go on.
    Export the data with the old character set and set on the new db server the new character set via nls_lang and import the data.
    Or export the data with nls_lang pointing to the new character set and import it with the same nls_lang parameter. As far a i remember, both ways are equal.
    The block size is nothing to be aware of, the impdp will just use what it find :)
    hth
    Joerg

  • Procedure varchar2 parameter size limit? ORA-6502 Numeric or value error

    Hi ALL,
    I am trying to create out parameters in a Procedure. This procedure will be called by 4 other Procedures.
    PROCEDURE create_serv_conf_attn_cc_email
    ( v_pdf_or_text varchar2,
    v_trip_number number ,
    v_display_attn_for_allmodes out varchar2,
    v_display_cc_for_allmodes out varchar2,
    v_multi_email_addresses out varchar2,
    v_multi_copy_email_addresses out varchar2
    When I call that procedure in another Procedure I am getting following error, which is caused by one of the out parameter being more than 255 characters.
    I found that out via dbms_output.put_line(ing) one of the out parameter as I increased its size.
    ORA-06502: PL/SQL: numeric or value error
    I thought there was no size limit on any parameters passed to a Procedure.
    Any one know of this limit of 255 characters on varchar2 Procedure parameters? Is there a work around keeping the same logic?
    If not I will have to take those parameters out and resort to some global varchar2s which I do not like.
    Thanks,
    Suresh Bhat

    I assume one of the variables you have declared is not large enough for it's assignment.
    Here's an example.
    ME_XE?create or replace procedure test_size(plarge in out varchar2 )
      2  is
      3  begin
      4     plarge := rpad('a', 32000, 'a');
      5  end;
      6  /
    SP2-0804: Procedure created with compilation warnings
    Elapsed: 00:00:00.03
    ME_XE?
    ME_XE?declare
      2     my_var   varchar2(32767);
      3  begin
      4     test_size(my_var);
      5     dbms_output.put_line(length(my_var));
      6  end;
      7  /
    32000
    PL/SQL procedure successfully completed.
    --NOTE here how the declared variable is 500 characters, but the procedure will try to assign it over 32,000 characters...no dice
    Elapsed: 00:00:00.00
    ME_XE?
    ME_XE?declare
      2     my_var   varchar2(500);
      3  begin
      4     test_size(my_var);
      5     dbms_output.put_line(length(my_var));
      6  end;
      7  /
    declare
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    ORA-06512: at "TUBBY.TEST_SIZE", line 4
    ORA-06512: at line 4
    Elapsed: 00:00:00.04Edited by: Tubby on Oct 22, 2008 12:47 PM

  • Passing the database name as a PL/SQL procedure parameter

    How do I pass the name of the database as a parameter to a procedure?
    If dbs is the variable name to which I pass the database name as shown in the example,
    CREATE OR REPLACE PROCEDURE Extract_gl_acct_Tbl(dbs varchar2)
    and I use dbs in the code as follows,
    SELECT ACCOUNT,
    SETID
    FROM SYSADM.PS_GL_ACCOUNT_TBL@dbs
    It gives me an error saying 'ORA-04054: database link DBS does not exist'.

    You will need to use dynamic SQL to handle this:
    create or replace ...
    is
    type rc is ref cursor;
    v_rc rc;
    begin
    open v_rc for 'select ... from sysadm.ps_gl_account_tbl@' || dbs;
    fetch v_rc into ... -- some variables
    -- if multiple rows, you'll need to do the fetch in a loop and exit when v_rc%notfound.
    close v_rc;
    end;

  • Procedure parameter of type returned by function

    Hi there
    I want to know if it's possible to pass a parameter to procedure of type returned by function
    Something like that
    pocedure test(x in varchar2
    ,y in my_function(param)
    )

    Definitely don't fullish yourself ;-)
    AFAIK you cannot declare a variable based on the return type of a function.
    Perhaps though you are looking for SUBTYPEs.
    SQL> SET SERVEROUTPUT ON;
    SQL> DECLARE
      2    SUBTYPE subtype_name IS VARCHAR2 (30) NOT NULL;
      3
      4    PROCEDURE procedure_name (
      5      parameter_name IN subtype_name)
      6    IS
      7    BEGIN
      8      DBMS_OUTPUT.PUT_LINE (parameter_name);
      9    END;
    10
    11    FUNCTION function_name (
    12      parameter_name IN DATE)
    13      RETURN subtype_name
    14    IS
    15    BEGIN
    16      RETURN TO_CHAR (parameter_name, 'DAY');
    17    END;
    18
    19  BEGIN
    20    procedure_name (function_name (SYSDATE));
    21  END;
    22  /
    THURSDAY
    PL/SQL procedure successfully completed.
    SQL>

  • ?Table_name as a procedure parameter

    Hi, does anyone know how to accept table and column names as arguements. I created a view from user_tab_columns so I can see the table (parameter) in the procedure but I can't update or insert because Oracle can't see the table.
    The code looks something like this so far!
    CURSOR MYCURSOR IS
    SELECT p_column_name, p_table_name| |'_REC' -- primary key
    FROM my_view
    WHERE table_name = p_table_name
    AND column_name = p_column_name;
    FOR record in cursor LOOP
    pl/sql code to change all records
    (Here's the problem)
    UPDATE p_table_name set p_column_name = v_new_column
    WHERE p_table_name| |'_REC' = record.p_table_name| |'_REC';
    ERROR p_table_name must be declared!
    Any help?
    Thanks
    Dave

    You need to give explicit rights on the tables, that is not through roles. The table names will simply not show up in the select statement unless you have been granted direct rights on them. So your problem could be that you have rights on the tables through a role, but what you need is to log in as the owner and i.e.
    grant select, insert, update on emp to developer
    etc.
    If it's not this I'm lost.
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by David Wilton ([email protected]):
    Hi, does anyone know how to accept table and column names as arguements. I created a view from user_tab_columns so I can see the table (parameter) in the procedure but I can't update or insert because Oracle can't see the table.
    The code looks something like this so far!
    CURSOR MYCURSOR IS
    SELECT p_column_name, p_table_name| |'_REC' -- primary key
    FROM my_view
    WHERE table_name = p_table_name
    AND column_name = p_column_name;
    FOR record in cursor LOOP
    pl/sql code to change all records
    (Here's the problem)
    UPDATE p_table_name set p_column_name = v_new_column
    WHERE p_table_name| |'_REC' = record.p_table_name| |'_REC';
    ERROR p_table_name must be declared!
    Any help?
    Thanks
    Dave<HR></BLOCKQUOTE>
    null

  • Maximum Parameter Size?

    I am working on a report which the user can select from a number of text templates from a web form. One of the options is custom text (if the pre-defined ones aren't good enough). This text is passed from the ASP page to Crystal as a parameter, and printed onto the report in the proper place.
    However, there seems to be a 255 character limit for a "string" parameter type. Is this a Crystal 8.5 limitation, or something I am stuck with?
    I am actually passing 3 parameters to Crystal: clientID, addressType, and bodyText. The clientID and addressType are parameters needed for a stored procedure. The bodyText is ignored on all reports with pre-defined text, and they work just fine.
    If I am stuck with the 255 character limit, are there any other ways to get this text into the report? Ideally, I'd like to be able to allow the user up to 2000 characters.
    Thanks in advance!

    OK, I'll look into that. I am quite familiar with arrays, but not sure how to use them in Crystal.
    Another problem I am having now: CR8.5 won't let me re-sort the parameter fields. As stated above, The first two are what the SP needs, the last one contains a string. I use the arrows in Field Explorer to move the parameters fields where I want and then save, but the order doesn't "stick". The third parameter moves to the top!
    I really wish our sys admin was here to get the help portion of CR installed!

  • NVL function is not working is Procedural Parameter's

    Following is the Oracle Forms9i Program Unit. It's not working on Forms 9i though it's working on Forms6i. Please advise some solution, if anyone have experienced same kind of problem.
    PROCEDURE test ( as_case_id VARCHAR2) IS
    BEGIN
    INSERT INTO tab1 ( col1 )
    VALUES ( nvl(as_case_id, ' '));
    END;
    but this way it works fine
    PROCEDURE test ( as_case_id VARCHAR2) IS
    BEGIN
    INSERT INTO tab1 ( col1 )
    VALUES ( as_case_id );
    END;
    My forms9i runtime web session hangs and after sometime it becomes out oracle connection. It happens all the time.
    Thanks,

    did you check the data directly in the database for the ' '(space) or in the form. The field might not show you anything in the form if it's a space.
    Here is a simple test case:
    I have a db table with one column populated with space ' '.
    I have a form with one block with three fields based on that db table. The first field FIELD1 is for db field which holds the space, the 2nd is a db field which is length(FIELD1), and the 3rd field is a calculation field with formula nvl(length(:FIELD1),0). Then i query the block. What i see is the 1st column shows no space, the 2nd column is 1 and the 3rd column is 0. So i guess the form automaticly trim the field before displaying it in the screen.
    I am using Forms 6i.

  • Calling procedure with 4 output varchar2 gets corrupted (via SQLExecDirect)

    I have a procedure:
    create or replace procedure
    cme.GetNominalIndividualDetails(iNominalIndexID in
    number,sSurname out varchar2,sForenames out varchar2,sCRONumber
    out varchar2,dtDOB out date) AS
    begin
    select Surname,Forenames,CRONumber,DOB into
    sSurname,sForenames,sCRONumber,dtDOB from v_NominalIndividual
    where NominalIndexID = iNominalIndexID;
    exception
    when no_data_found then
    begin
    sSurname:=null;
    sForenames:=null;
    dtDOB:=null;
    sCRONumber:=null;
    end;
    end;
    When I call this procedure from code I always get corrupt
    strings comming back (it looks like they are not null
    terminated) using ODBC with VC++ using Bindparameters with
    SQLExecDirect.
    The latest odbc driver is no help..
    If anyone has a solution please let me know... (it works fine
    with our Sybase / MS SQL server databases).
    I am persuming it is a bug in the oracle odbc ??
    Matt.
    Can you email at [email protected]
    Thanks.

    fyi
    Related to the solution/workaround posted by Luc.
    see "Do Oracle's JDBC drivers support PL/SQL tables/result sets/records/booleans? "
    at http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-faq-090281.html#34_05
    regards
    Jan Vervecken

Maybe you are looking for

  • ASA 5510 vpn question

    Hi all, I have 1 ISP link terminated on ASA 5510. Can i configure both easy vpn and site to site vpn on that interface ?

  • JBO-25013: Too many objects match the primary key oracle.jbo.Key[1661 ].

    Hi , I'm using 11g adf I have a table XX , in which C1 and C2 are bind with composite key.I didn't get any issue while adding records , but when i try to fetch records using QB , i'm getting this error below <Utils><buildFacesMessage> ADF: Adding the

  • Album cover.

    Is it possible to make the album covers smaller on the macbook pro when using iTunes with a screen size of 13" it would be a help ( should be a feature ) thanks.

  • How to open Sony SX100M3 Raw files in CS5? [was: Ryo]

    This week, I bought a Sony SX100M3. I don't transfer my photos on Photoshop-Bridge CS5. Why? Update?

  • Guest book with picture upload(php)

    Hi guys , i want to make a guest book with a picture upload system(php) , there are many sources guest book in internet but i cant find anything like this with picture upload.Guest can send their comments and they should upload their picture (like 50