roles authenticated using stored procedures does not...

Mr President.
See the steps I went through that
create user100 user identified by 123;
create user101 user identified by 123;
Grant create session, create role, create the procedure to user100;
Grant connect to user101;
change the quota of the user user100 10 M on users;
grant create table to user100 with admin option;
Conn user100/123
create or replace procedure settingrole as
Start
dbms_Session.set_role ('dummy');
end;
/
create the dummy role identified using user100.settingrole;
grant create table to dummy;

Grant execute on settingrole to user101;



Conn user101/123

execute user100.settingrole;
now the error I get is ora-06565 cannot run set role in stored procedures
ORA-065512 to the sys.dbms_session line

can u help me please how to do this job

You must create the procedure with the right of the applicant (article AUTHID CURRENT_USER). See more on the secure application role http://download.oracle.com/docs/cd/B28359_01/server.111/b28337/tdpsg_privileges.htm#CIHHGDAE tutorial

Tags: Database

Similar Questions

  • 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

  • For loop stored procedure does not

    Hello

    I wrote a stored procedure that does not work (I mean do not display data)
    I set serveroutput on option also.
    If I run as a single SQL query its working very well. so please help

    create or replace procedure show_empnos (p_deptno number)
    is
    emp_id emp. EMP_ID % TYPE;
    cursor cur_emps is
    Select emp_id emp where department_id = '12';
    Start
    for a cur_emps in
    loop
    dbms_output.put_line (emp_id);
    end loop;
    end;


    See, when I ran that a single SQL interrogate data dosplayed

    SQL > select emp_id from emp where department_id = '12';

    EMP_ID
    ----------
    * 101 *.
    * 101 *.
    * 101 *.

    Help, please.

    You declare a local variable EMP_ID you initialize ever, so it will always be NULL.
    In your cursor, you also select a column EMP_ID.

    The line

    dbms_output.put_line(emp_id);
    

    solve the use of uninitialized local variable and then print a NULL value (which would appear as a blank line in the output). Assuming you want to return the value of the column EMP_ID your cursor, you need

    dbms_output.put_line(a.emp_id);
    

    As a general approach, including local variables whose names match exactly in the name of a column will create problems on the line where you write the code assumes that you speak for column only to discover that the identifier is resolved to the local variable instead. If you need a local variable to store the EMP_ID, therefore, it would make much more sense to declare it as

    l_emp_id emp.EMP_ID%TYPE;
    

    While it is not accidentally get confused with the name of the column.

    Finally, if department_id is a NUMBER, it should be compared to a number, not a string, i.e.

    WHERE department_id = 12
    

    Justin

  • CF claims Oracle stored procedure does not exist.

    Hello world

    Cold Fusion says

    Run database query error.

    [Macromedia] [Oracle JDBC Driver] [Oracle] ORA-06564: object CICOD. CI_GET_SUMMRPT_LANGUAGES. GET_LANGUAGE_PREFERENCES is no ORA-06512: at "SYS." DBMS_UTILITY", line 114 ORA-06512: at line 1
    The error occurred in /apache/ www_dev_7084/bes-partners/Integrated Reports/language_preferences_report.cfm of labour: line 41
    39 :   <cfprocparam  
    40 :     value="0" 
    41 :     cfsqltype="cf_sql_numeric">
    42 : </cfstoredproc>
    

    My Oracle package works very well when it is called from an Oracle procedue and I checked the CF user privileges for the package.

    My code is below.

    Any suggestions?

    Thanks in advance for your help,

    Lou

    Cold Fusion

    < cfstoredproc procedure = 'CI_GET_SUMMRPT_LANGUAGES. GET_LANGUAGE_PREFERENCES"dataSource ="cicod_dev">
    < cfprocresult
    name = "p_reply" >
    < cfprocparam
    value = "1 January 09.
    cfsqltype = 'cf_sql_date' >
    < cfprocparam
    value = "1 April 09 '.
    cfsqltype = 'cf_sql_date' >
    < cfprocparam
    value = "1".
    cfsqltype = "cf_sql_numeric" >
    < cfprocparam
    value = '0 '.
    cfsqltype = "cf_sql_varchar" >
    < cfprocparam
    value = '0 '.
    cfsqltype = "cf_sql_numeric" >
    < / cfstoredproc >

    Package Oracle statement

    create or replace
    PACKAGE CI_GET_SUMMRPT_LANGUAGES
    AS
    -See http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_17938 method 1: reference cursor method
    -p_reply_cursor Oracle and ColdFusion coding.
    TYPE p_reply_cursor
    IS
    REF
    CURSOR;
    PROCEDURE GET_LANGUAGE_PREFERENCES
    (
    p_reply ON p_reply_cursor
    p_start_date IN this update,
    p_end_date IN this update,
    p_sum_column in NUMBERS
    p_region_selections IN VARCHAR2,
    p_location_selection in NUMBER);
    -P_sum_column values determine the columns to SUM.
    c_registration_reregistration (1) CONSTANT INTEGER: = 1;
    c_served (1) CONSTANT INTEGER: = 2;
    END CI_GET_SUMMRPT_LANGUAGES;

    Oracle Package body (header only)

    PROCEDURE GET_LANGUAGE_PREFERENCES
    /*
    p_reply:... Cursor that contains the requested data.
    p_start_date:... Start date of request.
    p_end_date:... End date of query
    p_sum_column:... See GET_LANGUAGE_PREFERENCES.c_registration_reregistration
    and GET_LANGUAGE_PREFERENCES.c_served.
    p_region_selections. . Selections from region to report, separated by commas.
    p_location_selection:. Selection of rental to the report.
    */
    (
    p_reply ON p_reply_cursor
    p_start_date IN this update,
    p_end_date IN this update,
    p_sum_column in NUMBERS
    p_region_selections IN VARCHAR2,
    p_location_selection in NUMBERS)
    AS

    So that this works, the user associated with the Data Source ID "cicod_dev" must be the same for the owner of the Package "CI_GET_SUMMRPT_LANGUAGES".  Alternatively, you can code the name of the owner in your CF code...

    CFSTOREDPROC procedure = '. CI_GET_SUMMRPT_LANGUAGES. GET_LANGUAGE_PREFERENCES ".

    HTH

  • Problem with the Entity Framework by using stored procedures

    I am developing a project with Oracle DB and Entity Framework.
    Due to performance issues, for some querys I uses procedures stored instead of LINQ queryies,
    When I try to add my model EF procedure, the procedure is added but the Model Designer
    It does not acknowledge the columns returned by the procedure.
    so I can't create something complex to the user the results of the procedure
    in a domain service

    Here's the relevant readme which has some tips: http://www.oracle.com/technetwork/topics/dotnet/tech-info/default-338300.html#mozTocId610465

    If you do a forum search there is further discussion of the issues, and the readme file provided with version beta has also some information.

    But I agree with the general theme: using stored procedures in the EF is a PITA. :( I really hope they do something to make it easier in the future because this is probably the single most important weakness in the implementation of Oracle EF and establishment of a complex type is your time and picky it's ridiculous. (I found it less problematic if your procedure returns a complete picture that your model has already an entity for, because you can get away with only add the entry to one of the configurations for the cursor rather than one for each column.)

    Even an external tool where direct you to the procedure and it creates the configuration entries to be able to copy and paste would be a huge improvement.

  • using stored procedures - I can't seem to get the right settings

    I am wanting to use stored procedures to create variables of substitution use UC4 (Appworx). (the databases I use are 10g) To do this, I first need to run command line in PL/SQL procedures. I don't seem to be able to create the correct command. This is the part of the package that I want to call



    CREATE OR REPLACE
    PACKAGE BODY 'APPLICATION_PACKAGE' AS


    PROCEDURE GET_APP_PARAM (V_APP_PARAM_ID IN CCOK. CC_APP_PARAM_DETAIL. APP_PARAM_ID % TYPE,
    V_APP_PARAM_NAME IN CCOK. CC_APP_PARAM_DETAIL. APP_PARAM_NAME % TYPE,
    OUT NOCOPY CCOK V_APP_PARAM_VALUE. CC_APP_PARAM_DETAIL. APP_PARAM_VALUE % TYPE)


    AS


    BEGIN

    SELECT APP_PARAM_VALUE
    IN V_APP_PARAM_VALUE
    TO CCOK. CC_APP_PARAM_DETAIL
    WHERE APP_PARAM_ID = V_APP_PARAM_ID
    AND APP_PARAM_NAME = V_APP_PARAM_NAME;


    END;




    It's the exact command I use command line

    run application_package.get_app_param(1000,'RUN_TYPE')

    When I do this I get invalid statements expected but still tweaking doesn't fix it and does not give me a clear idea of what I need to do to fix it.
    I get this sort of thing


    SQL & gt; run ccok.application_package.get_app_param(1000,'run_type')
    BEGIN ccok.application_package.get_app_param(1000,'run_type'); END;


    *
    ERROR on line 1:
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in the call to 'GET_APP_PARAM '.
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored



    SQL & gt; run ccok.application_package.get_app_param(1000,'run_type',:result)
    SP2-0552: Bind variable 'RESULT' undeclared.
    SQL & gt; run ccok.application_package.get_app_param('1000','run_type')
    BEGIN ccok.application_package.get_app_param('1000','run_type'); END;


    *
    ERROR on line 1:
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in the call to 'GET_APP_PARAM '.
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored



    Any help will be appreciated with more recognition.

    It's interesting.

    Package specification has "GET_APP_PARAM" with 2 parameters.
    The package body has "GET_APP_PARAM" with 3 settings.

    I tested this out case in my db. Oracle balk when the package body is compiled, but shows no errors.

    test@ORA10G> --
    test@ORA10G> DROP PACKAGE "APPLICATION_PACKAGE";
    
    Package dropped.
    
    test@ORA10G>
    test@ORA10G> drop table cc_app_param_detail;
    
    Table dropped.
    
    test@ORA10G> create table cc_app_param_detail (
      2    app_param_id    number(4),
      3    app_param_name  varchar2(20),
      4    app_param_value varchar2(20));
    
    Table created.
    
    test@ORA10G>
    test@ORA10G> insert into cc_app_param_detail
      2  select 1, 'name_1', 'value_1' from dual union all
      3  select 2, 'name_2', 'value_2' from dual union all
      4  select 3, 'name_3', 'value_3' from dual;
    
    3 rows created.
    
    test@ORA10G> commit;
    
    Commit complete.
    
    test@ORA10G>
    test@ORA10G> select * from cc_app_param_detail;
    
    APP_PARAM_ID APP_PARAM_NAME       APP_PARAM_VALUE
    ------------ -------------------- --------------------
               1 name_1               value_1
               2 name_2               value_2
               3 name_3               value_3
    
    test@ORA10G>
    test@ORA10G> --
    test@ORA10G> CREATE OR REPLACE PACKAGE "APPLICATION_PACKAGE" AS
      2    PROCEDURE GET_APP_PARAM (
      3      V_APP_PARAM_ID IN TEST.CC_APP_PARAM_DETAIL.APP_PARAM_ID%TYPE,
      4      V_APP_PARAM_NAME IN TEST.CC_APP_PARAM_DETAIL.APP_PARAM_NAME%TYPE);
      5  --    V_APP_PARAM_VALUE OUT NOCOPY TEST.CC_APP_PARAM_DETAIL.APP_PARAM_VALUE%TYPE);
      6  END;
      7  /
    
    Package created.
    
    test@ORA10G> show err
    No errors.
    test@ORA10G>
    test@ORA10G> DESC APPLICATION_PACKAGE
    PROCEDURE GET_APP_PARAM
     Argument Name                  Type                    In/Out Default?
     ------------------------------ ----------------------- ------ --------
     V_APP_PARAM_ID                 NUMBER(4)               IN
     V_APP_PARAM_NAME               VARCHAR2(20)            IN
    
    test@ORA10G>
    test@ORA10G>
    test@ORA10G> CREATE OR REPLACE PACKAGE BODY "APPLICATION_PACKAGE" AS
      2    PROCEDURE GET_APP_PARAM (
      3      V_APP_PARAM_ID    IN TEST.CC_APP_PARAM_DETAIL.APP_PARAM_ID%TYPE,
      4      V_APP_PARAM_NAME  IN TEST.CC_APP_PARAM_DETAIL.APP_PARAM_NAME%TYPE,
      5      V_APP_PARAM_VALUE OUT NOCOPY TEST.CC_APP_PARAM_DETAIL.APP_PARAM_VALUE%TYPE)
      6    AS
      7    BEGIN
      8      SELECT APP_PARAM_VALUE
      9      INTO V_APP_PARAM_VALUE
     10      FROM TEST.CC_APP_PARAM_DETAIL
     11      WHERE APP_PARAM_ID = V_APP_PARAM_ID
     12      AND APP_PARAM_NAME = V_APP_PARAM_NAME;
     13    END;
     14  END;
     15  /
    
    Warning: Package Body created with compilation errors.
    
    test@ORA10G> show err
    No errors.
    test@ORA10G>
    test@ORA10G>
    test@ORA10G> --
    test@ORA10G> var x varchar2(10)
    test@ORA10G> exec test.application_package.get_app_param(1,'name_1',:x);
    BEGIN test.application_package.get_app_param(1,'name_1',:x); END;
    
          *
    ERROR at line 1:
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'GET_APP_PARAM'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    
    test@ORA10G> print x
    
    X
    --------------------------------
    
    test@ORA10G>
    test@ORA10G>
    test@ORA10G> select object_type, object_name, status from user_objects where object_name='APPLICATION_PACKAGE';
    
    OBJECT_TYPE         OBJECT_NAME                    STATUS
    ------------------- ------------------------------ -------
    PACKAGE             APPLICATION_PACKAGE            VALID
    PACKAGE BODY        APPLICATION_PACKAGE            INVALID
    
    test@ORA10G>
    test@ORA10G>
    

    What do you see as the State of the art and the body when he is interviewed command-line SQL * more?

    The solution would be to add the third parameter to the package specification and recompile.

    HTH,
    isotope

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

  • Report of ColdFusion using stored procedures

    I have isntalled report 10 ColdFusion and connected to the RDS Server.

    I just saw tables and views, but not stored procedures.

    I would like to know it is possible to use stored procedures for the report data source.

    Your information and help is much appreciated,

    Kind regards

    Iccsi,

    Thank you fo rhelping and informaiton.

    I found that it supports the stored procedures,

    Kind regards

    iccsi

  • In numbers, I can't use then "/" operator to divide 2 cell, when I use may 7 does not appear "/", appear.

    In numbers, I can't use then ' / ' operator to divide 2 cell, when I use Shft + 7 does not appear "/", appear ' + '.

    Apple saw fit to replace the ' / ' with the Obelus ("÷") that often resembles a plus.  Look very carefully and you will see the point above and below the line.

    Also if you look at the result, 6/3 is 2 step 8 if the operator acted as the addition operator

  • Serial cable using IrDA protocol does not work correctly. Steve Stephens, * address email is removed from the privacy *.

    The difficulty it Center Microsoft said that my serial cable using IrDA protocol does not work properly.

    Appreciate any suggestions on how to solve this problem.

    Steve Stephens, * address email is removed from the privacy *.

    Hi, Steve Stephens.

    Did you run the fixit available in the link below?
    Hardware devices do not work or are not detected in Windows

    Method 1: Check for any error message in Device Manager

    When a device is not functioning, Device Manager also typically displays an error message with an error code that comes with it. First, search for errors in the Manager of devices to do this, follow the steps below:

    (a) open Device Manager by clicking the Start button, click on the Control Panel, clicking system and Maintenance, and then clicking Device Manager.

    (b) If you are prompted for an administrator password or a confirmation, type the password or provide confirmation.

    (c) in the Device Manager, find your device, and then double-click the device name.

    (d) If an error code has been generated, the code appears in the status area of the device under the general tab


    Method 2:
    download and install all available Windows Update

    Install Windows updates
    http://Windows.Microsoft.com/en-us/Windows-Vista/install-Windows-updates

    Method 3: Download and install SP2

    Learn how to install Windows Vista Service Pack 2 (SP2)
    http://Windows.Microsoft.com/en-us/Windows-Vista/learn-how-to-install-Windows-Vista-Service-Pack-2-SP2

  • If I buy a used PC that does not have an operating system or OS disc, still has the label of license for windows can download Microsoft windows?

    If I buy a used PC that does not have an operating system or OS disc, still has the label of license for windows can download Microsoft windows?

    N ° you must contact the manufacturer of the computer and asking for a disc of recovery/reinstallation of Windows. Carey Frisch

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

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

    Hello!

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

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

    Any idea will really help me.

    Thank you

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

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

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

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

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

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

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

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

    See also:

    Oracle database reference

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

  • Toshiba still WT8 - restore procedure does not work

    Hello

    I recently bought a Toshiba still wt8 with 2013 preinstalled office student.

    The desktop application will not install with different messages about problems arise.
    the last message says that it can not download because it is not connected to the internet, even if it is

    In the following advice on the setting of the installation of various forums, I now have a machine that needs to be reset.
    The road to restore installed does not work because it says that the files are missing.

    Ive created a recovery disk (possibly after you buy a micro USB key).
    but now when I try to use it, it indicates the recovery drive is not valid.

    I've had the unit for four days now and I have yet to be able to use for anything other than making circles of frustration.

    Can someone help before I completely lose my sanity?

    Thank you
    Nick Chablis

    Hello

    Usually you have two options to restore the system.

    (* 1) * you will need to create a recovery media and could use this recovery media to restore the system
    (* 2) * you can restore the software preinstalled from the recovery partition

    (* 1) * before using the recovery media (USB flash memory stick), it must create a. The recovery image is stored on the dedicated recovery partition. And can be copied to USB flash memory by following the steps.
    -Turn on tablet and allow it to load the Windows OS as usual
    -Insert the USB micro-USB port (do you need a micro USB cable USB converter) tab (under System Windows Apps view) Control Panel
    -tabs and system security-> action center-> recovery-> create a recovery disk
    -then you must follow the instructions on the screen to complete the recovery media

    To recover the system USB flash stick insert. Then put ON the table (charm settings-> power bar-> stop) after the tablet was turned off the POWER, wait 10 seconds, then press and hold the power button / stop and the volume button up until the start menu is loaded. Then use the volume up/down button to select the menu to your actual recovery media option and press the Windows button to confirm. Then a menu appears, where you must follow the on-screen instructions.

    (* 2) * the 2nd option of restore partition recovery is also possible.
    Stop the tablet. Press and hold the power button / stop and the volume button up until the start menu is loaded. Then select HARD drive recovery. Now press Yes, select troubleshoot, select Reset your PC and follow the instructions on the screen to complete the process

    Alternatively, you can perform the restore through laptop settings in the operating system. (parameters-> change PC settings-> update & Recovery-> recovery)

Maybe you are looking for

  • Where can I find download Mac OS Sierra on my iMac

    Where can I find the file to download Mac OS Sierra on my iMac? It took forever to download and I want to store for more security in case I get questions.

  • Trace of the 2 waveforms on the fly

    This should be very simple, but somehow, I can't get this to work. I have a vi that measures temperature, calculates a current on this basis and generates a new current. It is a PID regulation, basically. I would draw the T and I a of output on a cha

  • Iexplore.exe entry not found

    I just did a restore on my windows xp system and am now trying to run the feature update for windows, but I can't go on the internet.  I just get this error. the procedure entry point setdlldirectoryw could not be found in the library of links Dynami

  • HP LaserJet M1005 MFP: keep initialization error printer... Error 50.0, a fuser problem

    Hello I get an error of 50.0 error when printing on the printer. The LED display keeps showing 'initialization' instead of 'Ready' So what equipment I need to replace? What would be the cost? And my warranty expired.

  • Impossible to format the c drive

    I have a bad virus, bot or what ever that has taken possession of my PC... I am is no longer able to format drive C. I m made three clean installations of the operating system. This was done by train to get rid of the problem. This 'thing' wise very