Procedure do not return my exception

Hello

I try to my test procedure, but it is not returning my exception.

My procedure:

Header 1

create or replace PACKAGE BODY PKG_UNIDADE_EMP_ODS

AS

PROCEDURE BUSCAR_UNIDADES)

VI_COD_EMPRESA IN UNIDADE.ID_INSTITUICAO%TYPE,

VO_DADOSUNIDADE ON TP_EMPREGABILIDADE_UNI_ODS. TC_DADOSUNIDADE,

VO_CDERROR NUMBER,

VO_DSERROR OUT VARCHAR2

)

IS

BEGIN

VO_CDERROR: = 0;

VO_DSERROR: = 'success ';

IF (VI_COD_EMPRESA IS NOT NULL AND LENGTH (VI_COD_EMPRESA) > 1) THEN

OPEN FOR VO_DADOSUNIDADE

SELECT

A SEPARATE. CD_UNIDADE AS CD_UNIDADE,

UNITED NATIONS. NM_UNIDADE AS NM_UNIDADE,

UNITED NATIONS. DS_UNIDADE AS DS_UNIDADE,

UNITED NATIONS. UNIDADE_PORTAL AS UNIDADE_PORTAL

OF UNIDADE UN

INNER JOIN INSTITUIÇÃO INS ON (UN.ID_INSTITUICAO = INS.ID_INSTITUICAO)

WHERE UN.ID_INSTITUICAO = DECODE (VI_COD_EMPRESA, NULL, UN.ID_INSTITUICAO), VI_COD_EMPRESA;

END IF;

IF (VI_COD_EMPRESA IS NOTHING) THEN

OPEN FOR VO_DADOSUNIDADE

SELECT

A SEPARATE. CD_UNIDADE AS CD_UNIDADE,

UNITED NATIONS. NM_UNIDADE AS NM_UNIDADE,

UNITED NATIONS. DS_UNIDADE AS DS_UNIDADE,

UNITED NATIONS. UNIDADE_PORTAL AS UNIDADE_PORTAL

OF UNIDADE UNITED NATIONS;

END IF;

EXCEPTION

WHEN NO_DATA_FOUND THEN

VO_CDERROR: = 2;

VO_DSERROR: = "no record not found";

WHILE OTHERS THEN

VO_CDERROR: = 999;

VO_DSERROR: = 'unknown error ' | SQLERRM;

END BUSCAR_UNIDADES;

END PKG_UNIDADE_EMP_ODS;

But when I put the parameter that do not exist in the database, do not return my exception:

VO_CDERRO = 2

VO_DSERRO = No records were found

Can someone help me

Opening of a ref cursor will never give an exception no_data_found. If you want to know that there is no data in the ref cursor, you will need to pick up. But if you look in the procedure as the row won't be available for the application. If you need to know if the cursor has all the data without pick up you will need to do something like this:

create or replace PACKAGE BODY PKG_UNIDADE_EMP_ODS

AS

PROCEDURE BUSCAR_UNIDADES)

VI_COD_EMPRESA IN UNIDADE.ID_INSTITUICAO%TYPE,

VO_DADOSUNIDADE ON TP_EMPREGABILIDADE_UNI_ODS. TC_DADOSUNIDADE,

VO_CDERROR NUMBER,

VO_DSERROR OUT VARCHAR2

)

IS

v_count pls_integer;

BEGIN

VO_CDERROR: = 0;

VO_DSERROR: = 'success ';

IF (VI_COD_EMPRESA IS NOT NULL AND LENGTH (VI_COD_EMPRESA) > 1) THEN

OPEN FOR VO_DADOSUNIDADE

SELECT

A SEPARATE. CD_UNIDADE AS CD_UNIDADE,

UNITED NATIONS. NM_UNIDADE AS NM_UNIDADE,

UNITED NATIONS. DS_UNIDADE AS DS_UNIDADE,

UNITED NATIONS. UNIDADE_PORTAL AS UNIDADE_PORTAL

OF UNIDADE UN

INNER JOIN INSTITUIÇÃO INS ON (UN.ID_INSTITUICAO = INS.ID_INSTITUICAO)

WHERE UN.ID_INSTITUICAO = DECODE (VI_COD_EMPRESA, NULL, UN.ID_INSTITUICAO), VI_COD_EMPRESA;

Select count (*) from v_count

OF UNIDADE UN

INNER JOIN INSTITUIÇÃO INS ON (UN.ID_INSTITUICAO = INS.ID_INSTITUICAO)

WHERE UN.ID_INSTITUICAO = DECODE (VI_COD_EMPRESA, NULL, UN.ID_INSTITUICAO), VI_COD_EMPRESA;

END IF;

IF (VI_COD_EMPRESA IS NOTHING) THEN

OPEN FOR VO_DADOSUNIDADE

SELECT

A SEPARATE. CD_UNIDADE AS CD_UNIDADE,

UNITED NATIONS. NM_UNIDADE AS NM_UNIDADE,

UNITED NATIONS. DS_UNIDADE AS DS_UNIDADE,

UNITED NATIONS. UNIDADE_PORTAL AS UNIDADE_PORTAL

OF UNIDADE UNITED NATIONS;

Select count (*) from v_count

OF UNIDADE.

END IF;

If v_count = 0 then

vo_cderror: = 2;

vo_dserror: not = "no record found where";

end if;

EXCEPTION

WHILE OTHERS THEN

VO_CDERROR: = 999;

VO_DSERROR: = 'unknown error ' | SQLERRM;

END BUSCAR_UNIDADES;

END PKG_UNIDADE_EMP_ODS;

Tags: Database

Similar Questions

  • sys_context procedure does not return an ip address

    Hello


    DB 11 GR 1 material

    What would be the reason for which this query does not return an IPAddress?

    Select sys_context ('userenv', 'IPAddress') of double;

    Thank you

    What would be the reason for which this query does not return an IPAddress?

    USERENV does not know what the IP # is.

    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    
    SQL> select sys_context('userenv', 'ip_address') from dual;
    
    SYS_CONTEXT('USERENV','IP_ADDRESS')
    --------------------------------------------------------------------------------
    

    Maybe it's because you are connected locally & not via SQL * Net

    Published by: sb92075 on October 27, 2010 12:53

  • Procedure does not return values

    Hello

    I have a stored procedure that has varchar2 as IN and OUT parameters sys_recursor.
    CREATE OR REPLACE PROCEDURE check_values (
         my_values            IN          emp.dept_no%TYPE,
         p_cursor        OUT sys_refcursor
    )
    AS
         quoteValues     VARCHAR2 (256);
    BEGIN
         SELECT     '''' || REPLACE(my_values, ',', ''',''') || ''''
           INTO     quoteValues
           FROM     DUAL;
    
         OPEN p_cursor  FOR
              SELECT          emp_no,
                             emp_name,
                FROM     emp
               WHERE     dept_no IN (quoteValues);
    END check_values;
    /
    The problem, I do face is in where condition, if I give quoteValues it don't get me all the records when I run the sqlplus procedure, but if I give
    my_values he get me folders. I get IN settings such as the 9856,9712,8723, so first I put single quotes around the emp_no and pass to the where condition.

    How can I solve this problem?

    Thank you

    user20090209 wrote:
    So why then is not running? If I hard code the values above in where condition it runs very well.

    Watch your WHERE clause:

    WHERE dept_no IN (quoteValues);

    Expressions how many there are in the list? A straight, single. So regardless of the value of quoteValues, this INTEGER value is compared to dept_no. What you're trying to do can be done through dynamic SQL LIKE operator or collection.

    Dynamic SQL:

    CREATE OR REPLACE PROCEDURE check_values (
         my_values            IN          emp.dept_no%TYPE,
         p_cursor        OUT sys_refcursor
    )
    AS
         quoteValues     VARCHAR2 (256);
    BEGIN
         OPEN p_cursor  FOR
              'SELECT          emp_no,
                             emp_name,
                FROM     emp
               WHERE     dept_no IN (' || my_values || ')';
    END check_values;
    / 
    

    AS the operator:

    CREATE OR REPLACE PROCEDURE check_values (
         my_values            IN          emp.dept_no%TYPE,
         p_cursor        OUT sys_refcursor
    )
    AS
         quoteValues     VARCHAR2 (256);
    BEGIN
         OPEN p_cursor  FOR
              SELECT          emp_no,
                             emp_name,
                FROM     emp
               WHERE     ',' || my_values || ',' LIKE '%,' || dept_no || ',%';
    END check_values;
    / 
    

    Collection:

    CREATE OR REPLACE PROCEDURE check_values (
         my_values            IN          sys.OdciVarchar2List,
         p_cursor        OUT sys_refcursor
    )
    AS
         quoteValues     VARCHAR2 (256);
    BEGIN
         OPEN p_cursor  FOR
              SELECT          emp_no,
                             emp_name,
                FROM     emp
               WHERE     dept_no IN (SELECT * FROM TABLE(my_values));
    END check_values;
    / 
    

    and pass my_values as a sys. OdciVarchar2List ('2345 ', '1245','9076 ').

    SY.

  • Firefox will not load https pages. gives the security warning and will not accept an exception.

    I had problems with Firefox and some sites for about a year, and it is located in my laptop. I have no problems when using my desktop at work or my dad's cell phone in his house. Some sites simply returns a page of text style; no html. Other sites give me a security certificate warning and FF will not accept an exception for this site, either by clicking the button or manually enter the site as an exception. Tonight, GOOGLE will not load again! Why, it's trying to load on an https server, I don't know, however. Several other sites have also begun does not not and are also trying to load it on a secure server.

    Use Kaspersky, AVAST 2015, ESET, BitDefender or Microsoft family safety? These are among the most popular security programs which have a function to intercept your Internet connections and filter your traffic. When it's a secure site, in order to be able to decrypt and inspect your communications, the software must present a false certificate for Firefox. Sometimes, the software is not able to configure Firefox for this, or if you use the function of Reset of Firefox, the trust is broken and needs to be put in place again.

    Unfortunately, the same symptoms can appear with some malicious software.

    If you look at the second half of the post of Philipp, you see where you can check the section 'From' the certificate. This usually allows to identify the culprit. Can you take a look and report what you find?

  • Receive automatic updates for Windows XP "error 127: the specified procedure could not be found." Also "error 0 x 80240036: could not start the service automatic updates on local computer»

    Update CPU which proved later to be bad.  Replaced by original CPU.  Re-installed Windows XP Home using a slipstreamed CD that I burned the original non - OEM drive that has Service Pack 2.  Integrated Service Pack 3 which I got from the MS. site  Everything works well except for Windows Update.  The setting seem to be correct in Administrative Tools/Services.  The status of the Service is "stopped".  When I try to start the automatic updates from Administrative Tools/Services I receive "error 127: the specified procedure could not be found."  Also "error 0 x 80240036: could not start the service automatic updates on local computer»  Used the range of anti-virus and malware and found nothing.  Currently using Avast 7.0.1426.  I also used various tools of Fix - It MS nothing helps.  Any help would be greatly appreciated.  Thank you.

    Hello

    1. what application or antivirus security suite is installed and your current subscription?

    2 Norton (another) or a McAfee application ever installed on this machine?

    3. What are the fix applications that you used so far to try to fix this problem?

    Try the next method and check if that helps you with the question of the 127 error you receive.

    Method 1: Rdding the DLL file by doing the following:

    1. Click Start and click Run, in the search box type CMD and press to enter.
    2. right click on CMD in the list and click "Run as Administrator".
    3. type the following command and press ENTER. Regsvr32 msvcp71.dll
    4. close the command prompt window.

    Method 2: run the file system (CFS) Checker:

    (Note: you need an XP installation disk to start the System File Checker search.)

    The SFC command is used to detect and resolve problems with the files on Windows XP and Windows Vista computers. This command allows you to launch the Windows File Protection Service and allows you to analyze all integrity-protected Windows files and replace all problematic files identified.

    1. click on start, and in the box to start, search type CMD
    2. right click on CMD in the list and click "Run as Administrator"
    3. type the following command and press ENTER. Sfc/scannow
    4. close the command prompt window.

    For more information on scan SFC (System File Checker), please look in the link mentioned below.

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

    I hope this helps.

  • Removed USB controllers: can not return - "this device cannot find enough free resources that it can use. (Code 12)

    Original title: removed USB controllers: can not return

    Hello

    So today I tried to connect to a printer, and it wouldn't work (separate the issue, I don't want to worry about that now)

    I've seen several messages saying: you need to uninstall the USB controllers in Device Manager and then restart your PC. The pilots would then automatically reinstalled.

    It didn't happen, and now my Dell touch screen does not work. I can miss several other USB controllers too, I uninstalled about 3 of them, but I don't know whether or not it has been reinstalled.

    I currently have:

    -Hub USB generic

    -Enhanced host controller USB Intel (R) 8 series #1-9C 26

    -USB root hub

    -Host controller compatible xHCI USB

    Note that the last of them was a symbol of error on it and reads as follows:

    "This device cannot find enough free resources that it can use. (Code 12)

    If you want to use this device, you will need to disable one of the other devices on this system. »

    Can someone please tell me how much USB controllers I should have and how to save them?

    Thank you very much

    Hi Shalini.

    Thanks for the reply, but if you read through the posts on this thread, I think you will find that it has already been suggested that I do these two things - what I've done many times without result.

    Fortunately, I managed to fix it myself.

    To satisfy your curiosity and help someone else who could see this thread with a similar problem, here are the steps I took finally solve the problem:

    ______________________________________________

    I was always convinced that the problem is basically with the xHCI USB controller that I saw always reported as not working not properly in the device (Code 12) Manager. With this in mind, I set out to see if I could determine what the device was supposed to be in conflict with. I ran msinfo32 and began to examine the conflicts/sharing section. After a while, I decided I could not see anything obviously problematic or direct me to the controller xHCI, so I gave up on that front.

    Well, if I couldn't fix the problem with the current installation, maybe that I could find another way to install the xHCI USB controller that could circumvent the flaw that seems to be caused when windows reinstalls automatically it when restarting after the abduction. So I started trying to learn more about this "xHCI USB controller" - since Googling this term has given no end of problems not related.

    In Device Manager, I found a way to isolate the details of this driver in device (somewhere under the properties I believe) Manager. This has created a custom device showing in view only a select few connects the Manager. I have spent some time in the analysis of these and found the time during which the camera has stopped working properly. Suddenly a pattern emerges. Over and over again, see you the following series of when I was hoping that allowing windows to reinstall automatically the driver would to fix:
    • Device PCI VEN_8086 & DEV_9C31 & SUBSYS_05F91028 & REV_04\3 & 11583659 & 0 & A0 has been removed

    [Rebooted PC]

    • Device PCI VEN_8086 & DEV_9C31 & SUBSYS_05F91028 & REV_04\3 & 11583659 & 0 & A0 has been configured
    • Device PCI VEN_8086 & DEV_9C31 & SUBSYS_05F91028 & REV_04\3 & 11583659 & 0 & A0 had a problem starting.

    Under each newspaper was referring to a driver name, I didn't already had access to: driver name: usbxhci.inf

    Now I got some new information about the xHCI USB controller, I took to Google. After much research (and not find something relevant), I found 2 obscure references to the driver who seemed at least somewhat relevant.
    The first reference has been a post on the forum where someone's USB ports stopped working. very similar problem to mine! There is little of any particular use in the nets, with the exception of the reference to a couple of windows updates: KB 2823516 or KB2822241

    It is not clear exactly what usbxhci.inf capacity was tied to these updates, but I made a note of them and moved.

    Another article contained no mention of specific ports USB not working does not and was centered around a different problem entirely. However, he has mentioned an another windows update: KB2919355-x 64.msu

    This one (as I remember) was clearer on the relationship between the update and changes to the usbxhci.inf file.

    Now, I had three updates which could make changes to usbxhci.inf at one point. With their name on a piece of paper, I started looking through my updates installed to see which ones I had installed. I soon discovered that Ko 2823516 or KB2822241 were not present on my PC, which saved the penalty to guess who would be the right to uninstall first.

    KB2919355 has been installed, and I made the decision to uninstall it, because as far as I knew, this update changed something in usbxhci.inf. After the initial uninstall was completed, but before the mandatory reboot for changes to take effect, I went into Device Manager and removed the xHCI USB... because I was afraid that if the new, "defective" was always present during the reinstallation of the update, it doesn't change anything.

    The device is removed once more, I rebooted the system. He drives for a considerable period, uninstall the update and then seems to have some sort of hitch; declare something in the sense of "we could not complete the operation. Changes to undo. " He stayed like that for a while before the system became operational again and began to "prepare windows. Once it was over, I discovered that my touchscreen and USB ports worked very well.

    Investigation later showed that the compatible USB xHCI host controller was is no longer marked with warnings. In addition, a series of USB controllers appeared that had not been there when the xHCI device was defective. I was also pleased to note that the update of windows for KB2919355 had already been reinstalled without messing up anything.

    _________________________________________________

  • % ROWCOUNT SQL does not return the expected result

    I have the following function within a package:

    --Update APPERY_JTI_deleted_USERS table:
    FUNCTION fn_updt_app_jti_dlt_usr(
        p_update_co      IN VARCHAR2,
        p_appery_user_id IN APPERY_JTI_deleted_USERS.appery_user_id%TYPE,
        p_outlet_code    IN APPERY_JTI_deleted_USERS.outlet_code%TYPE)
      RETURN NUMBER
    AS
    lv_sql       VARCHAR2(4000);
    lv_rowcount  NUMBER := 0;
    BEGIN
    
    lv_sql := 'UPDATE APPERY_JTI_deleted_USERS SET '||p_update_co||' = 1 WHERE '||p_update_co||' = 0 AND OUTLET_CODE = '''||p_outlet_code||''' AND APPERY_USER_ID = '''||p_appery_user_id||'''';
    
    --EXECUTE IMMEDIATE lv_sql;
    EXECUTE IMMEDIATE 'BEGIN ' || lv_sql || '; :z := sql%rowcount; END; ' USING OUT lv_rowcount ;
    
    RETURN lv_rowcount;
      
    EXCEPTION
    WHEN OTHERS THEN
      RETURN -1;  
    END fn_updt_app_jti_dlt_usr;
    
    

    The function called several times as part of a job. Basically, the main function (Say M), call a few functions (for example A1... A9). Each of these functions is to do something and updated the application using the above function. Therefore, each of the nine functions will call the above function with different parameters.

    The problem that I am facing is:

    First run, invoke only first of all for the above function will return the positive result ($sql rowcount > 0). When I run M the second time, only first and second calls for the above function will be to return positive results and so on.

    How odd, it's that if I change the values again and run a function M, it will start from the beginning. And what strange more, the dynamic update statement is executed correctly and data are updated successfully. It's just sql rowcount % do not return is not the expected results.

    I tried to run execute immediately without (begin, end). I also tried to run it without HELP ON. It's always the same. I'm really confused, what Miss me here.

    I don't know if this is relevant. But for what it's worth, invoking the function above updates the SAME lines in the table appery_jti_deleted_users that the columns are different. So for all the work, the same lines need to be updated. Each function (A1... A9) will call the above function to update a different column of these lines.

    If you REALLY want to help you having US SHOW, not tell us:

    1. WHAT you do

    2. HOW to

    3. WHAT results you get

    4. WHAT results you expect to get

    First run, invoke only first of all for the above function will return the positive result ($sql rowcount > 0). When I run M the second time, only first and second calls for the above function will be to return positive results and so on.

    How odd, it's that if I change the values again and run a function M, it will start from the beginning. And what strange more, the dynamic update statement is executed correctly and data are updated successfully. It's just sql rowcount % do not return is not the expected results.

    Perhaps that the foregoing is true and maybe he's not. We have NO WAY of knowing because you don't SHOW US anything.

    I tried to run execute immediately without (begin, end). I also tried to run it without HELP ON. It's always the same.

    Yet once you showed us NOTHING >

    You do NOT FOLLOW best practices when you use dynamic sql statements: the sql statement real so that you can print:

    1 SEE what's running - make sure there are no syntax errors, and it seems to be what you wanted

    2 EXECUTE/TEST manually - to see if he really runs without error and see what results it really give.

    3. FIX any syntax or other problems and retest it

    Instrument properly your code and you won't have the problems you are having.

    You should know by now what are the parameters are transmitted when you run the function. So, there are at least three sets of these parameters.

    So you should be able to:

    1 run the instrumented manually function three times

    2. see that all three SQL statements are

    3 manually run these instructions

    4. see that the number of lines is after each execution

    We have no idea of what the output of the function is every time you call it. Apparently, you have, if you save the results of the function somewhere, but you didn't post any of this info.

    We need real details to help you - just listen to your story is not enough.

  • Run query does not return a lines

    Hello

    I find that the Executequery code does not return everything.

    {

    pageContext.writeDiagnostics (this, "connection entry-front connection", 1);

    Connection Conn = pageContext.getApplicationModule (webBean) .getOADBTransaction () .getJdbcConnection ();

    pageContext.writeDiagnostics (this, "connection entered" & conn, 1);

    pageContext.writeDiagnostics (this, "input connection [AJ]" & conn, 4);

    Dim Query = "select CODE a.secondary_uom_code, (select b.unit_of_measure from MTL_UNITS_OF_MEASURE b where b.uom_code = a.secondary_uom_code) GLU, xxtmxc_primary_selling_suom (: 3, a.inventory_item_id) ' PSUOM from mtl_system_items_b where a.inventory_item_id =: 1 and a.organization_id =: 2 and a.secondary_uom_code is not null ';"

    'UNION select 'OUR' CODE, UOM 'Number', 10 double PSUOM;

    String query = "" select secondary_uom_code CODE of mtl_system_items_b where inventory_item_id =: 1 and organization_id =: 2 and secondary_uom_code is not null '; "

    pageContext.writeDiagnostics (this, ' [AJ] after the query string", 4");

    pageContext.writeDiagnostics (this, "message query" + Query, 1);

    PreparedStatement stmt = conn.prepareStatement (Query);

    pageContext.writeDiagnostics (this, "prepared statement Post" + stmt, 1);

    stmt.setString(1,Item);  ver1

    stmt.setString(2,Org);  ver1

    stmt.setInt (3, Dis.intValue ());

    stmt.setString(3,Dis);

    stmt.setInt (3, Ext.intValue ());

    stmt.setString (3, Ext); ver1

    pageContext.writeDiagnostics (this, "Post Ext after SetString" + Ext, 1);

    ResultSet resultset = stmt.executeQuery ();

    pageContext.writeDiagnostics (this, "Resultset" + resultset, 1);

    If (resultset.next ())

    for (ResultSet resultset = stmt.executeQuery ();)

    ResultSet.Next ();)

    While (resultset.next ())

    {

    String code = resultset.getString ('CODE');

    String uom = resultset.getString ("UOM");

    String psuom = resultset.getString ("PSUOM");

    row.setAttribute ("UomCode", code);

    row.setAttribute ("UnitOfMeasure", GLU);

    row.setAttribute ("LineAdjustedPercent", psuom);

    pageContext.writeDiagnostics (this, "secondary UOM" + resultset.getString ('CODE') + resultset.getString ("UOM") + resultset.getString ("PSUOM"), 1);

    pageContext.writeDiagnostics (this, "secondary UOM" + row.getAttribute ("UomCode") + row.getAttribute ("UnitOfMeasure"), 1);

    pageContext.writeDiagnostics (this, "LineAdjustedPercent" + row.getAttribute ("LineAdjustedPercent") + "PSUOM" + resultset.getString ("PSUOM"), 1);

    }

    ResultSet.Close ();

    stmt. Close();

    }

    catch (SQLException sqle)

    {

    throw new OAException ("error in query Preparation" + sqle, OAException.INFORMATION);

    }

    pageContext.writeDiagnostics (this, ' [AJ] after try-catch: ", 4");

    }

    }

    }

    }

    Hi Bobo,

    I tried the same requirement in my local instance and changed the code for you.

    Please check process requires working Code of the form below:

    ' Public Sub processFormRequest (pageContext OAPageContext, OAWebBean webBean)
    {
    OAViewObject QuoteLinesLevel70VO1Obj1 = (OAViewObject) pageContext.getApplicationModule (webBean) .findViewObject ("QuoteLinesLevel70VO1Obj");
    if(QuoteLinesLevel70VO1Obj1!=null)
    {
    If (QuoteLinesLevel70VO1Obj1.GetCurrentRow ()! = null)
    pageContext.writeDiagnostics (this, "Current Row" + QuoteLinesLevel70VO1Obj1.getCurrentRow () .getAttribute ("UomCode"), 1);
    }
               
    pageContext.writeDiagnostics (, "concluded Save Button", OAFwkConstants.STATEMENT);
    If ("Event.Go".equals (pageContext.getParameter (OAWebBeanConstants.EVENT_PARAM)))
    {
    OAViewObject QuoteLinesLevel70VO1Obj = (OAViewObject) pageContext.getApplicationModule (webBean) .findViewObject ("QuoteLinesLevel70VO1Obj");
    if(QuoteLinesLevel70VO1Obj!=null)
    {
    pageContext.writeDiagnostics (thie, 'enter in Count' + QuoteLinesLevel70VO1Obj.getFetchedRowCount (), 1);
    int count = QuoteLinesLevel70VO1Obj.getFetchedRowCount ();
    RowSetIterator Iter = QuoteLinesLevel70VO1Obj.createRowSetIterator ("Iter");
    {if(Count>0)}
    Iter.setRangeStart (0);
    Iter.setRangeSize (count);
    for (int i = 0; i)<>
    {
    OAViewRowImpl row = (OAViewRowImpl) Iter.getRowAtRangeIndex (i);
    If (row.getAttribute ("InventoryItemId")! = null & row.getAttribute ("OrganizationId")! = null)
    {
    String Item = row.getAttribute("InventoryItemId").toString ();
    String Org = row.getAttribute("OrganizationId").toString ();
    Number say = (Number) row.getAttribute ("LineAdjustedPercent"); LineAdjustedPercent
    Dim Ext = (String) row.getAttribute ("Attribute1");
                              
                               int item1 is Integer.valueOf (Item) .intValue ();.   Converted entire string
    int Org1 is Integer.valueOf (Org) .intValue ();.     Converted entire string
    Try
    {
    pageContext.writeDiagnostics (this, "connection entry-front connection", 1);
    Connection Conn = pageContext.getApplicationModule (webBean) .getOADBTransaction () .getJdbcConnection ();
    pageContext.writeDiagnostics (this, "connection entered" & conn, 1);
    pageContext.writeDiagnostics (this, "input connection [AJ]" & conn, 4);
    String query = "select xxtmxc_primary_selling_suom(:1,a.inventory_item_id) PSUOM from mtl_system_items_b where a.inventory_item_id =: 2 and a.organization_id =: 3"; Index link //Changed
    pageContext.writeDiagnostics (this, ' [AJ] after the query string", 4");
    pageContext.writeDiagnostics (this, "message query" + Query, 1);
    PreparedStatement stmt = conn.prepareStatement (Query);
    pageContext.writeDiagnostics (this, "prepared statement Post" + stmt, 1);
                                    Item1 is Integer.valueOf (Item) .intValue ();. Converted entire string
    ORG1 = Integer.valueOf (Org) .intValue ();  Converted entire string
    pageContext.writeDiagnostics (this, "Param1 all" + item1, 1);
    pageContext.writeDiagnostics (this, "Param2 all" + Org1, 1);
    pageContext.writeDiagnostics (this, "Param3 all" + Ext, 1);
    stmt.setString(1,Ext);
    stmt.setInt(2,item1);  ver1
    stmt.setInt(3,Org1);  ver1
    pageContext.writeDiagnostics (this, "Post Ext after SetString" + Ext, 1);
                                    
    for (ResultSet resultset = stmt.executeQuery (); resultset.next ();)  //Used for loop in Resultset
    {
                                       
    String psuom = resultset.getString ("PSUOM");
    pageContext.writeDiagnostics (this, "[AJ] z:" + psuom, 4 "); //Here we got the value of the function
    pageContext.writeDiagnostics (this, "m [AJ]:" + Ext, 4);
                                        
    }
                                    
    stmt. Close();
    }
    catch (SQLException sqle)
    {
    pageContext.writeDiagnostics (this, ' [AJ] with the Exception: "+ sqle.getMessage (), 4");
    throw new OAException ("error in query Preparation" + sqle, OAException.INFORMATION);
    }
    pageContext.writeDiagnostics (this, ' [AJ] after try-catch: ", 4");
    }
                              
    }
    }
                     
          
    }
             
    super.processFormRequest (pageContext, webBean);
    }
    }

    Thank you

    Dilip

  • Channel number SELECT dataset not return

    Hi, I have a problem with the following code:

    PROCEDURE create_so (p_import_batch IN VARCHAR2) 
     IS
    
    
     v_import_batch VARCHAR2(1000);
      
     CURSOR sales_c (x_import_batch IN VARCHAR2)
     IS
     SELECT pbo.*
     ,      msib.inventory_item_id
     FROM XXMEL_PVS_BSH_ORDER pbo
     ,    mtl_system_items_b msib
     WHERE 1=1
     AND msib.segment1 = pbo.material
     AND msib.organization_id = 26
     AND  to_char(pbo.import_batch_id) IN ( x_import_batch);
    
     BEGIN
    
      select '('''||replace(p_import_batch,':',''',''')||''')' 
      INTO v_import_batch
      from dual;
       
      FOR sales_r IN sales_c (v_import_batch)
       LOOP
       
        raise_application_error(-20001,v_import_batch);--Program should raise this error as the cursor should return rows
    
      END LOOP;
    
    END;
    

    I'm passing in the procedure a 1:2:3 as a VARCHAR2 parameter.  The value should be passed as a VARCHAR2 because we use a part of the shuttle from one page of the APEX.

    I want to extract all records in the table of pbo which have an import_import_batch_id (which is a number data type) as v_import_batch who, at the minute ('1', ' 2', 3').

    The import_batch_id is a numeric field, so I got to to_char to try to work with the VARCHAR2 parameter I am by the way.

    The

     select '('''||replace(p_import_batch,':',''',''')||''')' 
      INTO v_import_batch
      from dual;
    
    

    code works well and is back ('1 ', '2', 3') which is what I want.  If I then run the select with this hard coded that value

    SELECT pbo.*
           ,msib.inventory_item_id
     FROM XXMEL_PVS_BSH_ORDER pbo
     ,    mtl_system_items_b msib
     WHERE 1=1
     AND msib.segment1 = pbo.material
     AND msib.organization_id = 26
     AND to_char(pbo.import_batch_id) IN ('1','2','3')
    

    It works OK and return lines that I expect returned.  If I try to use the variable rather than the hard-coded value, the SELECT statement does not return anything.

    Any advice would be great.

    Thank you

    Chris

    You must convert your of as '1 ', '2',' 3' can be considered to be 3 ranks.

    Try the following question

    SELECT pbo.*
           ,msib.inventory_item_id
     FROM XXMEL_PVS_BSH_ORDER pbo
     ,    mtl_system_items_b msib
     WHERE 1=1
     AND msib.segment1 = pbo.material
     AND msib.organization_id = 26
     AND to_char(pbo.import_batch_id) IN (
     select regexp_substr ( txt, '[^,]+', 1, level) data from (select '1,2,3' txt from dual) t CONNECT BY level <= length (txt) - length (replace (txt, ',')) + 1
     )
    
  • Why the Kill_session procedure does not work?

    Hi all

    I like to kill session grant the user of the app in the dev environment. So I did the following steps, but the procedure kills him the session while testing.

    Step 1:

    create or replace procedure kill_session
    (
    p_sid NUMBER,
    p_serial # NUMBER
    ) AS
    m_sql VARCHAR2 (1000);
    m_loginusername VARCHAR2 (30);
    m_killusername VARCHAR2 (30);
    m_schemaname varchar2 (30);
    BEGIN
    SELECT a.USERNAME, a.SCHEMANAME INTO m_killusername, m_schemaname
    SESSION $ v one
    WHERE a.sid = p_sid
    AND a.serial # = p_serial #;
    Select the user in double m_loginusername;
    IF m_loginusername = m_killusername AND m_schemaname NOT IN ('SYS', 'SYSTEM')
    THEN
    m_sql: =' the ALTER SYSTEM KILL SESSION ' | " ' || p_sid | «, » || p_serial # | '''|| "' IMMEDIATE ';
    EXECUTE IMMEDIATE m_sql;
    dbms_output.put_line ("'Session killed.");
    ON THE OTHER
    dbms_output.put_line (' User Login ' | m_loginusername |) "The user to Kill ' | m_killusername);
    dbms_output.put_line ('can't kill session from other users or Admin users');
    raise_application_error (-20101, ' can't kill the session to other users or Admin users, or self');
    END IF;
    EXCEPTION
    WHILE OTHERS THEN
    dbms_output.put_line ('Error in Session kill.' |) SQLERRM (SQLCODE));
    END kill_session;

    Step 2:

    Grant execute on sys.kill_session to the APP.
    Grant select on v_$ APP session;

    Step 3:

    To validate this permission to kill session, as a s/n, I created the TEST user and created a session. Then I tried to kill the TEST user's sid, but the procedure did not kill the session instead it gives power like PL/SQL executed successfully.

    By
    Mr.B

    Set serveroutput on

    SQL> set serveroutput on
    SQL> exec sys.kill_session(132,10);
    Session Killed.
    
    PL/SQL procedure successfully completed.
    
    {code                                                                                                                                                                                                                                                                                                                                        
    
  • Trigger that executes the stored procedure does not

    I have a trigger on a table which triggers the update of the column 'APPLICATION_OFFER_SENT '! The trigger looks like this:
    CREATE OR REPLACE TRIGGER SCHEMA.COPY_APPLICATIONS
    AFTER UPDATE
    OF APPLICATION_OFFER_SENT
    ON PPLE_T_APPLICATION 
    REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
    BEGIN
        UPDATE_OR_INSERT_APPL(:old.PK_APPLICATION_NO);
    END;
    Simply, he runs a procedure and takes the "PK_APPLICATION_NO" as a single parameter.

    When I run the SP itdefl: exec UPDATE_OR_INSERT_APPL (1042); It works very well.
    But when its done through the relaxation it doesn't?



    The Proc looks like this:
    CREATE OR REPLACE PROCEDURE SCHEMA.UPDATE_OR_INSERT_APPL (IN_APPL_NO NUMBER) IS
    
    CURSOR c1 IS
    SELECT title, fullname, universityid, appl_no,  appl_no_hash, OFFER_EXPIRATION_DATE, APPLICATION_CANCEL_DATE, room_hall 
      FROM SCHEMA.ACCOM_APPLICATION_VIEW
     WHERE appl_no = IN_APPL_NO;
    
    rowcnt NUMBER;
    
     BEGIN
      FOR rec IN c1
          LOOP  
          SELECT COUNT(*) INTO rowcnt FROM SCHEMA2.ACCOMM_OFFER_ACCEPTANCE a WHERE a.appl_no = IN_APPL_NO;
               
               IF rowcnt = 0  THEN
                   INSERT INTO SCHEMA2.ACCOMM_OFFER_ACCEPTANCE (title, fullname, universityid, appl_no, appl_no_hash, offer_expiration_date, application_cancel_date, room_hall)
                        VALUES (rec.title, rec.fullname, rec.universityid, rec.appl_no, rec.appl_no_hash, rec.offer_expiration_date, rec.application_cancel_date, rec.room_hall);
                        COMMIT;
                        
                        
                        
               ELSIF rowcnt !=0 THEN
               
                    UPDATE SCHEMA2.ACCOMM_OFFER_ACCEPTANCE t
                       SET (t.offer_expiration_date, t.application_cancel_date, t.room_hall) = (select OFFER_EXPIRATION_DATE, APPLICATION_CANCEL_DATE, ROOM_HALL from SCHEMA.ACCOM_APPLICATION_VIEW B
                                                                                                      where B.appl_no = IN_APPL_NO);        
              
               END IF;
    
          END LOOP; 
     END;
    Published by: oraCraft on Oct / 09/2010 09:11

    Published by: oraCraft on Oct / 09/2010 09:11

    >
    Validation is in my stored procedure, is not my trigger. I'm sure it's very good
    >

    It is not very well according to the Application Developer Fundametals guide...

    >
    DDL statements are not allowed in the body of a trigger. Furthermore, no control of transaction
    statements are allowed in a trigger. SAVEPOINT, COMMIT and ROLLBACK cannot be
    used. For system triggers, TABLE {CREATE/ALTER/DROP} instructions and
    EDIT... COMPILE are allowed.
    Note: A procedure is called by a trigger cannot perform the previous transaction control statements,
    because the procedure runs in the context of the body of the trigger.
    >

    There is an exception to this rule if you use the pragma AUTONOMOUS TRANSACTION, but I do not see that in your trigger.

    Kind regards
    Bob

  • Procedure does not display output

    Hello!

    The following procedure does not show the output.

    {create or replace procedure GET_USER
    (username_in IN VARCHAR2, password_in IN VARCHAR2, OUT VARCHAR2 first_name, last_name OUT VARCHAR2)
    is
    Start
    Declare the cursor is c_user (users.username%TYPE, i_password IN users.password%TYPE IN i_username)
    Select first_name, last_name
    users
    where username_in = i_username
    and password_in = i_password;

    i_username users.username%TYPE;
    i_password users.password%TYPE;

    l_first_name users.first_name%TYPE;
    l_last_name users.last_name%TYPE;

    Start
    If c_user % isopen then
    close c_user;
    end if;
    Open c_user (i_username, i_password);
    extract the c_user in l_first_name l_last_name;
    close c_user;

    first name: = l_first_name;
    name: = l_last_name;
    end;
    end GET_USER ;}

    Output showing only:

    Name =
    Last_name =

    Thanks for any help!

    Assuming that your cursor never returns a line with name of user and password (if it is not, which seems quite a big security hole!), then your code could just be rewritten:

    create or replace procedure GET_USER (p_username_in IN VARCHAR2,
                                          p_password_in IN VARCHAR2,
                                          p_first_name OUT VARCHAR2,
                                          p_last_name OUT VARCHAR2)
    is
    begin
      select first_name, last_name
      into   p_first_name, p_last_name
      from   users
      where  username_in = p_username_in
      and    password_in = p_password_in;
    end GET_USER;
    /
    

    I modified your parameter names, as they have matched the same names as the columns in your table, and it's usually a Really Bad Idea (tm)! Keep all your unique identifiers, and you will have less problems!

  • Popup LOV does not return a value in editable tabular report

    I'm having a problem with a Popup LOV in a report updated in table form. When you select value, the popup remains and the value is not returned to the element. I guess that's because the popup does not know which element to fill? I don't know how to fix.

    [http://apex.oracle.com/pls/otn/f?p=4000:1500:1011573666262225:NO:]

    workspace: csd_apex_demo
    user name: demo
    password: demo
    application: 35976 - Jason demo
    page: 3-1 report

    Thank you

    Jason

    Looking more closely, I see that you mix display_and_save with popup_from_lov. The p_item_id parameter seems to have no effect on the generated javascript code and I think that javascript doesn't work, but not like you might expect. If you use Firefox with Firebug you can inspect the items and watch what happens when you click on an element of the pop-up window. It is by the way of the return value, but it is stored in the first element of display_and_save line which is a named element f08 hidden. All the items are named f08 in this column as a result of your use of the p_idx = 8. But the javascript code to handle the valve of the popup is generated once and so is assuming that it is zero array position. He uses the name attribute and no id and I suspect that it is followed by the line number in their own country (IE in the popup_lov procedure).

    I don't see how to change the way the javascript code generated here then perhaps another solution is needed. I guess that display_and_save is used here so that you can coordinate the f08 array that is posted, but there is no process here "send" to confirm that this is your intention.

    If you remove the display_and_save and just see the 'reason' the works of popup. If you change the popup to something other than p_idx = 8 it will work also. But now we must find a way to align the line ID is displayed.

    There are several ways to coordinate the shipment but they will in part depend on if you want to display only one line of a popup lov field or several lines. I would like to know where you go and I can help you set up the form and submit processes.

    Greg

  • Oracle query of relay and access function call does not return the list

    Thanks to aid in a previous post, I received, I created an oracle 10 g feature that returns the list after you run the sql code it contains. It works in oracle, using sql developer.

    I need to have the list that he returned to see the place in MS Access via a relay request. It does not work so far. The string for connection etc is ok, I'm able to use passthrough queries to run sql strings correctly. But when I try to call the function through the request of relay and access initially nothing seems to happen (IE no list) and if I try to run again, there is an "ongoing call odbc error. Current operation cancelled "." There are only three records in the table. I'm missing something, someone can he spot?

    The application of relay and looks like this

    Select * from fn_testvalues of the double

    Once that is running in oracle.

    To create the test table and 2 functions below.

    CREATE TABLE t_values (MyValue varchar2 (10));

    Table created
    INSERT INTO t_values)
    SELECT 'Merced' c1 FROM dual UNION ALL
    SELECT "Pixie" dual UNION ALL
    SELECT "452" DOUBLE);

    3 lines inserted
    FUNCTION to CREATE or REPLACE RETURN NUMBER IS fn_isnum(p_val VARCHAR2)
    n_val NUMBER;
    BEGIN
    n_val: = to_number (p_val);
    RETURN 1;
    EXCEPTION
    WHILE OTHERS THEN
    RETURN 0;
    END;
    /

    Feature created

    table test:
    SELECT val, isnum fn_isnum (MyValue)
    OF t_values;

    VAL ISNUM
    ---------- ----------
    Merced 0
    Pixie 0
    1 452

    Now the function that is called in the application of relay:

    create or replace function fn_testvalues
    sys_refcursor is back
    RC sys_refcursor;
    Start
    Open rc for
    Select t_values.*, fn_isnum (MyValue) t_values IsNum;
    Return (RC);

    end fn_testvalues;

    Why not?

    satyaki>
    satyaki>select * from v$version;
    
    BANNER
    ----------------------------------------------------------------
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
    PL/SQL Release 10.2.0.1.0 - Production
    CORE    10.2.0.1.0      Production
    TNS for Linux: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    
    Elapsed: 00:00:00.00
    satyaki>
    satyaki>
    satyaki>create or replace view bb
      2  as
      3    select *
      4    from emp;
    
    View created.
    
    Elapsed: 00:00:00.00
    satyaki>
    satyaki>
    satyaki>select * from bb;
    
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO JOB1      DOB
    ---------- ---------- --------- ---------- --------- ---------- ---------- ---------- --------- ----
          7521 WARD       SALESMAN        7698 22-FEB-81     226.88        500         30 SALESMAN
          7654 MARTIN     SALESMAN        7698 28-SEP-81       1815       1400         30 SALESMAN
          7788 SCOTT      ANALYST         7566 19-APR-87     598.95                    20 ANALYST
          7839 KING       PRESIDENT            17-NOV-81       7260                    10 PRESIDENT
          7844 TURNER     SALESMAN        7698 08-SEP-81       2178          0         30 SALESMAN
          7876 ADAMS      CLERK           7788 23-MAY-87     159.72                    20 CLERK
          7900 JAMES      CLERK           7698 03-DEC-81     1379.4                    30 CLERK
          7902 FORD       ANALYST         7566 03-DEC-81    5270.76                    20 ANALYST
          7934 MILLER     CLERK           7782 23-JAN-82     1887.6                    10 CLERK
          7566 Smith      Manager         7839 23-JAN-82       1848          0         10 Manager   23-JAN-89
          7698 Glen       Manager         7839 23-JAN-82       1848          0         10 Manager   23-JAN-89
    
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO JOB1      DOB
    ---------- ---------- --------- ---------- --------- ---------- ---------- ---------- --------- ----
             1 boock
    
    12 rows selected.
    
    Elapsed: 00:00:00.00
    satyaki>
    satyaki>
    satyaki>select *
      2  from bb
      3  where empno = &eno;
    Enter value for eno: 7521
    old   3: where empno = &eno
    new   3: where empno = 7521
    
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO JOB1      DOB
    ---------- ---------- --------- ---------- --------- ---------- ---------- ---------- --------- ----
          7521 WARD       SALESMAN        7698 22-FEB-81     226.88        500         30 SALESMAN
    
    Elapsed: 00:00:00.00
    satyaki>
    satyaki>
    

    Kind regards.

    LOULOU.

  • 'Download files' procedure does not work in app/poster in double-page not found

    Hello

    I created an application using the procedure 'Download files' described in the chapter 'How to download and upload files in an Application' Apex 'Advanced tutorials.' It works fine on a single server, however, when I exported the applications and the data of the copy of the work and any in the APEX running from my laptop, I could download files and generate a report with a link to click and download the files again but when I clicked on these links, I would get a "Page not found" error Looks like it may not go to the procedure and instead goes to a page as follows: "http://127.0.0.1:8080/apex/DBAPORTAL.download_image?p_id=1868612316946460." On the copy on the other server, when you click on the download link, you will get a dialog box asking if you want to open or save the file.

    Someone could tell me why the procedure is not called and goes to a non-existent url while the origonal application works fine on the other server?

    I have granted permissions for the APEX_PUBLIC_USER enforcement procedure. I wonder if there are other authorities I should be granted. Should I grant permissions PUBLIC or ANONOMUSE to use the procedure "download_image"?

    I forgot to mention that I use on my laptop 11.1 database, and the server that the database is 10g.

    We hope to get an answer to this question. I already asked a few people and they are puzzled.

    Thank you in advance.

    Linda

    Linda,

    Sorry for the missing = sign, you are right.

    Show me the code you have in this function. It should be:

    if upper(procedure_name) in (
              'DBAPORTAL.DOWNLOAD_IMAGE') then
            return TRUE;
    ...
    

    Scott

Maybe you are looking for