NLS parameters in stored procedure

Hello

I've struggled for some time with the release of one of my SPs
It goes like this:
Begin
Declare the cursor as a query
loop and write lines in a file
end

It is, I can't seem to be able to set the NLS settings correctly. I need the dates out as YYYY-MM-DD HH24:MI:SS, but it doesn't seem to work at all. The columns are the DATE data type, but no matter what I do (of course I do something wrong!) I'm not able to get output only HH24:MI:SS AAAA-MM-JJ.

I tried to use TO_DATE DBMS_SESSION in the query, the immediate execution of the ALTER SESSION SET NLS_DATE.... SET_NLS. Nothing seems to work, any help is appreciated (maybe I lost the DMBS_SESSION.) SET_NLS or something?).

Example code:
CREATE OR REPLACE PROCEDURE TEST  (parameters.. ) AS 
/*variables*/
   
BEGIN 
  DECLARE CURSOR c_AICTT IS 
          SELECT TO_DATE(DATE1,'YYYY-MM-DD HH24:MI:SS'), DATE2 FROM DATES; 
.
.
.
Thanks in advance,
NACEUR

Looks like what you want is not TO_DATE, TO_CHAR.

Don't change the NLS settings; they "belong" to the customer, not to your code.

To_char will make an explicit conversion, the NLS settings does not come into play.

Tags: Database

Similar Questions

  • passing BOLB or CLOB parameters in stored procedures

    Hi all
    I have this procedure for the insertion of the data:
     create or replace procedure procedure_employee( pname in varchar2, ppicture in blob) is begin insert into employee (name, picture) values (pname, ppicture);
    end;
    / 
    .
    How can I insert images while creating an employee? Can I have an example of performing my procedure?
    Kind regards
    SQL> CREATE TABLE pdm(dname VARCHAR2(30),sname VARCHAR2(30),fname VARCHAR2(30),iblob BLOB);
    
    Table created.
    
    SQL> CREATE OR REPLACE PROCEDURE load_file(pdname IN VARCHAR2,
      2                                        psname IN VARCHAR2,
      3                                        pfname IN VARCHAR2) IS
      4
      5    src_file BFILE;
      6    dst_file BLOB;
      7    lgh_file BINARY_INTEGER;
      8  BEGIN
      9    src_file := bfilename('TEMP', pfname);
     10
     11    INSERT INTO pdm
     12      (dname, sname, fname, iblob)
     13    VALUES
     14      (pdname, psname, pfname, EMPTY_BLOB())
     15    RETURNING iblob INTO dst_file;
     16
     17    DBMS_LOB.OPEN(src_file, dbms_lob.file_readonly);
     18    lgh_file := dbms_lob.getlength(src_file);
     19    DBMS_LOB.LOADFROMFILE(dst_file, src_file, lgh_file);
     20    dbms_lob.close(src_file);
     21    COMMIT;
     22  END load_file;
     23  /
    
    Procedure created.
    
    SQL> CREATE OR REPLACE DIRECTORY TEMP AS 'c:\';
    
    Directory created.
    
    SQL> EXECUTE load_file('Test pdname','Test psname','extract.jpg');
    
    PL/SQL procedure successfully completed.
    
    SQL> SELECT dname,sname,fname,DBMS_LOB.getlength(iblob)
      2  FROM pdm;
    
    DNAME                          SNAME
    ------------------------------ ------------------------------
    FNAME                          DBMS_LOB.GETLENGTH(IBLOB)
    ------------------------------ -------------------------
    Test pdname                    Test psname
    extract.jpg                                         2111
    
    SQL> 
    

    NOTE: The path to the 'TEMP' directory object exists already physically in the server database NOT in the local computer.

  • Get the EXIT and the RETURN of a stored procedure parameters

    I have a stored procedure (SQL Server 2008 R2 MS) as in the following example.

    Thanks to the connectivity of database I get OUTPUT parameters, but I can't get the game DATA RECORDS and RETURN value.

    Someone knows how to do this?

    CREATE PROCEDURE [dbo]. [TS_Teste] (@T057_S_NOMEMAQUINA VARCHAR (20), @STATUS INT OUTPUT, OUTPUT OF NVARCHAR (500) OF @ERRO)

    AS

    BEGIN
    DECLARE THE TABLE @TABLE (CODE INT, DESCRIPTION VARCHAR (30))

    INSERT VALUES INTO @TABLE (51, 'A')
    INSERT VALUES INTO @TABLE (52, 'B')

    INSERT VALUES INTO @TABLE (53, 'C')

    SELECT * FROM @TABLE

    SET @STATUS = 1

    SET @ERRO = "Nenhum erro!

    RETURN 0

    END

    I finally found what was wrong... He had a line in the stored procedure only aditional. It should be like this:

    CREATE PROCEDURE [dbo]. [TS_Teste] (@T057_S_NOMEMAQUINA VARCHAR (20), @STATUS INT OUTPUT, OUTPUT OF NVARCHAR (500) OF @ERRO)

    AS

    BEGIN
    SET NOCOUNT ON;                                                                                               -NEW LINE!

    DECLARE THE TABLE @TABLE (CODE INT, DESCRIPTION VARCHAR (30))

    INSERT VALUES INTO @TABLE (51, 'A')
    INSERT VALUES INTO @TABLE (52, 'B')

    INSERT VALUES INTO @TABLE (53, 'C')

    SELECT * FROM @TABLE

    SET @STATUS = 1

    SET @ERRO = "Nenhum erro!

    RETURN 0

    END

  • SQL stored procedure input and output parameters

    Hello Gang,

    My dead end trying to call a stored procedure in SQL Server 2008 with the LV database tool.

    for purposes of experimentation, I've created a small procedure with an input parameter that returns an integer as return value.  It works describing a query, but all attempts at LV produce an error-2147217900 when executing query VI.  I did find examples of that.

    Sending a bunch of parameters to a stored procedure and checking the value of return seems to be pretty common stuff.

    I'll appreciate any help.

    Thank you

    Roger

    Hi Roger,

    There are a few prerequisites which I will list below. If you have not checked these things, so don't hesitate, as your hiccups can be there.

    Prerequisites:

    1. Ensure that you can read from a table in the database to verify that you can access the database (user permissions) and ensure that your login details are correct. Among other things, make sure that the. DSN switches to the correct database. (See the simple example below, SQL Select.vi)
    2. Make sure that your user (if you use SQL authentication) has permissions to run the STORED procedure by running the procedure in SQL Server Management Studio (you seem to have already done this)

    Example by calling a procedure without parameters (attached as SPROC_No_Parameters.vi):

    Example by calling a procedure with parameters (attached as SPROC_Parameters.vi):

    An article on the execution of stored procedures is here:

    http://digital.NI.com/public.nsf/allkb/07FD130746083E0686257300006326C4

    Don't forget to download the example VI since it includes the cases where you want an output parameter of the procedure rather than a table.

    I tested these against two very simple SPROCs and it worked fine (on SQL Server 2005, but 2008 should be the same).  Stored procedures have been:

    CREATE PROCEDURE [dbo]. [GetContacts]

    AS
    BEGIN
    -SET NOCOUNT ON added to avoid additional results sets from
    -interfering with SELECT statements.
    SET NOCOUNT ON;

    -Controls insert for procedure here
    SELECT * FROM Contacts
    END

    and

    CREATE PROCEDURE [dbo]. [MultiplyAges]
    @param1 INT = 1
    AS
    BEGIN
    -SET NOCOUNT ON added to avoid additional results sets from
    -interfering with SELECT statements.
    SET NOCOUNT ON;

    -Controls insert for procedure here
    SELECT (age * @param1) OF Contacts
    END

    I would like to know if these examples work for you or if you have any other questions.  Don't forget to go through this KB article and articles related to it, they should cover other situations.

    Matt

  • Calling stored procedures with parameters with the database connectivity Toolkit

    Hi all

    I'm new to the forum and struggling to find a solution to a particular problem I have in this respect, using the LabVIEW Database Connectivity Toolkit on a project, I am currently working on my work.  I have a database in which I tables and stored procedures with parameters.  Some of these stored procedures have input, output and return parameters.

    I tried to follow this example, but to no avail: http://digital.ni.com/public.nsf/allkb/07FD130746083E0686257300006326C4?OpenDocument

    Such a stored procedure I am working on the implementation is named "dbo.getAllowablePNs", running "SELECT * from DeviceType" (DeviceType is the table).  In this case, it requires no input parameter, it has an output parameter that generates the table [cluster] and has a return parameter that returns an integer value (status code for execution) to show if an error occurred.  The DeviceType table has 3 columns; ID (PK, int not null), PN (nvarchar ((15), null) and NumMACAddresses (int, null).)  I have surpassed many examples and I talk to the support OR try to implement this and similar procedures stored in LabVIEW but have not been successful.  I am able to connect to the database with the VI of open connection without error, but spin in some confusion as a result of this step.  I then try to use the VI of parameter query create to call the stored procedure and set the parameters.  I guess I would then use the Set parameter value for each parameter that is connected to the entry of parameters on the previous query with parameters VI VI?  I am also having some confusion during and after these steps as well.  I would greatly appreciate advice or suggestions that anyone could have in this situation because I am not a SQL expert.  Also, I would be happy to provide more information that might be useful.

    Kind regards

    Jon

    Here's what I use to do this.  I think I had to change him create parameterized query VI for him to work.  There is a post on the forum about this somewhere.

  • Call the stored procedure, and bind parameters by name

    Hello

    I use the Oracle ODBC 12 c driver to pass values from one Interface to our database Oracle 11.2. The Interface software collects data from modbus protocoll and calls a stored procedure. Right now my syntax to call the stored procedure looks like this:

    CALL procedure-name ('STRING', 'Timestamp as String', numValue1);

    It works very well. Now, I have to add a default setting to my procedure. To stay flexible to make other changes, I want to call the procedure and bind the parameters by name. Release 10.2.0.1.0 ISC ODBC Notes:

    Added support for the named parameter, binding the parameters by name. ODBC Oracle driver now allows the application to specify the parameters of a stored procedure by name, in the procedure call. Named parameters are to be used in calls to stored procedures and should not be used in other SQL statements.

    So, it shouldn't be a problem to use named notation, but how do I do this in ODBC? I tried like this, but oracle returns an ora-00936 error of missing expression:

    call procedure-name (paramName1 = > 'STRING',= paramName2 > 'Timestamp as String',paramName3 = > numValue1).


    Thank you for your help.

    Finally, I was able to find the error. The syntax of the statement was very good. The problem was caused by another declaration that I edited before and the error has not attracted Attention immediately.

    Thanks for reading and looking for an answer.

  • Cannot access stored procedure parameters

    Hello

    We are at the point where you try to use a stored procedure from our Java through Toplink code but we seem to have a problem here I couldn't find an answer to. Maybe it's that my Google-Fu is miss you in this case.

    Our problem is thto so that the procedure seems to be cited correctly, we get nothing to Java code. The procedure in question has been tested with the same input parameters of SQLDeveloper and the procedure returns values as it should.

    The procedure signature is

    create or replace PACKAGE FORM_METADATA AS

    PROCEDURE FORM_LIST_GET)

    P_USER_ID IN VARCHAR2,

    P_CHANNEL_NO NUMBER,

    P_START_FROM in NUMBERS, paging

    P_COUNT_TO_RETURN in NUMBERS, paging

    P_GET_TOTAL_COUNT in NUMBER, - if number must total be returned then 1, other wise 0

    P_RESULT_SET ON SYS_REFCURSOR,

    P_TOTAL_COUNT CERTAIN NUMBER);

    end FORM_METADATA;


    Java code invoking this procedure looks like this:

    County of BigDecimal = new BigDecimal(-1);

    A session = getSession().

    session.setLog (new OutputStreamWriter (System.out));

    session.setLogLevel (SessionLog.FINEST);

    StoredProcedureCall procedureCall = new StoredProcedureCall();

    procedureCall.setProcedureName "(FORM_METADATA. FORM_LIST_GET");

    procedureCall.addNamedArgumentValue ("P_USER_ID", "name of user-1");

    procedureCall.addNamedArgumentValue ("P_CHANNEL_NO", new BigDecimal (1));

    procedureCall.addNamedArgumentValue ("P_START_FROM", new BigDecimal (1));

    procedureCall.addNamedArgumentValue ("P_COUNT_TO_RETURN", new BigDecimal (1000));

    procedureCall.addNamedArgumentValue ("P_GET_TOTAL_COUNT", new BigDecimal (1));

    procedureCall.useNamedCursorOutputAsResultSet ("P_RESULT_SET");

    procedureCall.addNamedOutputArgument ("P_TOTAL_COUNT", "count", BigDecimal.class);

    DataReadQuery dq = new DataReadQuery();

    dq.setCall (procedureCall);

    dq.prepareForExecution ();

    Object result = session.executeQuery (dq);

    System.out.println ("result:" + result);

    System.out.println ("result from StoredProcedreCall:" + procedureCall.getResult ());

    The output we get looks like this:

    [Warning TopLink]: 2015.08.31 16:11:30.781 - failed to get InitialContext for saving of MBean: javax.naming.NoInitialContextException: need to specify the class name in the environment or property of the system, as a cmdlet parameter or in a file of application resources: java.naming.factory.initial

    [Warning TopLink]: 2015.08.31 16:11:30.797 - failed to get InitialContext for saving of MBean: javax.naming.NoInitialContextException: need to specify the class name in the environment or property of the system, as a cmdlet parameter or in a file of application resources: java.naming.factory.initial

    [TopLink info]: 2015.08.31 16:11:31.685 - DatabaseSessionImpl (1827000661) - TopLink, version: Oracle TopLink - 11 g Release 1 (11.1.1.5.0) (Build 110305)

    [TopLink info]: 2015.08.31 16:11:34.147 - DatabaseSessionImpl (1827000661) - dev connection successful

    [TopLink Finest]: 2015.08.31 16:11:34.147 - DatabaseSessionImpl (1827000661) - wire (wire [main, 5, main])-Execute query DataReadQuery()

    [TopLink Finest]: 2015.08.31 16:11:34.163 - DatabaseSessionImpl (1827000661) - wire (wire [main, 5, main])-re-connect to the external connection pool

    [TopLink fine]: 2015.08.31 16:11:34.227 - DatabaseSessionImpl (1827000661) - connection (1635575430) - wire (wire [main, 5, main])-START FORM_METADATA. FORM_LIST_GET (P_USER_ID = >?, P_CHANNEL_NO = >?, P_START_FROM = >?, P_COUNT_TO_RETURN = >?, P_GET_TOTAL_COUNT = >?, P_RESULT_SET = >?, P_TOTAL_COUNT = >?); END;

    link = > [name of user-1, 1, 1, 1000, 1, = > P_RESULT_SET = > P_TOTAL_COUNT]

    [Result:]

    Result of the StoredProcedreCall: null

    Process has finished with exit code 0.


    I'm pretty sure that our problem is with Java code invoking the procedure, but as I said, we were not able to find the right solution yet. Anyone have a pointer as to where we should begin to look for next?

    Thank you in advance,

    Mika Leino

    One of my colleagues managed to find the reason why the procedure does not seem to return anything. For brevity, I've redacted a couple of settings that we were not used to this forum and we do not believe the reason for the perceived behavior. However, as well as the required parameters these have the value NULL. My colleague seems to try initialize parameters without value and after that the query returned a set of data that was expected.

    Our change of code (in Java) was therefore to spend

    procedureCall.addNamedArgumentValue("P_ORDER_BY", OracleTypes.NULL);
    

    TO

    procedureCall.addNamedArgument("P_ORDER_BY");
    

    Now we're getting data from the cursor, as expected, but the second parameter value still eludes us.

  • [BC] Call a stored procedure taking parameters of table

    Hello!

    I currently have a request of the OIC that makes thousands of calls per second stored procedure. The stored procedure runs a business logic that I want my client application to stay informed.  I want to reduce the cat of the database and instead to call the stored procedure from thousands of times per second, call the procedure (for example) once per second, but with values of one mile.

    I used OCIBindArrayOfStruct successfully to perform inserts bulk, where my OCI application executes a () INSERT INTO using the function "iters" and it might be possible to do something similar with the stored procedure, but I want to do something slightly different, because the procedure stored something like this:

    * If a specific condition is set, call a secondary stored procedure

    * If another special condition is set, insert a row into a table of some

    I so wanted to do was to pass a table (or a series of tables) in the stored procedure, then the stored procedure to use optimal methods that are available, such as FORALL, to perform each of the tasks, the more effectively.

    So I thought to create a type, such as a TABLE OF VARCHAR2, or a VARRAY and possessing of the parameters for the stored procedure based on this type, something like:

    create or replace TYPE 'NTT_VARCHAR2' AS TABLE OF VARCHAR2 (32700);

    create or replace FUNCTION bulk_process_values)

    p_error_message OUT NOCOPY VARCHAR2,

    p_module_context_name OUT NOCOPY VARCHAR2,

    p_sql_error OUT NOCOPY VARCHAR2,

    p_count in NUMBERS

    p_non_array_var_1 IN VARCHAR2,

    p_non_array_var_2 IN VARCHAR2,

    p_array_var_1 IN NTT_VARCHAR2,

    p_array_var_2 IN NTT_VARCHAR2,

    p_array_var_3 IN NTT_VARCHAR2

    < etc. for all the variables in table >)

    RETURN NUMBER

    .. .but I am struggling to find an example of how call the procedure "bulk_process_values" stored, and even if I use a TABLE OF VARCHAR2 or a VARRAY as a parameter type.

    I searched the Internet and found this: OIC - how to bind an array to a stored procedure? - and binding table of the structs (OCIBindArrayOfStruct) sample code

    - but they take different approaches and a bit confused (the second example spoke of OTT).

    I think that the first approach is more likely to be the solution I need - but I can't help thinking - it is a bunch of stuff to move if it does not end up significantly improve performance!

    My questions are:

    * Moves to a call-SP-thousands-of-times-per-second to call-SP-fewer-times-but-with-array-parameters sensitive?

    * Should the table or VARRAY, TABLE OF VARCHAR2 parameters or something else?

    * Should I use for my case OTT?

    Samples I found are both very old - and the second example indicators that the optimal approach evolves with the OCI versions - I'm on 11.2, what is the optimal approach these days?

    * < added later > why is there no official useful example?

    Thank you very much

    Much appreciated. https://community.oracle.com/message/4528528#4528528 has actually worked, with VARRAY, with a proof of concept. Now I just need to shake a little and then get my PL/SQL for optimal PC experts. I think I was really discouraged by the lack of official documents, with the Community (Paradise) is the only way to get real results.

    Thank you JJ.

    I intend me to use the binding enforcement of the table and the table and avoid N back and forth, but I do not then get the opportunity to do something clever in the PL/SQL.

    In the PL/SQL, there is no logic occurring - I don't call the same SP tons of times, but then I want to be able to use PL/SQL optimizations such as FORALL, BULK COLLECT, reduce the number of validations and others.  There is a commit after each SP run, because otherwise the nature of demand means that the application hangs occur; However, there is a way (I think) be smart on the part that is likely to deadlock (making a shape on the Bay First, then applying the updates in the order sorted and then failed to get a blocking theoretically), and then FORALL insert for the second part of the stored procedure.

    I guess I may apply the single return, passing a table (to a commit in the SP)-which will reduce back and forth, so gain in performance, but it will not reduce the number of validations that I do - and Oracle said that commits too frequent is not good for performance. I already have code in my framework that does - by making a simple INSERT INTO.

    Good to hear that OTT is not explicitly required - and VARRAY resembles the approach to try first.

  • setting report parameters fails for the report that runs the stored procedure in QMR FDM 2.1.1

    Hello

    Can someone help us please on this issue we have; If a solution is already available somewhere on the forum please link me to it.

    Please see our situation;

    The script below was part of the customization of a colleague to a script of Oracle FDM ("AftFileImport").

    There are no screenshots at this stage that came back to us with a temporary workaround.

    More detailed description:

    We built a custom report of FDM ("FSBValidationErrorsforAllLocations") that accepts two parameters (CatKey, period) and which calls a procedure stored in SQL Server with the same two parameters. FDM SQL statement of the report is:

    RUN FSBValidationErrorsforAllLocations ' ~ time ~', ~ Cat Key ~

    It works through the User Interface.

    When you try to put the two settings by customizing the event Oracle 'AftFileImport'script, the report fails. Below the part of the code in the 'AftFileImport', where we tried to fill values:

    • objReport.mParametersClear
    • objReport.mParametersAddNew "CatKey", RES. PstrCat
    • objReport.mParametersAddNew 'Period', RES. PstrPer

    We must understand why the way above to the definition of the parameters does not work with stored procedures, as seems to be the only documented way Oracle of setting parameters.

    Please let me know if that's enough.


    Thank you in advance.

    Hello

    which is the error when you run the script?

    • objReport.mParametersAddNew "Cat Key", RES. PstrCat

    Try again with the white space as it is how you named your parameter in the report definition, didn t you?

    Also try to use the built like the following examples:

    objRP.mParametersClear
    objRP.mParametersAddNew 'Period', CDate (dtePeriod)
    objRP.mParametersAddNew 'Loc', CLng (lngLocation)
    objRP.mParametersAddNew 'CatKey", CLng (lngCatKey)
    objRP.mParametersAddNew "TargAcct", CStr (strAutoMapAcct)

    Concerning

  • Maximum number of parameters sent to the stored procedure

    I have a web form where I insert data in Oracle. There are at least 20 fields on the form. For the INSERT, I want to use the stored procedure. But in this case for the section of the VALUES in the INSERT statement, I need to send that many - in this case 20 settings. Is it normal for a procedure to receive 20 parameters? If this isn't the case, then should how I follow to do? I know that technically there is only no problem but isn't normal programming or database managementwise? I think it's the basic thing any developer web do it all the time.

    Is it normal for a procedure to receive 20 parameters?

    Sure. It is very good.

    But what is normal programming or database managementwise

    If you need to insert values for 20 fields then normal.

  • Run the statement in a stored procedure with Out parameters and

    Hi all

    I have a stored procedure that calls a select statement. Here it is...

    CREATE OR REPLACE PROCEDURE BLABLA_VIEW_PROCEDURE

    * (BLABLA_KEY IN NUMBER, *)
    XML_OUTPUT ON VARCHAR)
    AS
    BEGIN
    SELECT SYS. XMLTYPE.getStringVal (OBJECT_VALUE) in XML_OUTPUT FROM BLABLA_VIEW WHERE extractValue (OBJECT_VALUE, ' / BLABLA_TYPE/BLABLA_KEY ') = 2876;
    END;

    Is to have both IN and OUT parameters as described above. I am able to compile and run the procedure.

    The problem I want to share with everyone is...
    I want to run the stored procedure together with a single EXEC command.

    I tried different ways using the EXEC command but of no use.

    Could someone help me?
    Thanks in advance.

    Published by: user10763276 on June 3, 2010 15:47

    Please visit the following...

    sudhakar@ORCL>CREATE OR REPLACE PROCEDURE BLABLA_VIEW_PROCEDURE
      2  (BLABLA_KEY IN NUMBER,
      3  XML_OUTPUT OUT VARCHAR)
      4  AS
      5  BEGIN
      6  XML_OUTPUT := BLABLA_KEY || ' and whatever else...';
      7  END;
      8  /
    
    Procedure created.
    
    sudhakar@ORCL>
    sudhakar@ORCL>var XML_OUTPPUT varchar2(100);
    sudhakar@ORCL>exec BLABLA_VIEW_PROCEDURE (9151, :XML_OUTPPUT);
    
    PL/SQL procedure successfully completed.
    
    sudhakar@ORCL>print XML_OUTPPUT;
    
    XML_OUTPPUT
    --------------------------------------------------------------------------------
    9151 and whatever else...
    
    sudhakar@ORCL>
    

    Post tells you...

    var OUTPUT VARCHAR
    exec BLABLA_VIEW_PROCEDURE (9151, :OUTPUT);
    print OUTPUT
    

    VARCHAR is not a valid TYPe to declare. Use VARCHAR2 (nnn) where nnn is a number.
    VR,
    Sudhakar B.

  • How to get the list of parameters of a stored procedure in Oracle?

    I'm calling an Oracle stored procedure and use the OCIBindByPos for each parameter.
    Example:
    /* Do the bind for date, using OCIIOV */
    OCIBindByPos (stmthp, &bindhp2, errhp, 2, (void *)&bvec[0], 
                  sizeof(buf_1[0]), SQLT_STR, 
                  (void *)inddate, (ub2 *)alendate, (ub2 *)rcodedate, 0,
                  (ub4 *)0,  OCI_IOV);
    In this case, its necessary for a list of the parameters of the stored procedure, information such as type and the input/output parameter, etc.

    I can get the parameters of a stored procedure using the DESCRIBE statement.
    Example:
    SQL> DESCRIBE SP_GETCITIES
    PROCEDURE SP_GETCITIES
     Argument Name                  Type          In/Out Default?
     ---------------------- --------------------- ------ --------
     STATE_KEY              VARCHAR2               IN
     FECHA                  DATE                   IN
     RC1                    REF CURSOR             OUT
    
    SQL>
    Is there a better way to get the name, type, input/output for each parameter of an Oracle stored procedure, using the BEAK?

    Best regards.

    Antonio García (Mexico)

    Hi Antonio,.

    Take a look at "Describing metadata schema" in the programmer's Guide. He has this kind of information, which may be enough to get you going in the right direction. The guide is here:

    http://download.Oracle.com/docs/CD/E11882_01/AppDev.112/e10646/oci06des.htm#i446492

    In particular, see the code example in the section "describing the stored procedure.

    Kind regards

    Mark

  • Pass parameters to the box of the HTML form to a stored procedure

    I'm always looking for a solution to my problem of forms. For the record, I don't use Express applications to create my application - I use PL/SQL right. I need to know how to pass parameters from the box to my Web form. I welcome people select one or more checkboxes in a form that calls a remove function to delete the selected records. What I read in Oracle of the "Guide to the developer of database applications - Fundamentals" is not useful to me. If someone could tell me some examples, maybe I could see what I'm doing wrong. Here is what I wrote in "the developer of database applications - fundamentals Guide ':

    All the boxes with the same NAME attribute are a group of checkbox. If none of the boxes in a group is selected, the stored procedure receives a null value for the corresponding parameter.

    If a check box in a group is selected, the stored procedure receives a single parameter of VARCHAR2.

    If more than one check box in a group is enabled, the stored procedure receives a parameter with the type of PL/SQL TABLE OF VARCHAR2. You must declare a type like this, or use a pre-defined as OWA_UTIL. IDENT_ARR. To retrieve the values, use a loop:
    CREATE OR REPLACE PROCEDURE handle_checkboxes ( checkboxes owa_util.ident_arr )
    AS
    BEGIN
    ...
    FOR i IN 1..checkboxes.count
    LOOP
    htp.print('&lt;p&gt;Checkbox value: ' || checkboxes(i));
    END LOOP;
    ...
    END;
    /
    SHOW ERRORS;

    I'm not sure that understand what your question is.

    If your web form has the following defined all with the same name:

    one
    two
    three
    

    You create and save a procedure to manage the sending of a form that contains a parameter with the name of attrib type owa_util.ident_arr for example:

    create or replace procedure handle_form(attrib owa_util.ident_arr) as
      iter number;
    begin
      for iter in attrib.first .. attrib.last loop
        -- do something with attrib(iter)
      end loop;
    end;
    /
    

    Now, the only problem with this Manager (or any other), is that if the user selects any of the boxes, or no value for the parameters expected, the Manager called with parameters missing or with on all of the passed parameters, as well as the call will error.

    To move, you need to provide default values for all parameters passed to your handler such as the settings of ident_arr, but with ident_arr settings, it's hard to do with autonomous procedures. If you place your procedure in a package you can define variables of package-level of the appropriate types that can be used as default values:

    create or replace package my_web as
      empty_arr owa_util.ident_arr;
    
      procedure handle_form(attrib owa_util.ident_arr := empty_arr);
    end my_web;
    /
    create or replace package body my_web as
      procedure handle_form(attrib owa_util.ident_arr := empty_arr) as
        iter number;
      begin
        for iter in attrib.first .. attrib.last loop
          -- do something with attrib(iter)
        end loop;
      end;
    end my_web;
    /
    

    now, when you hit in the situation where the user does not select the checkboxes, the call to handle_form will be no reviewable error on due to missing parameters, and the empty_arr will not have all the elements to iterate over so the loop in the body of the procedure will be fine and you will be able to retrieve each value of the checkbox selected attrib table when you iterate on it.

  • Passing parameters to the query to extract in a stored procedure

    How pass us in a parameter of a query retrieves in a stored procedure?

    Because for example I: -.

    FOR SheikYerbouti in company

    LOOP

    SELECT extract (response,'/ list/hwid [@name = "Tom"] / descendant::node () / address) employee where id = 9506;

    END OF LOOP

    Instead of TOM, I want to pass a variable because I use the stored procedure. The variable is emp_rec.name

    SELECT extract (response,'/ list/hwid [@name = emp_rec.name]/descendant::node()/address) employee where id = 9506; does not work?

    The XPath expression is of type string, concatenate the value:

    extract (answer, "/ List/hwid[@name="' |) emp_rec. Name | ([""] descendant::node () ')

    However, depending on your version of the database, there may be better alternatives, so if you can give us a little more explanation on your requirement, we would be able to offer other options.

  • Stored procedure

    I can't using stored procedures and need advice.

    If I try to run the stored procedure code, I get an error saying that I not provided a required entry, but the LabVIEW looks I'm him.

    But I get this error message.

    The database table is as follows:

    @ID is generated in the process, he is looked at and inserted.

    I don't have the opportunity to get into the database.  It is a stored procedure of writtin by the DB of my COMPUTER service engineer.  The image above has the required fields highlighted in yellow I need to provide when executing my code.

    Can you see where my mistake was made?

    Thanks for the comments.

    Ben

    The procedure does not match the names of parameters with the values that you provide.  You provide only 5 params, but there are 8 in the stored procedure.  In your case, SerialNumber is spent in the ID, PartNumber in SerialNumber, etc..  Add some empty in your cluster params, if they are not mandatory.

Maybe you are looking for