Appeal procedure in another procedure using the Out parameter slider - lesson

Hello

I am new to Oracle development so first I wonder if it is a good place with a simple way of the of on how to create stored procedures?  I'm looking for the most part at this stage for a quick read.

Second, currently have hacked and slashed my way into getting one built.  It has 3 parameters and an output parameter sys_refcursor.  This procedure works.

I want to have another created procedure that will call the above procedure and loop through each row in the setting out and write to a file.  Can someone point me to an example of this by any chance?

Thanks for the help.

Hello

e28d78d3-c6c6-4BCE-b14f-0f6bf26fa17c wrote:

Thanks for the reply.

Here's what I have, but I'm getting many errors.  When I seem to fix one that I get a new one. Kind of like what it show me all questions vs one question at a time.  I never know if I create another error of my attempts at fixing what, in my view, could be the problem.  In any case, something to get used to.

When you do any type of programming, take baby steps.  Write less code as possible, test what you wrote ' worm and, if it contains errors, correct them and test again.

The PL/SQL compiler tries to show all errors, but often it is impossible to say what is a separate mistake, and which is a consequence of a previous error.  For example, the DECLARE statements in your code are perfectly valid PL/SQL statements, but they are the mistakes in the sense that they are not what you think, and you may not use them.  PL/SQL does not know that (I don't really know that, either, but I'm willing to guess in this case).  The works of compiler on the explanation that you really wanted to say SAID, until what it becomes obvious, maybe several lines later, that something makes no sense, but at this time, there is no way he could say that the undesirable DECLARE was the cause.

So here is where I am stuck currently.  What I want should first, run the stored procedure and I think I do as you suggest.  Which returns data in the output parameter, which is of type sys_refcursor.  I think I would need to loop through each element that cursor and output to the file using the dbms_output you reference and like I did below.  This should be it.  Sounds simple enough, but it's where some of the basics for me.

For example, by creating the procedure some examples have the name of the procedure and then some "AS", "IS".  When use the beginning and the end and when not I need?

There is no difference betwwen

CREATE PROCEDURE... AS and

CREATE PROCEDURE... Use IS the one you prefer.  You must always one or the other, however.

PL/SQL is written in blocks.  The basic structure of a block is

DECLARE - optional, sometimes involved

...

BEGIN

...

-Optional EXCEPTION; forget it for now

...

END;

Almost all of the PL/SQL code is part of a block.  In fact, you could argue that anything not in a block isn't really PL/SQL.  (For example, CREATE PROCEDURE is really an SQL, PL/SQL not, it indicates the SQL that some PL/SQL compiler is coming.)

You should always BEGIN and END keywords in a PL/SQL block; None is never optional.

I think I'm doing the for loop correctly but I get an error on the portion of loop-end.  It is a part of these simple things that become I think that.

That's what I have:

CREATE OR REPLACE PROCEDURE APPS.boact_report_3

AS

DECLARE v_cur SYS_REFCURSOR;

DECLARE v_file_out UTL_FILE.file_type;

BEGIN

I said earlier, DECLARED may be implied.  It's one of those places if there is nothing after CREATE PROCEDURE... IS and before STARTING, it is supposed to be a statement.

You can have as many statements (0, 1, 2 or more) that you want in this section of the statement.  The semicolon at the end of each of them is all the separation you need each other; you don't need any keyword as STATED.

Open the v_cur for

bo_report (p_sv_id, p_start_date, p_end_date, out v_cur);  -stored procedure that girls v_cur witch is a sys_refcursor parameter.  It works

END;

BEGIN

Don't forget, how to call a procedure is

bo_report (x, y, z);

not

bo_report (x, y, z OUT);

The key words are only necessary (and only used) in the declaration of a procedure, not in his appeal.  When you create a procedure, you decide if each argument is going to be an argument IN, an OUT argument, or IN OUT argument, and you tell the compiler that you decide.  When you call a procedure, you have no choice; each argument is IN, OUT or IN OUT has already been decided, and suffice to say compiling what are the variables (or expressions) that you use to play these predetermined roles.

Dbms_output.put_line ('Date: ');

v_file_out: =.

UTL_FILE.fopen (' / public/scripts/smorau02 ', 'w_act.csv', 'W');

FOR x IN v_cur

LOOP

() UTL_FILE.put_line

v_file_out,

x.cl_num | ','

|| x.wa_id | ','

|| x.Description | ','

|| x.a_date | ','

|| x.a_by | ','

|| x.v_Name | ','

|| x.SITE_NAME | ','

|| x.stage | ','

|| x.in_queue);

END LOOP;

UTL_FILE.fclose (v_file_out);

END;

Thanks again for the help.

You have not to send the code to bo_report, so I can't run the procedure.  I do not notice any obvious mistakes immediately superior.

Tags: Database

Similar Questions

  • the size of the out parameter in the procedure

    Hi all:

    I have a procedure in a pl/sql package like this:
    create or replace procedure MyProc (PRM_STR in VHARCHAR2, PRM_OUTSTR OUT VARCHAR2) is
    V_TEST VARCHAR2 (100)
    Start
    +...+
    V_STR: = SUBSTR (PRM_STR, 22, 31);
    V_TEST: = TRIM (V_STR);
    PRM_OUTSTR: = V_TEST;
    EXCEPTION
    WHILE OTHERS THEN
    +....+
    myproc end;

    When I run it, it always gives me an exception: ORA-06502: PL/SQL: digital or value error: character string buffer too small.
    Then I debug him:
    V_TEST: = TRIM (V_STR)
    is OK.
    While PRM_OUTSTR: = V_TEST, it throws this exception.

    I was confused, the out parameter in the procedure has a size? How can I set it?

    Please help me!
    Thank you very much!

    You must declare the size of the variable you use in the call to the procedure to be big enough.

    The output parameter itself may not be declared with a size:

    for example

    Your appeal should be something like the following:

    declare
    v_prmstr varchar2(4000)  :=  'Your input value';
    v_prmoutstr varchar2(4000);
    begin
    myproc(v_prmstr,v_prmoutstr) ;
    end;
    

    v_prmoutstr must be reported to be large enough to contain the value returned by the parameter
    PRM_OUTSTR

    added example variable
    Published by: Keith Jamieson on August 11, 2011 13:32

  • Production number: another auditor using the same SETTINGS? URGENT!

    Hi guys,.

    I have advanced and added another application in my config console, I then changed the name and then press to save the Configuration, when then I started the Repository Wizard steps.

    However, it turns out, another application was not necessary (false alarms) so I removed it completely.  I never actually created the repository.

    Now, I'm having problems with my current application.

    I get an error that says "there is another auditor using the same end points" in the event log.

    I have a feeling that this is my problem.  so when I browse to the UI via the URL, is there no current application, even though it says its up and runing (according to the Green icons) in the config console.

    I guess that's recognizing the app that I removed in the backend?  Anyone has any ideas how to solve this problem?

    It is an Oracle database if that helps any.

    Thank you very much!

    One potential gotcha here is that if you click on "Save Configuration" after the removal of the application (according to the context menu when you remove an application) then the application config might still be in the C:\Oracle\Middleware\EPMSystem11R1\products\DataRelationshipManagement\server\config\drm-config.xml for your system.

    A way to test this possibility in the user interface would be to close the config DRM console and then open again. If your application is displayed again in the console config DRM after reopening, then it's probably because you save the configuration. In this case remove the app again, and then click "Save Configuration".

    If not well then could you let us have the full error you are seeing so we can see whence the error please we have only an excerpt of all error to work on time

    Concerning

    Craig

  • My computer crashed and after the purchase of another, I used the Migration Wizard to copy all the files to the new computer.  Everything was going well until I tried to launch LR6.  It was two weeks ago and a search for many pages of the Adobe Web site. 

    My computer crashed and after the purchase of another, I used the Migration Wizard to copy all the files to the new computer.  Everything was going well until I tried to launch LR6.  It was two weeks ago and a search for many pages of the Adobe Web site.  I think I've exhausted all the remedies listed without success codes error A12E5 to questions cloud creative, Manager of Application and error 1: Configuration problems.  I'm ready to reformat my computer and try again with Time Machine.  Help would be greatly appreciated before I waste more time on this task. Any further suggestions?

    Migration of Mac with Time Machine WILL NOT WORK with the Adobe program activations due to hidden registration files

    Sign out of your account... Uninstall... to run vacuuming...

    -non-Cloud programs, to disable the service before uninstalling

    -http://helpx.adobe.com/creative-cloud/help/install-apps.html (and uninstall)

    -using the vacuuming after uninstalling and before reinstalling is often necessary

    -https://helpx.adobe.com/creative-suite/kb/cs5-cleaner-tool-installation-problems.html

    -Restart your computer... Sign in to your account... Reinstall

  • How can I load updates from pilot to another pc using the ethernet cable?

    How can I load updates from pilot to another pc using the ethernet cable?

    You would be better to use a flashdrive rather than an Ethernet cable. To connect using an Ethernet cable you need a crossover cable and then configure the network cards.

    I hope this helps.

  • Whenever I start my PC, a message appears, says another user using the same IP address. Is this a problem

    Whenever I start my PC, a message appears, says another user using the same IP address.

    Is this a problem

    Yes.  One or both may not work properly.  If you use static IP ADDRESS a simple reboot of all devices should correct this.

  • I have a document composed of separate PDF files that reside in a folder and are related to each other through hyperlinks. Each pdf file is set to open with bookmarks displayed, however if I have a link to a PDF file to another and use the button "Previou

    I have a document composed of separate PDF files that reside in a folder and are related to each other through hyperlinks. Each pdf file is configurΘ for dΘmarrer with bookmarks displayed, however if I have a link to one PDF file to another and use the "back" button to return to my starting point bookmarks are replaced by "vignette". Is there anyway to prevent this?

    Hi Mike,.

    While the implementation of the links, if you choose to open the file in a new window then you will not experience this issue, then you can simply switch to the file view and previous bookmark will remain as it is.

    Is that what helps with your query?

    Kind regards
    Rahul

  • Using the QUERY parameter in exp/expdp

    Hi, I've faced a nite last question.
    IM currently using Oracle 10 g (10.2.0.4) OS - MS Windows Server 2003

    I want a dump of tables to export multiple schemas. say (acb.m1, pqr.b2, xyz.b1)

    Each table has a minimum lines of 2,000,000,

    And I want to just the initials 10 rows in each table of export

    Is it possible that I can do this...

    Please answer.
    Thanks in advance

    Export tables in multiple schemas is not supported in Data Pump until 11.1.0.7. So if you're on 10g, you will need to run multiple commands expdp. For only 10 lines of each table, use the query parameter

    Query = "where rownum"<>

    This will apply to all the tables you export.

    I hope this helps.

    Dean

    Published by: Dean WINS January 30, 2012 08:42

  • Get the CGI env variables in a database procedure using the new listener to the APEX

    I already posted this question in the earpiece of the Apex forum and still no response after a week. The original post is here:
    Download environmental CGI of APEX listener within the procedure of database

    So please forgive me for posting in this forum as well, but there is much more activity here.

    I would like to know how I can get the CGI environment to the listener of the APEX. For example, if I want to write a procedure that inserts into a table, the client web request originating IP address, how do it?

    I am familiar with the Oracle Http Server and mod_plsql, and I know how to call OWA_UTIL. GET_CGI_ENV to get this kind of information. How can I do this by using the earpiece of the APEX?

    In particular, how to do that when you call a custom (not in a workspace Apex) procedure? When I try now, I get an error owa_util. The cgi env seems to be empty or not initiated (owa.num_cgi_vars is null or zero).

    Specific settings:
    I have a web server running the last JDK, Glassfish and 1.1.4 Apex listener. It connects to another server running the last database 11.2. Apex is installed and running, but I'm not really developing a traditional Apex application in a workspace. I use it mainly as you would use mod_plsql. In other words, I have packages of pl/sql custom which are called directly via a URL. Applications must be sent by the listener to the database and DB executes the procedure and returns output using htp.p to send the text to the browser. And it works very well for this purpose. But if I want to call GET_CGI_ENV to get information such as IP address, the browser making the request, etc. I can't get with the OWA packages.

    Anyone can shed some light on this? If the listener of the Apex is not designed to do this, is it some kind of workaround that I can use to transfer such information to the database for each request?

    Hi Adam,.

    APEX is located on the top of the Toolbox for OWA. There is no appeal of the special procedure to be implemented.

    Kind regards
    Christian

  • Reference for old 'procedures using IN OUT' wire

    Hello...

    Already this issue raised in this case.

    Due to a lot of confusion and apply different things... so, I'm starting a new thread here.

    This is NOT a duplicate thread. the two goal is different.    


    MY old thread: https://forums.Oracle.com/message/11133790#11133790

    > > MY emp table details > >

    SQL > desc emp;

    Name                                      Null?    Type

    ----------------------------------------- -------- ----------------------------

    EID                                                   NUMBER

    ENAME VARCHAR2 (15)

    VARCHAR2 (15) EQUAL

    NUMBER OF ESALARY

    ECITY VARCHAR2 (15)

    EPERK                                               NUMBER

    NUMBER OF ECONTACT_NO


    SQL > select * from emp;

    ENAME EID EQUAL ECITY ESALARY EPERK ECONTACT_NO

    ---------  ---------------  ------------  - ---------- ----------  ------------       -----------

    1 sona mba 10000 mumbai 9994488410

    Maya 2 mca 15000 calcutta 9994716872

    > > Program update salary using the procedure parameter and it's > >


    1 CREATE or REPLACE procedure emp_details

    2 (id IN emp.eid%type,

    pay 3 IN OUT emp.esalary%type) IS

    number of tmp_sal 4;

    5 BEGIN

    6. Select esalary in the tmp_sal of the emp where eid = id;

    7 if tmp_sal between 10000 and 20000 THEN

    8 salary: = tmp_sal * 1.2;

    9 tmp_sal between 20001 and 29999 ElseIf THEN

    10 salary: = tmp_sal * 1.8;

    11 ElseIf tmp_sal > 30000 then

    salary 12: = tmp_sal * 2.0;

    13 END IF;

    14 END IF;

    15 END IF;

    16 * END;

    SQL > /.

    Created procedure.

    > > what I really expect > >

    Already the table emp Esalary column ;

    If I run the procedure, it should be to update all records in PEM according to my State.

    "Already, I did same procedure with cursors. but now my requirement must be done with the "PROCEDURE arguments and Committee.


    This is what I got after the exit is not my GOAL > >

    ------------------------------------------------------------------------------

    1 DECLARE

    2 number of l_empno: = 1;

    3 number of l_sal: = 10000;

    4 start

    5 emp_details (l_empno, l_sal);

    6 DBMS_OUTPUT. Put_line(l_empno || l_sal);

    7 * END;

    SQL > /.

    112000 (bad output)


    PL/SQL procedure successfully completed.

    My questions are: If I go from '1' esalary sona record will be updated.  [only with procedure]  

    -C' is what I expect...

    Please note: if I finished successfully, I can even apply logic on column eperk

    Thanks in advance!

    Hello

    8f953842-815B-4D8C-833d-f2a3dd51e602 wrote:

    Hello...

    Already this issue raised in this case.

    Due to a lot of confusion and apply different things... so, I'm starting a new thread here.

    This is NOT a duplicate thread. the two goal is different.   


    MY old thread: https://forums.Oracle.com/message/11133790#11133790

    > MY emp table details >

    SQL > desc emp;

    Name                                      Null?    Type

    ----------------------------------------- -------- ----------------------------

    EID                                                  NUMBER

    ENAME VARCHAR2 (15)

    VARCHAR2 (15) EQUAL

    NUMBER OF ESALARY

    ECITY VARCHAR2 (15)

    EPERK                                              NUMBER

    NUMBER OF ECONTACT_NO

    SQL > select * from emp;

    ENAME EID EQUAL ECITY ESALARY EPERK ECONTACT_NO

    ---------  ---------------  ------------  - ---------- ----------  ------------      -----------

    1 sona mba 10000 mumbai 9994488410

    Maya 2 mca 15000 calcutta 9994716872

    Whenever you have a question, post a complete test script so that people who want to help you can recreate the problem and test their ideas. Include CREATE TABLE and INSERT statements for all necessary tables as well as outcomes from these data. In the case of a DML (UPDATE), for example, the sample data should show what looks like the tables before the DML, and the results will be the content of the or the tables changed after the DML. Explain, using specific examples, how you get these results from these data. Always say what version of Oracle you are using (for example, 11.2.0.2.0). See the FAQ forum: https://forums.oracle.com/message/9362002

    > Program update salary using the procedure parameter and it's >

    1 CREATE or REPLACE procedure emp_details

    2 (id IN emp.eid%type,

    pay 3 IN OUT emp.esalary%type) IS

    number of tmp_sal 4;

    5 BEGIN

    6. Select esalary in the tmp_sal of the emp where eid = id;

    7 if tmp_sal between 10000 and 20000 THEN

    8 salary: = tmp_sal * 1.2;

    9 tmp_sal between 20001 and 29999 ElseIf THEN

    10 salary: = tmp_sal * 1.8;

    11 ElseIf tmp_sal > 30000 then

    salary 12: = tmp_sal * 2.0;

    13 END IF;

    14 END IF;

    15 END IF;

    16 * END;

    SQL > /.

    Created procedure.

    > what I really expect >

    Already the table emp Esalary column ;

    If I run the procedure, it should be to update all records in PEM according to my State.

    You seem to be contradicting yourself. Do you want all lines updated, or you only want to update the lines meet him your condition 'eid = id "? If you want to update the table, use an UPDATE statement.

    "Already, I did same procedure with cursors. but now my requirement must be done with the "PROCEDURE arguments and Committee.

    This is what I got after the exit is not my GOAL >

    ------------------------------------------------------------------------------

    1 DECLARE

    2 number of l_empno: = 1;

    3 number of l_sal: = 10000;

    4 start

    5 emp_details (l_empno, l_sal);

    6 DBMS_OUTPUT. Put_line(l_empno || l_sal);

    7 * END;

    SQL > /.

    112000 (bad output)

    What is bad about it? What is the result you want to see?  Explain how you get this result.

    PL/SQL procedure successfully completed.

    My questions are: if I pass '1' esalary sona record will be updated.  [only with procedure]

    -C' is what I expect...

    Please note: if I finished successfully, I can even apply logic on column eperk

    Thanks in advance!

    If you really want to update the value in the table, you can do it like this:

    CREATE or REPLACE procedure emp_details

    (id IN emp.eid%TYPE

    ) IS

    BEGIN

    UPDATE emp

    SET esalary = esalary * CASE

    WHEN esalary<=>

    THEN 1.2

    WHEN esalary<=>

    THEN 1.8

    OF OTHER 2.0

    END

    WHERE eid = id

    AND esalary > = 10000;

    END;

    /

    If you want the procedure to switch to return the new value of the column esalary eid is unique, you can add 2 lines to the above procedure:

    CREATE or REPLACE procedure Emp_details

    (id IN emp.eid%TYPE

    salary OF THE emp.esalary%type--1ere line added

    ) IS

    BEGIN

    UPDATE emp

    SET esalary = esalary * CASE

    WHEN esalary<=>

    THEN 1.2

    WHEN esalary<=>

    THEN 1.8

    OF OTHER 2.0

    END

    WHERE eid = id

    AND esalary > = 10000

    RETURN esalary INTO wages;      -2nd line added

    END;

    /

  • Another computor uses the same IP that myself, what do I do?

    Compuyor another uses the same IP address as me, what can I do to solve the problem?

    Hi Sam,

    Please see the thread below for a possible solution: http://answers.microsoft.com/en-us/windows/forum/windows_vista-networking/another-computer-on-my-network-has-the-same-ip/6ecaf994-1748-e011-9575-d8d385dcbb12.

    For what it's worth, in this case only really with local networks.  Your internet connection TCP/IP address is unique and there is no way he can go to another - it is not possible.

    I hope this helps.

    Good luck!

  • OfficeJet 6500 Wireless: Win 10 - Solution Center - scan not performed as another program using the imaging device

    I upgraded to 10 Windows on a laptop ASUS, then updated the software for a HP Officejet 6500 E709n Series printer HP solutions Center.

    I can print successfully to the printer but when I open the solution Center and then try to scan an image or a Document, I get the following error "Scan cannot be performed because another program or computer using the networked imaging device.

    Extended error information is 8, [(0.18,-2147467259)]

    When I look in device under imaging devices Manager, two devices are displayed ASUS USB2.0 WebCam (1) and (2) Officejet 6500 E709n.

    It would be much appreciated if someone could help me solve this problem.

    Hi midnight-anwrs,.

    Thanks for getting back to me.

    I looked into your link "Printer problems after upgrade to Windows 10" and 6 "Scan with a scanning application" stage, I found the solution.

    I downloaded the "HP Scan and capture App" and can now easily scan photos and documents.

    Thanks for your help.

    Much appreciated,

    KenRabs

  • Whenever I click on my camera it will say cannot use it another application uses the camera

    Separated from this thread.

    Hello, hope you can help me question w / this. Whenever I click on my camera it will say: he can't use another application is the use of the camera, do not know what to close.hope app you can save your time to help me.

    Hi Jesus Mahjoub,

    1. What is the brand and the serial number and model of the computer?

    2. Problems with the use of the built-in webcam?

    3. What is the exact full error message?

    If you have the camera connected, then I suggest disconnect you the device picture and then try to open the camera app restart the computer twice and check if it helps. This could be due to lack of drivers or camera app problem. I suggest that you install the latest Windows updates including the optional updates and check if it makes a difference. You can check this link to learn more about the Windows updates: Windows Update: frequently asked questions.

    Also try to run the Troubleshooter of Apps. This tool can automatically identify and fix problems with applications and store.

    Let us know if these measures made a difference in camera application performance.

  • How can I transfer Favorites from one computer to another without using the Sync feature?

    I used the Belkin transfer cable that has not transferred the bookmarks. I can't find them on my C drive. I would like to manually transfer using a USB but impossible without locating the file with bookmarks.

    Firefox and his favorites are on the original computer. Right now I cannot use the synchronization function, but must manually transfer the bookmarks. How to recognize in the files and copy on an external device and then transfer

    See also:

    You can find the profile folder of Firefox via this button on the troubleshooting information page:

    See also:

  • UDP COMMUNICATION FROM ONE SYSTEM TO ANOTHER BY USING THE TYPE CAST

    Dear reader,

    I tried a simple communication udp from one system to the other. I have conditions of that does not change the receiver vi It is set. I'm attaching my vi sending and receiving the part. Please go through it and give me suggestion on how to code the part shipment without changing the receiving party and successffully communicating by udp.

    I am just a starter in LabVIEW.I believe your suggestions of ideas will be very useful to move forward.

    Concerning

    Srinath, R

    One thing you should know is that cast a DBL (or table DBL) requires eight bytes (or an integer multiple of 8).

    The sender must send 8 bytes, which is easier to do by remodeling (padding) of the Boolean array with 8 element (using the table to reshape) prior to cast to a string.

    Here is the code that works. You can easily implement it your original code.

Maybe you are looking for