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.

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

  • [6.0.344] bug - BlackBerryContactList.choose does not return values

         BlackBerryContact bbContact = null;     BlackBerryContactList contacts = null;           try           {               contacts = (BlackBerryContactList) PIM.getInstance().openPIMList(PIM.CONTACT_LIST, PIM.READ_WRITE);           }           catch(PIMException e)           {               Dialog.alert("Couldn't open contacts list.  PIM.openPIMList() threw " + e.toString());                  return;                            }
    
               Object choice = contacts.choose();           if(choice instanceof BlackBerryContact)           {               bbContact = (BlackBerryContact)choice;           }
    

    Central trackpad key does not work on OS 6.0.344 (9700) with this code.

    Two questions:

    (1) the first is that it is a leaked OS (not supported by RIM) so this problem can be solved once an official OS came out for the device.

    (2) this problem is better suited for the developer Issue Tracker.

    http://supportforums.BlackBerry.com/T5/Java-development/developer-issue-tracker/TD-p/271768

  • 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

  • ctxrule - match does not return a result

    v.11.1.07 - I created a ctxrule index as described below. However, although a query must match on the given document, it does not return. Any ideas?
    begin
    ctx_ddl.create_preference('ot_lexer', 'basic_lexer');
    ctx_ddl.set_attribute('ot_lexer', 'index_stems', 'ENGLOSH');
    end;
     
    begin
    ctx_ddl.create_section_group('ot_sec_group', 'auto_section_group');
    end;
     
    create table ot_profile_test
    (profile_id number,
    query clob);
     
    create index ot_profile_rule_ndx on ot_profile_test(query)
    indextype is ctxsys.ctxrule parameters
    ('stoplist ctxsys.empty_stoplist
    section group ot_sec_group
    lexer ot_lexer');
     
    insert into ot_profile_test values(1, '($apple and $pear) and (1 within food)');
    commit;
     
    exec ctxsys.ctx_adm.set_parameter('log_directory', '/yourdir');
    exec ctx_output.start_log('ot');
    exec ctx_output.add_event(ctx_output.event_index_print_rowid);
    exec ctx_output.add_event(ctx_output.event_index_print_token);
    exec ctx_ddl.sync_index('ot_profile_rule_ndx', '2040M', null, 1, null, ctx_ddl.lock_nowait_error);
    exec ctx_output.end_log;
    Then, run a query:
    declare
    a clob := 'apple orange pears banana
    <metadata>
     <indicators>
       <food>1</food>
     </indicators>
    </metadata>
    ';
    vn_profile_id number;
     
    begin
     
    select profile_id into vn_profile_id
    from ot_profile_test
    where matches(query, a) > 0;
     
    dbms_output.put_line(vn_profile_id);
     
    end;
     
    ERROR at line 1:
    ORA-01403: no data found
    ORA-06512: at line 8
    Profile_id = 1 should not be returned?


    In addition, the log file should not have 2 lines written in $I?
    WRITING APPLE: ((PEAR) TOKEN = (PEARS)) * ((1) IN FOOD), 0
    WRITING APPLES: ((PEAR) TOKEN = (PEARS)) * ((1) IN FOOD), 0

    As noted earlier, you must use a list of words, not a lexer to control, like the two conflicts between them. All what you need to do is remove the following line from your code:

    ctx_ddl.set_attribute ('ot_lexer', 'index_stems', 'ENGLISH');

    You can still have a lexer with other attributes; Just do not set the attribute index_stems to the lexer. Set the attribute generator of forms derived from the list of words only.

  • Procedure does not--a number not valid online 12

    Question: Dear professional PL/SQL! I'm a little desperate as my procedure does not work for all my variables. The debugger in SQL-Developer produces a message error "invalid number on line 12. I checked back and fourth but can't find any error.

    You can find the bug or lead my on the right track?

    Here are some example data:

    P_CNT_GEBIET =' 5630-372
    P_STR_LRT = '9170'
    P_WG = 5
    P_BE = 1

    Curious is the fact that it works perfectly when P_STR_LRT is '9110'. With '9170' or '9171' it doesn't work anymore.

    Any help is greatly appreciated.

    BR,

    SEB

    My Proc:
    create or replace
    PROCEDURE PROC_TBL_MATRIX_INTMED_CE
      (
        P_CNT_GEBIET          VARCHAR2,
        P_STR_LRT             VARCHAR2,
        P_BE                  NUMBER,
        P_WG                  NUMBER)
    AS
    BEGIN
      DECLARE
        CNUMBER  number;
    
      BEGIN
      
      SELECT COUNT(*)
        INTO CNUMBER
        FROM TBL_MATRIX_INTERMEDIATE_RESULT
        WHERE LNG_GEBIET = P_CNT_GEBIET
        AND STR_LRT_CLASS      = P_STR_LRT
        AND INT_BE       = P_BE
        AND INT_WG       = P_WG
        AND EVAL_TYPE    = 2;
        
     IF CNUMBER = 0 THEN
      
     INSERT INTO TBL_MATRIX_INTERMEDIATE_RESULT (LNG_BAUMART, STR_BA_LANG, STR_BA_KAT, STR_BA_GRUPPE, INT_PROZENT, INT_SELTEN, EVAL_TYPE, FLAG, LNG_GEBIET, STR_LRT_CLASS, INT_WG, INT_BE, STR_GEWERTET)
     SELECT 
    Z.CNT_BAUMART, Z.BA_LANG, Z.BA_KAT, Z.BA_GRUPPE, Z.PROZENT, DECODE(Z.BA_KAT,'B','von Natur aus selten') AS SELTEN, 2, 0, P_CNT_GEBIET, P_STR_LRT, P_WG, P_BE,
    CASE WHEN Z.CNT_BAUMART = 74 AND Z.PROZENT IS NOT NULL AND (SELECT COUNT(*) FROM(SELECT
    B.CNT_BAUMART, B.BA_LANG, X.BA_KAT,
    SUM(V.DBL_BESTAND) * 100 / (SELECT SUM(V2.DBL_BESTAND)
                                       FROM   VT_TBL_BESTAND     V2,
                                              VT_PUNKTDATEN_JOIN P2
                                       WHERE  (P2.CNT_GEBIET = P_CNT_GEBIET)
                                       AND    (V2.LNG_INV_PT_ID = P2.INV_PT_ID_SUB)
                                       AND    (P2.STR_LRT_MAIN = P_STR_LRT)
                                       AND    (P2.INT_WG = P_WG)
                                       AND    (P2.INT_STATUS_SUB = 3)
                                       AND (P2.INT_BE_MAIN = P_BE)) AS PROZENT
    FROM 
    VT_TBL_BESTAND V,
    VT_PUNKTDATEN_JOIN P,
    VT_TBL_BAUMART B,
    VT_TBL_MATRIX_CUSTOM_EVAL X
    WHERE 
    (P.CNT_GEBIET = P_CNT_GEBIET)
    AND (V.LNG_BAUMART = B.CNT_BAUMART) 
    AND (V.LNG_INV_PT_ID = P.INV_PT_ID_SUB)
    AND (P.STR_LRT_MAIN = P_STR_LRT)
    AND (P.INT_WG = P_WG)
    AND (P.INT_BE_MAIN = P_BE)
    AND (P.INT_STATUS_SUB = 3)
    AND (X.LNG_GEBIET= P_CNT_GEBIET)
    AND (X.LRT_CLASS = P_STR_LRT)
    AND (X.INT_WG = P_WG)
    AND (X.INT_BE = P_BE)
    AND (X.LNG_BAUMART = V.LNG_BAUMART)
    AND (X.BA_KAT IN ('B','H', 'P', 'N'))
    AND (B.CNT_BAUMART IN (5, 6, 7, 8, 9, 81))
    GROUP BY B.CNT_BAUMART, B.BA_LANG, X.BA_KAT
    )) = 0 THEN 'Ja'
    WHEN Z.CNT_BAUMART = 72 AND Z.PROZENT IS NOT NULL AND (SELECT COUNT(*) FROM(SELECT
    B.CNT_BAUMART, B.BA_LANG, X.BA_KAT,
    SUM(V.DBL_BESTAND) * 100 / (SELECT SUM(V2.DBL_BESTAND)
                                       FROM   VT_TBL_BESTAND     V2,
                                              VT_PUNKTDATEN_JOIN P2
                                       WHERE  (P2.CNT_GEBIET = P_CNT_GEBIET)
                                       AND    (V2.LNG_INV_PT_ID = P2.INV_PT_ID_SUB)
                                       AND    (P2.STR_LRT_MAIN = P_STR_LRT)
                                       AND    (P2.INT_WG = P_WG)
                                       AND    (P2.INT_STATUS_SUB = 3)
                                       AND (P2.INT_BE_MAIN = P_BE)) AS PROZENT
    FROM 
    VT_TBL_BESTAND V,
    VT_PUNKTDATEN_JOIN P,
    VT_TBL_BAUMART B,
    VT_TBL_MATRIX_CUSTOM_EVAL X
    WHERE 
    (P.CNT_GEBIET = P_CNT_GEBIET)
    AND (V.LNG_BAUMART = B.CNT_BAUMART) 
    AND (V.LNG_INV_PT_ID = P.INV_PT_ID_SUB)
    AND (P.STR_LRT_MAIN = P_STR_LRT)
    AND (P.INT_WG = P_WG)
    AND (P.INT_BE_MAIN = P_BE)
    AND (P.INT_STATUS_SUB = 3)
    AND (X.LNG_GEBIET= P_CNT_GEBIET)
    AND (X.LRT_CLASS = P_STR_LRT)
    AND (X.INT_WG = P_WG)
    AND (X.INT_BE = P_BE)
    AND (X.LNG_BAUMART = V.LNG_BAUMART)
    AND (X.BA_KAT IN ('B','H', 'P', 'N'))
    AND (B.CNT_BAUMART IN (22,23,24,25,26,27))
    GROUP BY B.CNT_BAUMART, B.BA_LANG, X.BA_KAT
    )) = 0 THEN 'Ja'
    WHEN Z.CNT_BAUMART = 71 AND Z.PROZENT IS NOT NULL AND (SELECT COUNT(*) FROM(SELECT
    B.CNT_BAUMART, B.BA_LANG, X.BA_KAT,
    SUM(V.DBL_BESTAND) * 100 / (SELECT SUM(V2.DBL_BESTAND)
                                       FROM   VT_TBL_BESTAND     V2,
                                              VT_PUNKTDATEN_JOIN P2
                                       WHERE  (P2.CNT_GEBIET = P_CNT_GEBIET)
                                       AND    (V2.LNG_INV_PT_ID = P2.INV_PT_ID_SUB)
                                       AND    (P2.STR_LRT_MAIN = P_STR_LRT)
                                       AND    (P2.INT_WG = P_WG)
                                       AND    (P2.INT_STATUS_SUB = 3)
                                       AND (P2.INT_BE_MAIN = P_BE)) AS PROZENT
    FROM 
    VT_TBL_BESTAND V,
    VT_PUNKTDATEN_JOIN P,
    VT_TBL_BAUMART B,
    VT_TBL_MATRIX_CUSTOM_EVAL X
    WHERE 
    (P.CNT_GEBIET = P_CNT_GEBIET)
    AND (V.LNG_BAUMART = B.CNT_BAUMART) 
    AND (V.LNG_INV_PT_ID = P.INV_PT_ID_SUB)
    AND (P.STR_LRT_MAIN = P_STR_LRT)
    AND (P.INT_WG = P_WG)
    AND (P.INT_BE_MAIN = P_BE)
    AND (P.INT_STATUS_SUB = 3)
    AND (X.LNG_GEBIET= P_CNT_GEBIET)
    AND (X.LRT_CLASS = P_STR_LRT)
    AND (X.INT_WG = P_WG)
    AND (X.INT_BE = P_BE)
    AND (X.LNG_BAUMART = V.LNG_BAUMART)
    AND (X.BA_KAT IN ('B','H', 'P', 'N'))
    AND (B.CNT_BAUMART IN (46,47))
    GROUP BY B.CNT_BAUMART, B.BA_LANG, X.BA_KAT
    )) = 0 THEN 'Ja'
    WHEN Z.CNT_BAUMART = 54 AND Z.PROZENT IS NOT NULL AND (SELECT COUNT(*) FROM(SELECT
    B.CNT_BAUMART, B.BA_LANG, X.BA_KAT,
    SUM(V.DBL_BESTAND) * 100 / (SELECT SUM(V2.DBL_BESTAND)
                                       FROM   VT_TBL_BESTAND     V2,
                                              VT_PUNKTDATEN_JOIN P2
                                       WHERE  (P2.CNT_GEBIET = P_CNT_GEBIET)
                                       AND    (V2.LNG_INV_PT_ID = P2.INV_PT_ID_SUB)
                                       AND    (P2.STR_LRT_MAIN = P_STR_LRT)
                                       AND    (P2.INT_WG = P_WG)
                                       AND    (P2.INT_STATUS_SUB = 3)
                                       AND (P2.INT_BE_MAIN = P_BE)) AS PROZENT
    FROM 
    VT_TBL_BESTAND V,
    VT_PUNKTDATEN_JOIN P,
    VT_TBL_BAUMART B,
    VT_TBL_MATRIX_CUSTOM_EVAL X
    WHERE 
    (P.CNT_GEBIET = P_CNT_GEBIET)
    AND (V.LNG_BAUMART = B.CNT_BAUMART) 
    AND (V.LNG_INV_PT_ID = P.INV_PT_ID_SUB)
    AND (P.STR_LRT_MAIN = P_STR_LRT)
    AND (P.INT_WG = P_WG)
    AND (P.INT_BE_MAIN = P_BE)
    AND (P.INT_STATUS_SUB = 3)
    AND (X.LNG_GEBIET= P_CNT_GEBIET)
    AND (X.LRT_CLASS = P_STR_LRT)
    AND (X.INT_WG = P_WG)
    AND (X.INT_BE = P_BE)
    AND (X.LNG_BAUMART = V.LNG_BAUMART)
    AND (X.BA_KAT IN ('B','H', 'P', 'N'))
    AND (B.CNT_BAUMART IN (13, 14, 15))
    GROUP BY B.CNT_BAUMART, B.BA_LANG, X.BA_KAT
    )) = 0 THEN 'Ja'
    WHEN Z.CNT_BAUMART = 53 AND Z.PROZENT IS NOT NULL AND (SELECT COUNT(*) FROM(SELECT
    B.CNT_BAUMART, B.BA_LANG, X.BA_KAT,
    SUM(V.DBL_BESTAND) * 100 / (SELECT SUM(V2.DBL_BESTAND)
                                       FROM   VT_TBL_BESTAND     V2,
                                              VT_PUNKTDATEN_JOIN P2
                                       WHERE  (P2.CNT_GEBIET = P_CNT_GEBIET)
                                       AND    (V2.LNG_INV_PT_ID = P2.INV_PT_ID_SUB)
                                       AND    (P2.STR_LRT_MAIN = P_STR_LRT)
                                       AND    (P2.INT_WG = P_WG)
                                       AND    (P2.INT_STATUS_SUB = 3)
                                       AND (P2.INT_BE_MAIN = P_BE)) AS PROZENT
    FROM 
    VT_TBL_BESTAND V,
    VT_PUNKTDATEN_JOIN P,
    VT_TBL_BAUMART B,
    VT_TBL_MATRIX_CUSTOM_EVAL X
    WHERE 
    (P.CNT_GEBIET = P_CNT_GEBIET)
    AND (V.LNG_BAUMART = B.CNT_BAUMART) 
    AND (V.LNG_INV_PT_ID = P.INV_PT_ID_SUB)
    AND (P.STR_LRT_MAIN = P_STR_LRT)
    AND (P.INT_WG = P_WG)
    AND (P.INT_BE_MAIN = P_BE)
    AND (P.INT_STATUS_SUB = 3)
    AND (X.LNG_GEBIET= P_CNT_GEBIET)
    AND (X.LRT_CLASS = P_STR_LRT)
    AND (X.INT_WG = P_WG)
    AND (X.INT_BE = P_BE)
    AND (X.LNG_BAUMART = V.LNG_BAUMART)
    AND (X.BA_KAT IN ('B','H', 'P', 'N'))
    AND (B.CNT_BAUMART IN (28,29,30,31,32,33,79))
    GROUP BY B.CNT_BAUMART, B.BA_LANG, X.BA_KAT
    )) = 0 THEN 'Ja'
    WHEN Z.CNT_BAUMART = 78 AND Z.PROZENT IS NOT NULL AND (SELECT COUNT(*) FROM(SELECT
    B.CNT_BAUMART, B.BA_LANG, X.BA_KAT,
    SUM(V.DBL_BESTAND) * 100 / (SELECT SUM(V2.DBL_BESTAND)
                                       FROM   VT_TBL_BESTAND     V2,
                                              VT_PUNKTDATEN_JOIN P2
                                       WHERE  (P2.CNT_GEBIET = P_CNT_GEBIET)
                                       AND    (V2.LNG_INV_PT_ID = P2.INV_PT_ID_SUB)
                                       AND    (P2.STR_LRT_MAIN = P_STR_LRT)
                                       AND    (P2.INT_WG = P_WG)
                                       AND    (P2.INT_STATUS_SUB = 3)
                                       AND (P2.INT_BE_MAIN = P_BE)) AS PROZENT
    FROM 
    VT_TBL_BESTAND V,
    VT_PUNKTDATEN_JOIN P,
    VT_TBL_BAUMART B,
    VT_TBL_MATRIX_CUSTOM_EVAL X
    WHERE 
    (P.CNT_GEBIET = P_CNT_GEBIET)
    AND (V.LNG_BAUMART = B.CNT_BAUMART) 
    AND (V.LNG_INV_PT_ID = P.INV_PT_ID_SUB)
    AND (P.STR_LRT_MAIN = P_STR_LRT)
    AND (P.INT_WG = P_WG)
    AND (P.INT_BE_MAIN = P_BE)
    AND (P.INT_STATUS_SUB = 3)
    AND (X.LNG_GEBIET= P_CNT_GEBIET)
    AND (X.LRT_CLASS = P_STR_LRT)
    AND (X.INT_WG = P_WG)
    AND (X.INT_BE = P_BE)
    AND (X.LNG_BAUMART = V.LNG_BAUMART)
    AND (X.BA_KAT IN ('B','H', 'P', 'N'))
    AND (B.CNT_BAUMART IN (62))
    GROUP BY B.CNT_BAUMART, B.BA_LANG, X.BA_KAT
    )) = 0 THEN 'Ja'
    WHEN Z.BA_KAT = 'N' AND Z.PROZENT > 1 THEN 'Ja' 
    WHEN Z.BA_KAT = 'H' AND Z.PROZENT > 1 THEN 'Ja' 
    WHEN Z.BA_KAT = 'P' AND Z.PROZENT > 1 THEN 'Ja' 
    WHEN Z.BA_KAT = 'B' AND Z.PROZENT !=0 THEN 'Ja' ELSE 'Nein' END AS GEWERTET
    FROM ((SELECT
    B.CNT_BAUMART,
    B.BA_LANG,
    X.BA_KAT,
    SUM(V.DBL_BESTAND) * 100 / (SELECT SUM(V2.DBL_BESTAND)
                                       FROM   VT_TBL_BESTAND     V2,
                                              VT_PUNKTDATEN_JOIN P2
                                       WHERE  (P2.CNT_GEBIET = P_CNT_GEBIET)
                                       AND    (V2.LNG_INV_PT_ID = P2.INV_PT_ID_SUB)
                                       AND    (P2.STR_LRT_MAIN = P_STR_LRT)
                                       AND    (P2.INT_WG = P_WG)
                                       AND    (P2.INT_STATUS_SUB = 3)
                                       AND (P2.INT_BE_MAIN = P_BE)) AS PROZENT,
    X.BA_GRUPPE
    FROM 
    VT_TBL_BESTAND V,
    VT_PUNKTDATEN_JOIN P,
    VT_TBL_BAUMART B,
    VT_TBL_MATRIX_CUSTOM_EVAL X
    WHERE 
    (P.CNT_GEBIET = P_CNT_GEBIET)
    AND (V.LNG_BAUMART = B.CNT_BAUMART) 
    AND (V.LNG_INV_PT_ID = P.INV_PT_ID_SUB)
    AND (P.STR_LRT_MAIN = P_STR_LRT)
    AND (P.INT_WG = P_WG)
    AND (P.INT_BE_MAIN = P_BE)
    AND (P.INT_STATUS_SUB = 3)
    AND (X.LNG_GEBIET= P_CNT_GEBIET)
    AND (X.LRT_CLASS = P_STR_LRT)
    AND (X.INT_WG = P_WG)
    AND (X.INT_BE = P_BE)
    AND (X.LNG_BAUMART = V.LNG_BAUMART)
    AND (X.BA_KAT IN ('B','H', 'P', 'N'))
    GROUP BY B.CNT_BAUMART, B.BA_LANG, X.BA_KAT, X.BA_GRUPPE
    )
    UNION ALL
    (SELECT DISTINCT R.CNT_BAUMART, R.BA_LANG, D.BA_KAT, 
    NULL PROZENT, 
    DECODE(R.BA_GRUPPE,1,'Ba-Grp. 1',2,'Ba-Grp. 2',3,'Ba-Grp 3',4,'Ba-Grp. 4',5,'Ba-Grp. 5',6,'Ba-Grp. 6',7,'Ba-Grp. 7',8,'Ba-Grp. 8') BA_GRUPPE
    FROM VT_TBL_BAUMART R, VT_TBL_MATRIX_CUSTOM_EVAL D
    WHERE 
    R.CNT_BAUMART = D.LNG_BAUMART
    AND (D.LRT_CLASS = P_STR_LRT)
    AND D.BA_KAT IN ('B','H', 'P', 'N')
    AND (R.CNT_BAUMART NOT IN (SELECT DISTINCT
    B4.CNT_BAUMART
    FROM 
    VT_TBL_BESTAND V4,
    VT_PUNKTDATEN_JOIN P4,
    VT_TBL_BAUMART B4,
    VT_TBL_MATRIX_CUSTOM_EVAL X4
    WHERE 
    (P4.CNT_GEBIET = P_CNT_GEBIET)
    AND (V4.LNG_BAUMART = B4.CNT_BAUMART) 
    AND (V4.LNG_INV_PT_ID = P4.INV_PT_ID_SUB)
    AND (P4.STR_LRT_MAIN = P_STR_LRT)
    AND (P4.INT_WG = P_WG)
    AND (P4.INT_BE_MAIN = P_BE)
    AND (P4.INT_STATUS_SUB = 3)
    AND (X4.LNG_GEBIET= P_CNT_GEBIET)
    AND (X4.LRT_CLASS = P_STR_LRT)
    AND (X4.INT_WG = P_WG)
    AND (X4.INT_BE = P_BE)
    AND (X4.LNG_BAUMART=V4.LNG_BAUMART))))
    ) Z
    GROUP BY 
     CNT_BAUMART, BA_LANG, BA_KAT, BA_GRUPPE, PROZENT 
    UNION
    SELECT NULL, 'Gewertete BA > 1%' BA_LANG, NULL, NULL, NULL, NULL, 2, 1, P_CNT_GEBIET, P_STR_LRT, P_WG, P_BE, (SELECT TO_CHAR(COUNT(GEWERTET)) GEWERTET FROM (SELECT
    Z.CNT_BAUMART, Z.BA_KAT, Z.BA_GRUPPE, Z.PROZENT ,
    CASE WHEN Z.CNT_BAUMART = 74 AND Z.PROZENT IS NOT NULL AND (SELECT COUNT(*) FROM(SELECT
    B.CNT_BAUMART, B.BA_LANG, X.BA_KAT,
    SUM(V.DBL_BESTAND) * 100 / (SELECT SUM(V2.DBL_BESTAND)
                                       FROM   VT_TBL_BESTAND     V2,
                                              VT_PUNKTDATEN_JOIN P2
                                       WHERE  (P2.CNT_GEBIET = P_CNT_GEBIET)
                                       AND    (V2.LNG_INV_PT_ID = P2.INV_PT_ID_SUB)
                                       AND    (P2.STR_LRT_MAIN = P_STR_LRT)
                                       AND    (P2.INT_WG = P_WG)
                                       AND    (P2.INT_STATUS_SUB = 3)
                                       AND (P2.INT_BE_MAIN = P_BE)) AS PROZENT
    FROM 
    VT_TBL_BESTAND V,
    VT_PUNKTDATEN_JOIN P,
    VT_TBL_BAUMART B,
    VT_TBL_MATRIX_CUSTOM_EVAL X
    WHERE 
    (P.CNT_GEBIET = P_CNT_GEBIET)
    AND (V.LNG_BAUMART = B.CNT_BAUMART) 
    AND (V.LNG_INV_PT_ID = P.INV_PT_ID_SUB)
    AND (P.STR_LRT_MAIN = P_STR_LRT)
    AND (P.INT_WG = P_WG)
    AND (P.INT_BE_MAIN = P_BE)
    AND (P.INT_STATUS_SUB = 3)
    AND (X.LNG_GEBIET= P_CNT_GEBIET)
    AND (X.LRT_CLASS = P_STR_LRT)
    AND (X.INT_WG = P_WG)
    AND (X.INT_BE = P_BE)
    AND (X.LNG_BAUMART = V.LNG_BAUMART)
    AND (X.BA_KAT IN ('B','H', 'P', 'N'))
    AND (B.CNT_BAUMART IN (5, 6, 7, 8, 9, 81))
    GROUP BY B.CNT_BAUMART, B.BA_LANG, X.BA_KAT
    )) = 0 THEN 'Ja'
    WHEN Z.CNT_BAUMART = 72 AND Z.PROZENT IS NOT NULL AND (SELECT COUNT(*) FROM(SELECT
    B.CNT_BAUMART, B.BA_LANG, X.BA_KAT,
    SUM(V.DBL_BESTAND) * 100 / (SELECT SUM(V2.DBL_BESTAND)
                                       FROM   VT_TBL_BESTAND     V2,
                                              VT_PUNKTDATEN_JOIN P2
                                       WHERE  (P2.CNT_GEBIET = P_CNT_GEBIET)
                                       AND    (V2.LNG_INV_PT_ID = P2.INV_PT_ID_SUB)
                                       AND    (P2.STR_LRT_MAIN = P_STR_LRT)
                                       AND    (P2.INT_WG = P_WG)
                                       AND    (P2.INT_STATUS_SUB = 3)
                                       AND (P2.INT_BE_MAIN = P_BE)) AS PROZENT
    FROM 
    VT_TBL_BESTAND V,
    VT_PUNKTDATEN_JOIN P,
    VT_TBL_BAUMART B,
    VT_TBL_MATRIX_CUSTOM_EVAL X
    WHERE 
    (P.CNT_GEBIET = P_CNT_GEBIET)
    AND (V.LNG_BAUMART = B.CNT_BAUMART) 
    AND (V.LNG_INV_PT_ID = P.INV_PT_ID_SUB)
    AND (P.STR_LRT_MAIN = P_STR_LRT)
    AND (P.INT_WG = P_WG)
    AND (P.INT_BE_MAIN = P_BE)
    AND (P.INT_STATUS_SUB = 3)
    AND (X.LNG_GEBIET= P_CNT_GEBIET)
    AND (X.LRT_CLASS = P_STR_LRT)
    AND (X.INT_WG = P_WG)
    AND (X.INT_BE = P_BE)
    AND (X.LNG_BAUMART = V.LNG_BAUMART)
    AND (X.BA_KAT IN ('B','H', 'P', 'N'))
    AND (B.CNT_BAUMART IN (22,23,24,25,26,27))
    GROUP BY B.CNT_BAUMART, B.BA_LANG, X.BA_KAT
    )) = 0 THEN 'Ja'
    WHEN Z.CNT_BAUMART = 71 AND Z.PROZENT IS NOT NULL AND (SELECT COUNT(*) FROM(SELECT
    B.CNT_BAUMART, B.BA_LANG, X.BA_KAT,
    SUM(V.DBL_BESTAND) * 100 / (SELECT SUM(V2.DBL_BESTAND)
                                       FROM   VT_TBL_BESTAND     V2,
                                              VT_PUNKTDATEN_JOIN P2
                                       WHERE  (P2.CNT_GEBIET = P_CNT_GEBIET)
                                       AND    (V2.LNG_INV_PT_ID = P2.INV_PT_ID_SUB)
                                       AND    (P2.STR_LRT_MAIN = P_STR_LRT)
                                       AND    (P2.INT_WG = P_WG)
                                       AND    (P2.INT_STATUS_SUB = 3)
                                       AND (P2.INT_BE_MAIN = P_BE)) AS PROZENT
    FROM 
    VT_TBL_BESTAND V,
    VT_PUNKTDATEN_JOIN P,
    VT_TBL_BAUMART B,
    VT_TBL_MATRIX_CUSTOM_EVAL X
    WHERE 
    (P.CNT_GEBIET = P_CNT_GEBIET)
    AND (V.LNG_BAUMART = B.CNT_BAUMART) 
    AND (V.LNG_INV_PT_ID = P.INV_PT_ID_SUB)
    AND (P.STR_LRT_MAIN = P_STR_LRT)
    AND (P.INT_WG = P_WG)
    AND (P.INT_BE_MAIN = P_BE)
    AND (P.INT_STATUS_SUB = 3)
    AND (X.LNG_GEBIET= P_CNT_GEBIET)
    AND (X.LRT_CLASS = P_STR_LRT)
    AND (X.INT_WG = P_WG)
    AND (X.INT_BE = P_BE)
    AND (X.LNG_BAUMART = V.LNG_BAUMART)
    AND (X.BA_KAT IN ('B','H', 'P', 'N'))
    AND (B.CNT_BAUMART IN (46,47))
    GROUP BY B.CNT_BAUMART, B.BA_LANG, X.BA_KAT
    )) = 0 THEN 'Ja'
    WHEN Z.CNT_BAUMART = 54 AND Z.PROZENT IS NOT NULL AND (SELECT COUNT(*) FROM(SELECT
    B.CNT_BAUMART, B.BA_LANG, X.BA_KAT,
    SUM(V.DBL_BESTAND) * 100 / (SELECT SUM(V2.DBL_BESTAND)
                                       FROM   VT_TBL_BESTAND     V2,
                                              VT_PUNKTDATEN_JOIN P2
                                       WHERE  (P2.CNT_GEBIET = P_CNT_GEBIET)
                                       AND    (V2.LNG_INV_PT_ID = P2.INV_PT_ID_SUB)
                                       AND    (P2.STR_LRT_MAIN = P_STR_LRT)
                                       AND    (P2.INT_WG = P_WG)
                                       AND    (P2.INT_STATUS_SUB = 3)
                                       AND (P2.INT_BE_MAIN = P_BE)) AS PROZENT
    FROM 
    VT_TBL_BESTAND V,
    VT_PUNKTDATEN_JOIN P,
    VT_TBL_BAUMART B,
    VT_TBL_MATRIX_CUSTOM_EVAL X
    WHERE 
    (P.CNT_GEBIET = P_CNT_GEBIET)
    AND (V.LNG_BAUMART = B.CNT_BAUMART) 
    AND (V.LNG_INV_PT_ID = P.INV_PT_ID_SUB)
    AND (P.STR_LRT_MAIN = P_STR_LRT)
    AND (P.INT_WG = P_WG)
    AND (P.INT_BE_MAIN = P_BE)
    AND (P.INT_STATUS_SUB = 3)
    AND (X.LNG_GEBIET= P_CNT_GEBIET)
    AND (X.LRT_CLASS = P_STR_LRT)
    AND (X.INT_WG = P_WG)
    AND (X.INT_BE = P_BE)
    AND (X.LNG_BAUMART = V.LNG_BAUMART)
    AND (X.BA_KAT IN ('B','H', 'P', 'N'))
    AND (B.CNT_BAUMART IN (13, 14, 15))
    GROUP BY B.CNT_BAUMART, B.BA_LANG, X.BA_KAT
    )) = 0 THEN 'Ja'
    WHEN Z.CNT_BAUMART = 53 AND Z.PROZENT IS NOT NULL AND (SELECT COUNT(*) FROM(SELECT
    B.CNT_BAUMART, B.BA_LANG, X.BA_KAT,
    SUM(V.DBL_BESTAND) * 100 / (SELECT SUM(V2.DBL_BESTAND)
                                       FROM   VT_TBL_BESTAND     V2,
                                              VT_PUNKTDATEN_JOIN P2
                                       WHERE  (P2.CNT_GEBIET = P_CNT_GEBIET)
                                       AND    (V2.LNG_INV_PT_ID = P2.INV_PT_ID_SUB)
                                       AND    (P2.STR_LRT_MAIN = P_STR_LRT)
                                       AND    (P2.INT_WG = P_WG)
                                       AND    (P2.INT_STATUS_SUB = 3)
                                       AND (P2.INT_BE_MAIN = P_BE)) AS PROZENT
    FROM 
    VT_TBL_BESTAND V,
    VT_PUNKTDATEN_JOIN P,
    VT_TBL_BAUMART B,
    VT_TBL_MATRIX_CUSTOM_EVAL X
    WHERE 
    (P.CNT_GEBIET = P_CNT_GEBIET)
    AND (V.LNG_BAUMART = B.CNT_BAUMART) 
    AND (V.LNG_INV_PT_ID = P.INV_PT_ID_SUB)
    AND (P.STR_LRT_MAIN = P_STR_LRT)
    AND (P.INT_WG = P_WG)
    AND (P.INT_BE_MAIN = P_BE)
    AND (P.INT_STATUS_SUB = 3)
    AND (X.LNG_GEBIET= P_CNT_GEBIET)
    AND (X.LRT_CLASS = P_STR_LRT)
    AND (X.INT_WG = P_WG)
    AND (X.INT_BE = P_BE)
    AND (X.LNG_BAUMART = V.LNG_BAUMART)
    AND (X.BA_KAT IN ('B','H', 'P', 'N'))
    AND (B.CNT_BAUMART IN (28,29,30,31,32,33,79))
    GROUP BY B.CNT_BAUMART, B.BA_LANG, X.BA_KAT
    )) = 0 THEN 'Ja'
    WHEN Z.CNT_BAUMART = 78 AND Z.PROZENT IS NOT NULL AND (SELECT COUNT(*) FROM(SELECT
    B.CNT_BAUMART, B.BA_LANG, X.BA_KAT,
    SUM(V.DBL_BESTAND) * 100 / (SELECT SUM(V2.DBL_BESTAND)
                                       FROM   VT_TBL_BESTAND     V2,
                                              VT_PUNKTDATEN_JOIN P2
                                       WHERE  (P2.CNT_GEBIET = P_CNT_GEBIET)
                                       AND    (V2.LNG_INV_PT_ID = P2.INV_PT_ID_SUB)
                                       AND    (P2.STR_LRT_MAIN = P_STR_LRT)
                                       AND    (P2.INT_WG = P_WG)
                                       AND    (P2.INT_STATUS_SUB = 3)
                                       AND (P2.INT_BE_MAIN = P_BE)) AS PROZENT
    FROM 
    VT_TBL_BESTAND V,
    VT_PUNKTDATEN_JOIN P,
    VT_TBL_BAUMART B,
    VT_TBL_MATRIX_CUSTOM_EVAL X
    WHERE 
    (P.CNT_GEBIET = P_CNT_GEBIET)
    AND (V.LNG_BAUMART = B.CNT_BAUMART) 
    AND (V.LNG_INV_PT_ID = P.INV_PT_ID_SUB)
    AND (P.STR_LRT_MAIN = P_STR_LRT)
    AND (P.INT_WG = P_WG)
    AND (P.INT_BE_MAIN = P_BE)
    AND (P.INT_STATUS_SUB = 3)
    AND (X.LNG_GEBIET= P_CNT_GEBIET)
    AND (X.LRT_CLASS = P_STR_LRT)
    AND (X.INT_WG = P_WG)
    AND (X.INT_BE = P_BE)
    AND (X.LNG_BAUMART = V.LNG_BAUMART)
    AND (X.BA_KAT IN ('B','H', 'P', 'N'))
    AND (B.CNT_BAUMART IN (62))
    GROUP BY B.CNT_BAUMART, B.BA_LANG, X.BA_KAT
    )) = 0 THEN 'Ja'
    WHEN Z.BA_KAT = 'N' AND Z.PROZENT > 1 THEN 'Ja' 
    WHEN Z.BA_KAT = 'H' AND Z.PROZENT > 1 THEN 'Ja'
    WHEN Z.BA_KAT = 'P' AND Z.PROZENT > 1 THEN 'Ja' 
    WHEN Z.BA_KAT = 'B' AND Z.PROZENT !=0 THEN 'Ja' ELSE 'Nein' END AS GEWERTET
    FROM ((SELECT
    B.CNT_BAUMART,
    B.BA_LANG,
    X.BA_KAT,
    SUM(V.DBL_BESTAND) * 100 / (SELECT SUM(V2.DBL_BESTAND)
                                       FROM   VT_TBL_BESTAND     V2,
                                              VT_PUNKTDATEN_JOIN P2
                                       WHERE  (P2.CNT_GEBIET = P_CNT_GEBIET)
                                       AND    (V2.LNG_INV_PT_ID = P2.INV_PT_ID_SUB)
                                       AND    (P2.STR_LRT_MAIN = P_STR_LRT)
                                       AND    (P2.INT_WG = P_WG)
                                       AND    (P2.INT_STATUS_SUB = 3)
                                       AND (P2.INT_BE_MAIN = P_BE)) AS PROZENT,
    X.BA_GRUPPE
    FROM 
    VT_TBL_BESTAND V,
    VT_PUNKTDATEN_JOIN P,
    VT_TBL_BAUMART B,
    VT_TBL_MATRIX_CUSTOM_EVAL X
    WHERE 
    (P.CNT_GEBIET = P_CNT_GEBIET)
    AND (V.LNG_BAUMART = B.CNT_BAUMART) 
    AND (V.LNG_INV_PT_ID = P.INV_PT_ID_SUB)
    AND (P.STR_LRT_MAIN = P_STR_LRT)
    AND (P.INT_WG = P_WG)
    AND (P.INT_BE_MAIN = P_BE)
    AND (P.INT_STATUS_SUB = 3)
    AND (X.LNG_GEBIET= P_CNT_GEBIET)
    AND (X.LRT_CLASS = P_STR_LRT)
    AND (X.INT_WG = P_WG)
    AND (X.INT_BE = P_BE)
    AND (X.LNG_BAUMART = V.LNG_BAUMART)
    AND (X.BA_KAT IN ('B','H', 'P', 'N'))
    GROUP BY B.CNT_BAUMART, B.BA_LANG, X.BA_KAT, X.BA_GRUPPE
    )
    UNION ALL
    (SELECT DISTINCT R.CNT_BAUMART, R.BA_LANG, D.BA_KAT, 
    NULL PROZENT, 
    DECODE(R.BA_GRUPPE,1,'Ba-Grp. 1',2,'Ba-Grp. 2',3,'Ba-Grp 3',4,'Ba-Grp. 4',5,'Ba-Grp. 5',6,'Ba-Grp. 6',7,'Ba-Grp. 7',8,'Ba-Grp. 8') BA_GRUPPE
    FROM VT_TBL_BAUMART R, VT_TBL_MATRIX_CUSTOM_EVAL D
    WHERE 
    R.CNT_BAUMART = D.LNG_BAUMART
    AND (D.LRT_CLASS = P_STR_LRT)
    AND D.BA_KAT IN ('B','H', 'P', 'N')
    AND (R.CNT_BAUMART NOT IN (SELECT DISTINCT
    B4.CNT_BAUMART
    FROM 
    VT_TBL_BESTAND V4,
    VT_PUNKTDATEN_JOIN P4,
    VT_TBL_BAUMART B4,
    VT_TBL_MATRIX_CUSTOM_EVAL X4
    WHERE 
    (P4.CNT_GEBIET = P_CNT_GEBIET)
    AND (V4.LNG_BAUMART = B4.CNT_BAUMART) 
    AND (V4.LNG_INV_PT_ID = P4.INV_PT_ID_SUB)
    AND (P4.STR_LRT_MAIN = P_STR_LRT)
    AND (P4.INT_WG = P_WG)
    AND (P4.INT_BE_MAIN = P_BE)
    AND (P4.INT_STATUS_SUB = 3)
    AND (X4.LNG_GEBIET= P_CNT_GEBIET)
    AND (X4.LRT_CLASS = P_STR_LRT)
    AND (X4.INT_WG = P_WG)
    AND (X4.INT_BE = P_BE)
    AND (X4.LNG_BAUMART=V4.LNG_BAUMART))))
    ) Z
    ) WHERE GEWERTET = 'Ja') PROZENT FROM DUAL; 
    END IF;
      END;
    END PROC_TBL_MATRIX_INTMED_CE;

    Hello

    It's a question of data.

    All the values you pass for column LNG_GEBIET?

    Concerning
    AJR

  • 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!

  • AF:selectOneChoice do not return value

    Hi all

    I use JDeveloper 11 g, EntityObjects, and ADF Faces.

    I am trying to use a selectOneChoice to send a value. I created a managed bean that returns a list of items. The selectOneChoice is filled out correctly, but the selected value will not be sent, so a null is written to the database.

    My code:

    & lt; AF:selectOneChoice value = "#{bindings." ExpresionOral.inputValue}.
    label = "#{bindings." ExpresionOral.label}.
    shortDesc = "#{bindings." ExpresionOral.hints.tooltip}.
    required = "true" & gt;
    & lt; f: selectItems value = "#{collections.nivelIdiomaEnum}" / & gt;
    & lt; / af:selectOneChoice & gt;

    public List & lt; SelectItem & gt; {getNivelIdiomaEnum()}
    FacesContext ctx = FacesContext.getCurrentInstance ();
    Settings regional locale = ctx.getViewRoot () .getLocale ();
    ArrayList & lt; SelectItem & gt; list = new ArrayList & lt; SelectItem & gt ;();
    for ({nIdioma:NivelIdioma.values())} NivelIdioma
    Point SelectItem is new SelectItem (nIdioma, nIdioma.getName (local));.
    List.Add (Item);
    }
    back list;
    }

    Thank you

    Joseba

    Hi Joseba,

    Your code looks fine. However, my hunch is that the getNivelIdiomaEnum() method does not return the list itself for the publication, if yes, then you need to fix your code accordingly. You can also try the selectOneChoice valuePassThru attribute set to true, it can thus correct.

    Kind regards

    ~ Simon

  • When I return from the page of google search for a link then button does not return return

    When I return from the page of google search for a link, then button does not return back. Instead, the same page refills. I need to go back click back button twice or even more. How to fix? I cheked it it another browser and there is no such behavior. It seems completele Firefox problem.

    the problem was resolved after remooving extenshion «user agent overrider»

  • HP 640 c: HP640c cartridge does not return to its original position and the printer will be no print anything

    Printer cartridge does not return to its original position on the right side of the printer after the top cover is opened, with the resume light continues to Flash.

    After restarting the printer, the cartridge moves to the right, but not all the way and remained there when the printer is off.

    The printer will not print anything.

    How can I get the cartridge is positioned correctly?

    Solved the problem... it's a defective color print cartridge, which was the carrage Act strangely.

  • Screen turns black and does not return. One stop forced

    When I leave my computer for a while, the screen turns black and does not return when I press 'enter', or any other key.  I do a forced shutdown (turn off with the power button).  Can I get, and the "incorrect closing" message when I turn on computer. I think that it is a problem of Hibernate.  Any ideas?.
    MMM

    Original title: hibernation problem?

    What happens if you press Ctrl + SHIFT + ESC when you want to get out of hibernation?

    You use a wireless keyboard and mouse with a transponder. What happens if you press the button on the transponder?

  • PC Windows 7 does not return the document or the printed page

    I had a setting for this in XP control but can't find the page, that I got it.

    This occurs in AN application, or a browser.  I print from a workbook Excel specific, for example, when I have a number of them opens.  The system does not return the workbook that I printed.  It's maddening and causes all sorts of questions.  Searching the Web for this instant product nothing and I know I can't be the only person who saw this.

    It is a platform of Windows 7 in a commercial network environment.  I use the snap Menu Addintools classic because I can't stand the Ribbon and never loved.  In Windows 7, I run a couple of other supplements that restore the XP the taskbar properly use, so you can work efficiently.

    None of the supplements are causing this problem because I was running the same classic Menu Add-in in the XP box and he had the same problem until I found workaround that I don't remember now.

    Everyone knows about this problem?

    Jeff Lynch

    Hello Jeff,.

    Please contact the Microsoft community.

    As the Windows 7 computer is under the corporate network environment, the issue that you are facing 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 TechNet Forum.

    https://social.technet.Microsoft.com/forums/Windows/en-us/home?category=w7itpro&filter=AllTypes&sort=lastpostdesc

    Hope the information above has been a useful answer, Mercia back to us if you respect them more.

  • Network type changes 'Public' and does not return to work when the default gateway is detected

    Original title: Type of network not restored on ethernet cable reconnect.

    I have a Dell Precision R5500 running Windows 7 Professional Service Pack 1. It is connected to a network that is stored as a type of 'work '. When the ethernet cable is removed and replaced network type changes to 'Public' and does not return to work when the default gateway is detected. I also have a Toshiba Tecra M10 running Window 7 Professional Service Pack 1 that initially detects the network restored as 'Public', but 'Work' once again Exchange is a connection to the default gateway. Is there a setting somewhere in the strength of the network to double check its type periodically?

    Hello

    You have any other network assets wireless (specifically) running on the computer?

    Have another active network connection could also cause this.

    Allows us to follow the methods mentioned below and see if they help.

    Method 1: Run the network troubleshooter.

    When the network type gets changed to 'Public' after the cable is disconnected and reconnected. The troubleshooter should let you know if there are errors with the associated services.

    See the following article:

    Using the troubleshooter from network in Windows 7:

    http://Windows.Microsoft.com/en-us/Windows7/using-the-network-troubleshooter-in-Windows-7


    Method 2:
    check if network discovery and file sharing options are enabled in the network and sharing Center.

    See the following steps:

    a. click on start toreduce this top, type network and sharing Center in the Start Search box, and then click network and sharing Center in the programs list.

    b. If network discovery is off, click the arrow to expand the section, click turn on network discoveryand then click apply.

    Reduce this includes this imIf that you are prompted for an administrator password or for confirmation, type your password or click continue.

    c. If file sharing is off, click the arrow to expand the section, click turn on file sharingand then click apply.

    Collapse this includes this ima

    If you are prompted for an administrator password or for confirmation, type your password, or click continue.


    Method 3: Uninstall the network drivers and then install the last set of drivers on the manufacturer's Web site and check the issue.

    See the following steps:

    (a) click Start, right click on computer.

    (b) click on properties, click on Device Manager

    (c) expand the network adapter, right click on the adapter option

    (d) click on uninstall

    (e) now go to your computer / site Web of the manufacturer of the device, download the updated drivers and install them.

    Reference:

    Updated a hardware driver that is not working properly:

    http://Windows.Microsoft.com/en-us/Windows7/update-a-driver-for-hardware-that-isn ' t-work correctly

  • Why PL/SQL procedures does not allow users to enter data dynamically at run time?

    Dear all,

    I tried to do a procedure that will search for a group of approval in our database that matches.

    (1) the number of levels

    (2) the number of users by each level

    (3) the id of users by level

    entered by the user.

    I tried various methods to receive user input dynamically at run time, but in vain.

    Finally finished my procedure allowing the user to enter the parameters and then executes the procedure, to which these parameters are passed as arguments. (1 variable for the number of levels and 2 userdefinedarrays with the number of users by level and level respectively)

    Why PL/SQL procedures does not allow users to enter data dynamically at run time?

    Thanks in advance,

    Séverine Suresh

    HEY, Sebastian,

    3035408 wrote:

    Hello Sir,

    My question is that if I'm going to say, the number of levels 5, is there any way by which, at runtime, the procedure prompts me to enter at the start of the number of users per level. Now as soon as I get the number of users per level can I do the procedure ask me to enter the nicknames of the members of each level. I mean, something like a invite.

    Thank you

    Séverine Suresh

    There is no way to do it in SQL or PL/SQL, because not SQL PL/SQL is a way to get user input.  User interaction is a job for your front end, like Zlatko tool suggested in response to #5.  If your front end tool is SQL * Plus, you can use the substtitution variables, as Jarkko showed in response #6.

  • 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

Maybe you are looking for

  • iPhone 6s more sound with no option to answer?

    While sounding actively option is not showing to answer the call or decrease. Phone seems to be used as if there is no incoming calls? Seems to occur at random times in random places. It is not respected then the other is normal.

  • HP15 ac179tx: none of the shortcut keys work

    I bought a computer laptop ac179tx HP15 that comes with freeDOS. I installed windows 10 and all the drivers that are given on the HP website. The shortcut keys for control of brightness, volume, etc. do not work even after you have installed all the

  • HP Pavilion 15-e084c: multiformat card reader

    Hello: I have a laptop HP Pavilion 15.6 inch screen (15-e084ca), AMD Quad Core A10 - 5750M and 8650 Radeon graphics card, 1 TB hard drive, 8 MB of SDRAM DDR3, Windows 64 - bit 8.1. I would like to know if the card reader accepts the Sony Memory Stick

  • Windows media player cannot play music Error code: C00D11B

    Original title: "music and noise.A red + appears beside each of the elements in the list p - lay.

  • Can't get windows 10 approx. sys chks ok

    Running win 7, sp1. Ran sys control compatibility to win 10 and it was ok. At the 'get win 10 app' in my status bar after I booked the upgrade, but it disappeared after several weeks B4 I had the time to download the upgrade to win 10. Now I can't ge