Y at - it a syntax better/more runs to get data to and from stored procedures?

To test the stored procedure call, I created a simple package

create or replace package TEST_PROCEDURES as

procedure Test1 (
   arg1 in number,
   arg2 in number,

   res1 out number,
   res2 out number);

end;

and a page with fields number four (P1_INPUT_2, P1_OUTPUT_1, P1_INPUT_1, P1_OUTPUT_2) and a button excuting the code following PL/SQL:

declare
  arg1 integer;
  arg2 integer;
  res1 integer;
  res2 integer;
begin
  arg1 := :P1_INPUT_1;
  arg2 := :P1_INPUT_2;

  TEST_PROCEDURES.Test1(arg1, arg2,
                        res1, res2);
                    
  APEX_UTIL.SET_SESSION_STATE('P1_OUTPUT_1', res1);
  APEX_UTIL.SET_SESSION_STATE('P1_OUTPUT_2', res2);
end;

It works, but it looks like a lot of unnecessary code to me. Any suggestions?

TryingAPEX wrote:

To test the stored procedure call, I created a simple package

create or replace package TEST_PROCEDURES as

procedure (Test1

in number arg1,

arg2 in number,

RES1 number,

Res2 number);

end;

and a page with fields number four (P1_INPUT_2, P1_OUTPUT_1, P1_INPUT_1, P1_OUTPUT_2) and a button excuting the code following PL/SQL:

declare

whole arg1;

Whole arg2;

integer res1.

whole Res2;

Start

arg1: =: P1_INPUT_1;

Arg2: =: P1_INPUT_2;

TEST_PROCEDURES. Test1 (arg1, arg2,

RES1, res2);

APEX_UTIL. SET_SESSION_STATE ('P1_OUTPUT_1', res1);

APEX_UTIL. SET_SESSION_STATE ('P1_OUTPUT_2', res2);

end;

It works, but it looks like a lot of unnecessary code to me. Any suggestions?

Why would you do that? APEX may be referenced in the same way as all the other bind variables (although it is worth noting that their type is always VARCHAR2, so in this case, it will rely on the implicit conversion):

begin
  test_procedures.test1(:p1_input_1, :p1_input_2, :p1_output_1, :p1_output_2);
end;

For the previous discussion on this topic, see set manually with PL/SQL session state .

Always advanced postal code using the functionality of the syntax highlighted in the editor.

Tags: Database

Similar Questions

  • ORA-06565: cannot run the ROLE VALUE from stored procedures

    Hello!

    I'm trying to call a procedure from a function. Among the statements in the procedure stored is of dbms_session.set_role ('HAVE');

    I get the error "Cannot run a DEFINED ROLE less stored proceduers". I joined the call in an anonymous block above, but the error still exists.

    Any idea will really help me.

    Thank you

    >
    I'm trying to call a procedure from a function. Among the statements in the procedure stored is of dbms_session.set_role ('HAVE');

    I get the error "Cannot run a DEFINED ROLE less stored proceduers". I joined the call in an anonymous block above, but the error still exists.

    Any idea will really help me.
    >
    This will work only if the procedure is defined for the APPELLANT's rights.

    Roles are disabled in named PL/SQL blocks unless you use of the APPELLANT's rights by setting the code with AUTHID CURRENT_USER.

    The Oracle documentation provides a very clear explanation - based restriction is for the NAMED PL/SQL blocks rights DEFINER of this use (the default):
    >
    Roles used in the appointed with rights to define blocks

    All roles are disabled in any PL/SQL block named (stored procedure, function, or trigger) that runs with the rights of the author. Roles are not used to privilege control, and you cannot define roles within the procedure of a DEFINER rights.
    >
    The database Security Guide has the information in the section "operation of the roles in PL/SQL blocks (which, of course, wouldln was necessary if they didn't work.).
    http://docs.Oracle.com/CD/B28359_01/network.111/B28531/authorization.htm#i1007304
    >
    The use of roles in a PL/SQL block depends on if it is an anonymous block, or a block named (stored procedure, function, or trigger), and if it runs with the rights of the author or the rights of the applicant.

    Roles used in the appointed with rights to define blocks
    All roles are disabled in any PL/SQL block named (stored procedure, function, or trigger) that runs with the rights of the author. Roles are not used to privilege control, and you cannot define roles within the procedure of a DEFINER rights.

    The SESSION_ROLES view shows all roles that are currently enabled. If a named PL/SQL block that runs with DEFINER SESSION_ROLES rights issues, the query returns no rows.

    See also:

    Oracle database reference

    Roles used in blocks named with the rights of the plaintiff and anonymous PL/SQL
    Named PL/SQL blocks that run with the rights of the applicant and the anonymous PL/SQL blocks are executed at the end of the privileges granted through active roles. Current roles are used for verification within rights Summoner of privilege the PL/SQL block. You can use dynamic SQL statements to define a role in the session.

  • can I run a file of commands of a stored procedure.

    Y at - it an easy way to call a file beats using a stored procedure oracle under windows.
    Thank you
    Doug

    Depending on the version of your database, you can use JAVA or DBMS_SCHEDULER.

    http://www.Oracle-base.com/articles/8i/ShellCommandsFromPLSQL.php
    http://asktom.Oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:16212348050

    Search this forum and two sites for more examples.

  • I have a copy of spyeraser on my PC. When it runs, it gets an error and told to contact Microsoft. What should I do?

    It was in the middle of the digitization of infected cookies. The comment was: SpyEraser has encountered a problem and needs to close. Please

    Contact MicroSoft.

    Hi RalphXJ,

    1. is the issue limited only with SpyEraser?

    2. what web browser do you use?

    3 did you do changes on the computer before the show?

    4. What is the service pack installed?

    5. What is the number of brand and model of the computer?

    If you use Internet Explorer, then you can follow the article and check.

    You receive an error message "Microsoft Internet Explorer has encountered a problem and needs to close (Pdm.dll)"

    http://support.Microsoft.com/kb/293623

    Let us know the results.

  • Run the oracle stored procedure in CF8

    I'm running a procedure like this.

    < cfstoredproc procedure = "GetAction" datasource = "test_DSN" >
    < cfsqltype cfprocparam dbvarname "actionId" = "CF_SQL_INTEGER" = type = "en" value = "1" >
    < name cfprocresult = resultset 'actions' = '1' >
    < / cfstoredproc >

    and my stored procedure in oracle.

    create or replace function GetAction (actionId IN ACTION.ID%TYPE)

    OPERATION RETURN % ROWTYPE

    IS
    actions

    ACTION % ROWTYPE;

    Start

    Select *.

    IN actions

    Action WHERE ID = actionId.

    RETURN operations;

    GetAction end;

    then I get the error message like:
    ORA-01008: not all variables

    Please help me on this.

    Thanx

    If you want to return a result set (result of a query) of your PL/SQL, you will have to do what Daverms suggested and your function to convert a procedure and a cursor reference to return your result set. Your procedure should be contained in a package so that you can declare a ref cursor "globally" to make it accessible by CF.

    Oh, and don't forget to change your parameter for cfstoredproc procedure to add the name of the package for the proc name.

    Phil

  • How can I run version 3.6.8 and the beta as of separate applications without a crash?

    I ran the beta before, recently I downloaded version 3.6.8 and replaces the beta version. How can I download and run each as separate application without a crash?

    IS S/O

    Thank you, for choosing Mozilla for us to better help you come join us on live chat in 29 minutes if possible otherwise just on the live chat whenever you can.

  • What is better/more quick method to create a table (Oracle 11 g 2 dB)?

    Assuming that there are no statistics for the source tables - tables are deleted and recreated every day

    My paintings have a few million lines

    I'm trying to create a filled with data as quickly as possible via

    1 createtable_name as SELECT * from emp;

    2. create table_name

    Parallel degree 4

    in SELECT * from EMP ;


    I have 1 case I had some time 34 Sec

    In case 2, the table was created in 15 Sec


    In oracle other possibilities to create a much faster with this DEC?


    Or it will be faster when I create a table using create table_name

    (

    column1datatype [NULL |] NOT NULL],

    column2datatype [NULL |] NOT NULL],

    ...

    column_ndatatype [NULL |] NOT NULL]

    );

    or maybe I should use this method

    INSERT /*+ APPEND */ INTO empSELECT * FROM all_objects;

    INSERT /*+ APPEND_VALUES */ INTO emp SELECT * FROM all_objects;

    or it is better to simply creating a table

    and to use the FORALL in BULK IN THE COLLECTION instruction

    combination of Pentecost of the

    INSERT / * + APPEND * / INTO emp;


    I encourage you to test different options - as you did for the first two variants: personally, I think that it is much easier to remember these things if I did the tests myself - instead of trusting in the results of others. IE I don't think that there is something more fast parallelized ETG (perhaps with a clause (*)) additional nologging by using path direct inserts (although that INSERT APPEND select should do the same). I expect the operations in PL/SQL block to be slower.

    (*), but you should consider the consequences of NOLOGGING for your backup strategies + recovery

  • trying to get used to sql * more running and creating a simple procedure

    Hello all;

    I'm getting used to sql * more after using for a while using pl/sql developer.

    I am trying to create a simple procedure and run it. See my procedure below
    create or replace procedure test(t in varchar2(200), limit in number(30))
    begin
    select tbl_report.id from tbl_report where tbl_report.id like '|| t ||%' and rownum <= limit;
    end test;
    and then I type in run hr.test ("J", 10); to run this and then press ENTER, and it does nothing. How can I run and create a simple procedure in sql * more

    Hello

    In addition to all the good points, others have done:

    When you issue a SELECT statement in SQL * Plus (or any other front end) two things happen:
    (1) a result set, containing the results of your query, is produced, and
    (2) this result set is displayed.
    Given that these two things are always done together, it is easy to forget that they are two different things.
    In PL/SQL, you must explicitly do something to catch the result set, and you must explicitly do something else to view it (if you want to display it).

    A simple way to get the result set is to use a cursor FOR loop, to extract a line at a time and run code with this line in a record variable (called the country in the example below).
    View the results is to call dbms_output.put_line.

    Here is an example:

    CREATE OR REPLACE PROCEDURE     test
    (       t       IN      VARCHAR2
    ,     lmt      IN     NUMBER          -- LIMIT is an Oracle keyword; best not to use it as a variable name
    )
    IS
    BEGIN
        FOR  country  IN ( SELECT  country_name
                          FROM    hr.countries
                     WHERE   country_name     LIKE t || '%'
                     AND     ROWNUM          <= lmt
                   )
        LOOP
            dbms_output.put_line (  country.country_name
                        || ' = country_name'
                        );
        END LOOP;
    END test;
    /
    SHOW ERRORS
    

    You can use variables, such as t and lmt, in the query without using dynamic SQL, as long as the variables do not have the same names as the columns in the table. In this case, t and lmt are good names; country_name or region_id wouldn't. (In fact, t is a reputable insofar as it cannot be confused with a column in the table of the country. T is not a good reputation in the sense that it does not give much information about what contains the variable, or how it is used. Why not call the variable target_name or name_a_trouver?

    You can run the SQL procedure * more like this:

    SET     SERVEROUTPUT     ON
    
    EXEC  test ('I', 2);
    

    If you issue the SET SERVEROUTPUT ON command, then you will not see the output of dbms_output. You must only issue the command SET SERVEROUTPUT ON once per session, but nothing bad happens if you do it more than once.

    When I ran the procedure as stated above, I got this output:

    Israel = country_name
    India = country_name
    

    Notice that "The Italy" does not appear, because lmt has 2.

    Do not create your own procedures, tables or other objects in the HR schema, or among all the other patterns created by Oracle. Create your own schema and create procedures and other objects in it.

  • What is better/more-fast: indexes all first or inserts first?

    I created a couple of TABLEs.

    Now I have todo, more than two tasks:

    1.) Insert about 50000 to 100000 records in each TABLE
    2.) CREATE index for these tables

    What is better/more-fast:

    Do not perform on the first task 1. or a task 2?

    Peter

    If it is possible to load the data in ascending order (linked to index), consider this note of documentation of CREATE INDEX:

    KIND | NOSORT
    By default, Oracle database sorts the index in ascending order, when it creates the index. You can specify NOSORT to indicate to the database that the lines are already stored in the database in ascending order, so that the Oracle database is not necessary to sort the rows when you create the index. If the indexed column lines are not stored in ascending order, then the database returns an error. For most saves space and time to sort, use the following clause immediately after the initial loading of rows in a table. If you specify any of these keywords, then SORT is the default value.

  • I am running Windows Server 2003 R2 and am having a problem with a user profile.

    I'm running windows server 2003 r2 and am having a problem with a user profile, we have a logon.bat file that runs to map drives, but also call a logon.html file, that user gets the logon.html appear, but IE blocked then this happens only for a single user, others are ok. Any ideas please?

    original title: profile of Win 7 issue

    Hello

    Your Windows 2003 R2 server question is more complex than what is generally answered in the Microsoft Answers forums. It is better suited for the IT Pro TechNet public. Please post your question in the Microsoft Technet Forum. You can follow the link to your question:

    http://social.technet.Microsoft.com/forums/en/category/WindowsServer/

    Hope the information is useful.

  • What is the difference between FF and FF beta for android tablets? My story and Add - it will transfer if I go to the beta version of Android?

    In addition, Pinterest falls when I loaded from history of the FF beta. Thank you.

    Firefox Beta is a version of Firefox for Android applicationdevelopment. Beta gets more frequent updates. They are distinct from the apps because of the way Android work they can't share data directly. You will need to create a Firefox Sync account to move your bookmarks, history and passwords on the Firefox application.

  • I am running Firefox 16.0.2 and you want to import the Favorites from IE 8... go through the process given to Firefox... but it only partially matter 'Favorites '.

    I am running Firefox 16.0.2 and IE 8 on my Windows 7 computer... I try to import the IE 8 'Favorites' in Firefox... I go through the procedure that Firefox has provided... but it is important ONLY part of my IE Favorites... it's only about 7 records with her subfolders where my save bookmarks are... I have a lot more than these folders (bookmarks)... any help?

    Hello

    You can try to export bookmarks to HTML in Internet Explorer, and then import the HTML file in Firefox by bookmarks (Alt + B) > show all bookmarks > import and export > import bookmarks in HTML....

    Import HTML

    Import bookmarks

    Import of

  • Cannot install itunes for windows - error: Apple Application Support is required to run Itunes Helper. Uninstall and reinstall (as I did twice)

    Cannot install itunes for windows - error: Apple Application Support is required to run Itunes Helper. Uninstall and reinstall (as I did twice)

    For general advice, see troubleshooting problems with iTunes for Windows updates.

    The steps described in the second case are a guide to remove everything related to iTunes and then rebuild what is often a good starting point, unless the symptoms indicate a more specific approach.

    Review the other boxes and other support documents list to the bottom of the page, in case one of them applies.

    More information area has direct links with the current and recent buildings if you have problems to download, must revert to an older version or want to try the version of iTunes for Windows (64-bit-for old video cards) as a workaround for problems with installation or operation, or compatibility with QuickTime software or a third party.

    Backups of your library and device should be affected by these measures but there are links to backup and recovery advice there.

    TT2

  • VBAI running on computers of 32 and 64 bit

    I have a standard VBAI routine developed on a 32 - bit computer, using a lot of files .vi and running on multiple hosts.  To date, all VBAI instances were on 32-bit computers, without any problem, for example, I just copy the VBAI routine to the new machine and run it.

    But the last instance is a 64-bit server, and while VBAI installs and runs locally, he moved to the folder "...\Program Files (x 86)-...» "that throws all my calls file .vi.  I tried to put the .vi files in the folder maintinaing «...\Program Files\...» "the structure folders and it seemed to work, but it wasn't all parameters, and I couldn't change all the steps...

    So here's my question: is there a way to make my VBAI routine standard running on the 64-bit computer, or do I have to load LabView and recompile the routine?

    Thank you

    Eric

    When you say that you can not change the steps, what do you mean? You get an error on the VI is broken when you change a step execute a VBAI LabVIEW VI? I would recommend that you follow the instructions to create your VI in a LLB built for deployment. You will find these instructions when you change the step run a LabVIEW VI, and you go to help > context display help. There will be a link to 'Saving VI for Distribution' in the FAQ tab, which will guide you in how to do a Bachelor's degree in LAW with all the dependencies that are required in a LAW degree who can travel more easily with your inspection when you move systems.

    I also recommend that you include all in the project of LV, the your source required screws through the various stages of LV run in your VBAI inspection, and that you will have a unique LAW degree which is easy to carry. I also recommend that you put this LLB single in a place that will not change when you move from a (64 bit) (32 bit) to another system, so do put it not in your c:\Program Files (x 86). On the RT, we expect in C:\User VIs\, so you can put your LLB at the same location on your windows machine, and then if ever you move RT, it will be very easy to have found LLB.

    It is important to have your source screw in one place (as well as the LV that allows you to create your LLB) and LLB/source distribution generated in another location (e.g. c:\User VIs\) and when you want to change, change your source screws and use the same project for you rebuild LLB VBAI will use. You do not want to edit your distribution of LLB\source built and accidentally put screws in there, vi.lib or good things will break.

    Hope this helps,

    Brad

  • Is it possible to find in which case is run in LabVIEW VI programmatically and display it...

    Is it possible to find in which case is run in LabVIEW VI programmatically and display it...

    I have published earlier the plugin Quick Drop here - https://decibel.ni.com/content/docs/DOC-38903#comment-36562 there is more information on how install or use it.

Maybe you are looking for

  • iTunes store stops working when I click on the store

    Hello, I am continuing windows 7 64 bit and I've just updated to 12.5.1.21 and my laptop says itunes has stopped working and I have to close the program after I click on the store. I can see my music and play but can't go to the store. Under details,

  • Repeat the Scans with DAQmx read/write

    Hello: I use DAQmx vi to generate signals on channels ao0/1 a reading of the signals of the channels ai0/1 a card NI USB DAQ of 6251. I do this by using the read and write of vi and a trigger vi. This vi will run successfully for a single analysis. N

  • solution to the error message on canon 052 printhead is poorly installed

    can someone the solution for the 052 print head error message is incorrect installed correct print head

  • Problem with an old Dell desktop computer

    Hey guys :) first post here! Happy to be part of the community! My father has so some of these old Dell desktops at work that were purchased second-hand and some of them don't work at all. I was asked to provide assistance and we managed to get most

  • Public interface on VPN 3000

    Hello It is as sure to fix the public interface on a VPN 3000 Concentrator on the internet? Or should there be a firewall in front. I understand that the public interface is "hardcoded" and only open ports you'd pass firewall anyway, but I just wante