How to reference LEVEL in a TREE's SQL code

Is it possible to somehow reference LEVEL in a tree's sql code so that you can use a decode statement to selectively create links on specific levels only i.e. NOT on the root level?
e.g.
select "CHILD_ID" id,
"PARENT_ID" pid,
"NAME" name,
decode( LEVEL, 1, null,'f?p=' || :APP_ID || ':43:' || :APP_SESSION || '::::P43_CHILD_ID:' || CHILD_ID) link,
null a1,
null a2
from TREETABLE
order by name
one solution I've implemented is to create a DB function e.g.
create or replace function get_tree_level(v_child_id number) return number
is
v_level number(2);
begin
select level
into v_level
from TREETABLE
where child_id=v_child_id
start with child_id=1
connect by prior child_id= parent_id;
return v_level;
end;
and then use
decode( get_tree_level(child_id) 1, null,'f?p=' || :APP_ID || ':43:' || :APP_SESSION || '::::P43_CHILD_ID:' || CHILD_ID) link,
but this is too slow as I have quite a few records in the tree and takes too long to render
regards
Paul P

OK I found a workaround after reading
How to add URL to tree
The view my tree is build on is constructed out of 3 unions and 4 "selects" ( the first select creates the ROOT NODE where "1" is also used as a hard coded foreign key (Parent_id), in the company table.)
I just added a new column called tree_level to the query which is hard coded wrt its level on the hierarchy.
e.g.
CREATE OR REPLACE FORCE VIEW COMCONSTUTREE ("CHILD_ID", "PARENT_ID", "NAME","TREE_LEVEL") AS
select 1 as child_id,to_number(null) as parent_id ,'Company' as name,*1 as tree_level* from dual
UNION
select COM_ID, 1, COM_NAME,2
from company
UNION
select CON_ID,CON_COMPANY_ID, substr(con_name,instr(con_name,' ')+1) ||', '||substr(con_name,1,instr(con_name,' ')-1),3
from contact
UNION
select STU_ID,STU_CONTACT_ID, STU_LAST_NAME||', '||STU_FIRST_NAME ,4
from student;
the tree code now becomes
select "CHILD_ID" id,
"PARENT_ID" pid,
"NAME" name,
decode( tree_level,1, null,'f?p=' || :APP_ID || ':43:' || :APP_SESSION || ':TREE:::P43_CHILD_ID:' ||CHILD_ID) link,
null a1,
null a2
from COMCONSTUTREE"
order by name

Similar Messages

  • How to retrieve the current User using PL_/SQL code?

    Hi,
    How can find the current logged user within a Dynamic Page using PL/SQL code?
    Thanks.

    Hi,
    There is a function wwctx_api.get_user which returns the logged in user. You can use this in your plsql code.
    Thanks,
    Sharmila

  • How to reference dynamic parameters in the PL/SQL script

    The meaning of dynamic parameter is the position and name of parameters will be changed based on the data structure of a referenced text file reading by the concerned PL/SQL script. Anybody can post a sample code will be very appreciated.

    The SQL and PL/SQL discussion forum is a good source for this kind of information.
    The URL is:
    PL/SQL

  • How to reference the rectangle box object in my code?

    I have to do some code migration from 16 bit Apps (Forms on
    Win3.1) to 32 bit apps(Forms on WinNT).For this migration i made
    a form for generation all the form in one shot . it's working
    fine. but it's giving me scroll bar in each form. we used
    rectangle box in most of the form and as u know i can not reffer
    rectangle box in programming.so i am not able to resize that. Is
    there any way so that i can refer that object programatically and
    can resize it.
    null

    shilpesh (guest) wrote:
    : I have to do some code migration from 16 bit Apps (Forms on
    : Win3.1) to 32 bit apps(Forms on WinNT).For this migration i
    made
    : a form for generation all the form in one shot . it's working
    : fine. but it's giving me scroll bar in each form. we used
    : rectangle box in most of the form and as u know i can not
    reffer
    : rectangle box in programming.so i am not able to resize that.
    Is
    : there any way so that i can refer that object programatically
    and
    : can resize it.
    Shilpesh,
    Please appreciate that this discussion forum is for Reports 6i
    Beta ONLY, as is also mentioned on the first page on the forum.
    Hence we will not be able to address this question .
    Regards
    The Oracle Reports Team
    null

  • How to reference template substitution string in PL/SQL condition

    hi -- I need to conditionally display an item based on the value of #TITLE#. I'm currently trying a pl/sql expression function body returning boolean
    DECLARE
    page_type VARCHAR2(1000);
    BEGIN
    page_type := lower(substr(:TITLE,instr(:TITLE,'Query')));
    if (page_type = 'query') then
    return TRUE;
    else
    return FALSE;
    end if;
    END;
    There are no errors, but the condition is not being met when it should be.
    I tried setting some app items to the value of #TITLE# and I'm obviously not referencing it correctly; they're all null:
    :TEST_VALUE := &TITLE.;
    :TEST_VALUE2 := :TITLE;
    :TEST_VALUE3 := V('TITLE');
    Help?
    Thanks,
    Carol

    Hi,
    You can use javascript on page HTML header
    <script>
    function getDocTitle(pItem){
      $x_Value(pItem, document.title);
    </script>And page body
    onload=" getDocTitle('Px_YOUR_ITEM');"Br, Jari

  • How to get SAP application language only with SQL code

    Hi all,
      is there a way to get the current language only whith a sql query on the Database?
    I know that Ican find that information from the Application object of the UI Api but in this case i can't access them.
    Thanks in advance, Luca.

    Hello
    You cannot get the Application language (GUI Language) from SQL, because it is stored on the client machine filesystem
    Location is defined in
    C:\Program Files\SAP\SAP Business One\Conf\b1-config-path.txt text file, which by defaulf is:
    %USERPROFILE%\Local Settings\Application Data\SAP\SAP Business One\b1-current-user.xml file
    Regards
    J.

  • How can one keep a history of PL/SQL code changes?

    Hello All,
    I am trying to execute the following code found at
    http://www.orafaq.com/faqplsql.htm#HIST
    CREATE OR REPLACE TRIGGER change_hist -- Store code in hist table
    AFTER CREATE ON OPERADWOWNER.SCHEMA -- Change SCOTT to your schema name
    DECLARE
    BEGIN
    if DICTIONARY_OBJ_TYPE in ('PROCEDURE', 'FUNCTION',
    'PACKAGE', 'PACKAGE BODY', 'TYPE') then
    -- Store old code in SOURCE_HIST table
    INSERT INTO SOURCE_HIST
    SELECT sysdate, user_source.* FROM USER_SOURCE
    WHERE TYPE = DICTIONARY_OBJ_TYPE
    AND NAME = DICTIONARY_OBJ_NAME;
    end if;
    EXCEPTION
    WHEN OTHERS THEN
    raise_application_error(-20000, SQLERRM);
    END;
    It is giving the error
    6/14 PL/SQL: SQL Statement ignored
    9/31 PL/SQL: ORA-00904: "DICTIONARY_OBJ_NAME": invalid identifier
    I want to understand what is DICTIONARY_OBJ_NAME in the above given code.
    Regards

    It's supposed to be ora_dict_obj_type. This is one of many event attributes that we can interrogate in DDL triggers. You can find out more in the online docs.
    Cheers, APC

  • How to handle Duplication in records using PL/SQL Code

    Hi,
    I have table
    Table name: PM
    and with fields wo_no, wo_descr, pm_no, current_date
    wo_no is a Primary key.
    I am enter data in this table through loop (Many records at a time), when I press a Button. Data is as under in table.
    wo_no          wo_descr          pm_no          current_date
    1          cleaning the relays     2          12-DEC-04
    2          calibration           3      12-DEC-04
    Now the problem is that when I again press the button at second time on same time, the following data will be entered as
    wo_no          wo_descr          pm_no          current_date
    3          cleaning the relays     2          12-DEC-04
    4          calibration           3      12-DEC-04
    So this is not required, instead of this when I press the button second time a message will appear like “duplication of wo_descr, pm_no in same date”
    I am using form 6i, please send me the code on urgently basis.
    Best Regard,
    Shahzad

    Unique key (wo_descr + pm_no + current_date) on PM
    and then control the exception WHEN_DUP_VAL_ON_INDEX

  • How to create dynamic HTML page using PL/SQL code in APEX.

    hello,
    I am woking on one APEX application in which i want to create one dynamic HTML page on button press using PL/SQL code.
    Thanks

    It is possible to create HTML page with dynamic content. One way would be creating hidden field (e.g. P1_HTML on page 1) with dynamic HTML and on button click you redirect to page 2 and pass P1_HTML item value to item P2_HTML on page 2. On page you must have PL/SQL region. You can then render your dynamic HTML with code:
    htp.p(:P2_HTML);
    Don use APEX URL for passing HTML value. Problem and solution is described here: http://blog.trent-schafer.com/2011/04/03/dont-pass-string-parameters-in-the-url-in-apex-its-a-bad-idea/
    Edited by: MiroMas on 3.2.2012 3:20

  • How to run an external application from PL/SQL code?

    Hi,
    I want to call an application like "Notepad" from PL/SQL code in a Windows2000 server. Is there any way to do that?
    Thanks, best regards.
    Paulo.

    declare
    r varchar(4000);
    begin
    dbms_java.set_output(10000);
    system_util.runshell('sh /ora9/runBackup.sh', r);
    dbms_output.put_line(r);
    end;
    System_util package is
    CREATE OR REPLACE PACKAGE System_Util IS
    *System: Generic
    *Package Name: System_util
    *Description: This is an open source package which holds regular used
         * methods by developers and dba's.
    *Created by:         Rae Smith
    *Created Date:       27/06/2001
    *Notes: This ia an free open source package that holds no warranty and
    * therefore no-one connected to the development of this package
    * can be made reasponsible for any outcomes by it's use.
    MODIFICATION LOG**************************************************************
    *DETAILS                                    DATE          VERS          CHANGED BY
    *===============================================================================
    *Created                                 27-06-2001     1.0           Rae Smith
         /********************************* Public Methhods ***************************************/
         --- getDir returns the first directory value held in the init.ora file
         FUNCTION getDir RETURN VARCHAR2;
         --- getPrev.. returns the prevoise day from a gievn date
         FUNCTION getPrevSat(pDate IN DATE) RETURN DATE;
         FUNCTION getPrevSun(pDate IN DATE) RETURN DATE;
         FUNCTION getPrevMon(pDate IN DATE) RETURN DATE;
         FUNCTION getPrevTue(pDate IN DATE) RETURN DATE;
         FUNCTION getPrevWed(pDate IN DATE) RETURN DATE;
         FUNCTION getPrevThu(pDate IN DATE) RETURN DATE;
         FUNCTION getPrevFri(pDate IN DATE) RETURN DATE;
         --- isNumber returns TRUE or FALSE depending on a datatype passed
         FUNCTION isNumber(pnumber IN VARCHAR2) RETURN BOOLEAN;
         FUNCTION isNumber(pnumber IN NUMBER) RETURN BOOLEAN;
         FUNCTION isNumber(pnumber IN DATE) RETURN BOOLEAN;
         --- The writeFile allow you to write data to a file
         --- writeFile has 2 Versions
         --- v1 pass in the file name and the text to write to a file.
         --- v2 pass in the file name, dbms_sql.varhar2s object
         --- and the amount of rows to procces at a time
         --- This enables you to write to afile in batch mode
         PROCEDURE writeFile(pName IN VARCHAR2, pText IN VARCHAR2);
         PROCEDURE writeFile(pName IN VARCHAR2, pText IN DBMS_SQL.VARCHAR2S, pRows IN PLS_INTEGER);
         --- The appendFile methods allow you to append data to a file
    --- This also has the inteligents to create the file if ts does not exist.
         --- appendFile has 2 Versions
         --- v1 pass in the file name and the text to write to a file.
         --- v2 pass in the file name, dbms_sql.varhar2s object
         --- and the amount of rows to procces at a time
         --- This enables you to write to afile in batch mode
         PROCEDURE appendFile(pName IN VARCHAR2, pText IN DBMS_SQL.VARCHAR2S, pRows IN PLS_INTEGER);
         PROCEDURE appendFile(pName IN VARCHAR2, pText IN VARCHAR2);
         --- The clearFile clears the data from a file.
         PROCEDURE clearFile(pName IN VARCHAR2);
         --- checkSyntax is a quick syntax checker for sql statements the is a limit to
         --- the size used in the statement. If you have a error with
         --- a statement then pass in the statement watch as it displays
         --- the point where the error arose.
         PROCEDURE checkSyntax(pSql IN VARCHAR2);
         --- isEmpty this returns TRUE or FALSE
         FUNCTION isEmpty(pValue IN VARCHAR2) RETURN BOOLEAN;
         --- getTimeInMins returns the time in minutes for a specified date
         FUNCTION getTimeInMins (pDate IN DATE) RETURN NUMBER;
         --PROCEDURE get_time_in_mins (pDate IN DATE);
         --- incDate returns a specified date incremented by value
         FUNCTION incDate(pInc IN NUMBER DEFAULT .999999, pDate IN DATE DEFAULT SYSDATE) RETURN DATE;
         --- decDate returns a specified date decremented by value
         FUNCTION decDate(pInc IN NUMBER DEFAULT .999999, pDate IN DATE DEFAULT SYSDATE) RETURN DATE;
         --- getTime returns the time in milliseconds
         FUNCTION getTime RETURN NUMBER;
         --- daysDiff returns the amount of days between two values
         FUNCTION daysDiff(pHigh IN DATE, pLow IN DATE) RETURN NUMBER;
         --- difference returns the diffeence between two numbers always
         --- taking the lowest away from the highest
         FUNCTION difference(pAnum IN NUMBER,pBnum IN NUMBER)RETURN NUMBER;
         --- total returns the value of two numbers added together
         FUNCTION total(pAnum IN NUMBER, pBnum IN NUMBER)RETURN NUMBER;
         --- numberToWords returns the string for a number passed in
         FUNCTION numberToWords(pNumb IN NUMBER) RETURN VARCHAR2;
         --- runShell allows you to run operating commands from pl/sql
         --- Only available with 8i
         --- PROCEDURE runShell(pCmnd IN VARCHAR2, pErrMsg IN OUT VARCHAR2);
         /**************************** Public Vaiables *******************************/
         --- Public variable that holds the operating system directory
         --- that the can be written to from withing the database.
         vDir VARCHAR2(50);
    END;
    CREATE OR REPLACE PACKAGE BODY System_Util IS
         FUNCTION getDir RETURN VARCHAR2
         IS
         BEGIN
              RETURN vDir;
         EXCEPTION
              WHEN OTHERS THEN
                   dbms_output.put_line('ERROR...ERROR...System_Util.getDir');
                   RAISE;
         END getDir;
         /**** Private module to get the first directory for utl_file to use ****/
         PROCEDURE getDir
         IS
              CURSOR cDir(p1 IN VARCHAR2)
              IS
              SELECT DECODE(INSTR(value, ','), 0, value, SUBSTR(value, 1, INSTR(value, ',')-1)) dir
              FROM v$parameter
              WHERE name = p1;
         BEGIN
              FOR rDir IN cDir('utl_file_dir') LOOP
                   vDir := rDir.dir;
              END LOOP;
         EXCEPTION
              WHEN OTHERS THEN
                   dbms_output.put_line('ERROR...ERROR...System_Util.getDir');
                   RAISE;
         END getDir;
         FUNCTION getPrevDate(pDate IN DATE, pDay IN VARCHAR2) RETURN DATE
         IS
         BEGIN
              RETURN NEXT_DAY(pDate - 7, pDay);
         EXCEPTION
              WHEN OTHERS THEN
                   RAISE;
         END getPrevDate;
         FUNCTION getPrevSat(pDate IN DATE) RETURN DATE
         IS
         BEGIN
              RETURN getPrevDate(pDate, 'saturday');
         EXCEPTION
              WHEN OTHERS THEN
                   RAISE;
         END getPrevSat;
         FUNCTION getPrevSun(pDate IN DATE) RETURN DATE
         IS
         BEGIN
              RETURN getPrevDate(pDate, 'sunday');
         EXCEPTION
              WHEN OTHERS THEN
                   RAISE;
         END getPrevSun;
         FUNCTION getPrevMon(pDate IN DATE) RETURN DATE
         IS
         BEGIN
              RETURN getPrevDate(pDate, 'monday');
         EXCEPTION
              WHEN OTHERS THEN
                   RAISE;
         END getPrevMon;
         FUNCTION getPrevTue(pDate IN DATE) RETURN DATE
         IS
         BEGIN
              RETURN getPrevDate(pDate, 'tuesday');
         EXCEPTION
              WHEN OTHERS THEN
                   RAISE;
         END getPrevTue;
         FUNCTION getPrevWed(pDate IN DATE) RETURN DATE
         IS
         BEGIN
              RETURN getPrevDate(pDate, 'wednesday');
         EXCEPTION
              WHEN OTHERS THEN
                   RAISE;
         END getPrevWed;
         FUNCTION getPrevThu(pDate IN DATE) RETURN DATE
         IS
         BEGIN
              RETURN getPrevDate(pDate, 'thursday');
         EXCEPTION
              WHEN OTHERS THEN
                   RAISE;
         END getPrevThu;
         FUNCTION getPrevFri(pDate IN DATE) RETURN DATE
         IS
         BEGIN
              RETURN getPrevDate(pDate, 'friday');
         EXCEPTION
              WHEN OTHERS THEN
                   RAISE;
         END getPrevFri;
         FUNCTION isNumber(pNumber IN VARCHAR2) RETURN BOOLEAN
         IS
         BEGIN
              IF TO_NUMBER(pNumber)> 0 THEN
                   RETURN TRUE;
              ELSE
                   RETURN FALSE;
              END IF;
         EXCEPTION
              WHEN OTHERS THEN
                   RETURN FALSE;
         END isNumber;
         FUNCTION isNumber(pNumber IN NUMBER) RETURN BOOLEAN
         IS
         BEGIN
              IF TO_NUMBER(pNumber) > 0 THEN
                   RETURN TRUE;
              ELSE
                   RETURN FALSE;
              END IF;
         EXCEPTION
              WHEN OTHERS THEN
              RETURN FALSE;
         END isNumber;
         FUNCTION isNumber(pNumber IN DATE) RETURN BOOLEAN
         IS
         BEGIN
              IF TO_NUMBER(TO_CHAR(pNumber, 'YYYYMMDD')) > 0 THEN
                   RETURN TRUE;
              ELSE
                   RETURN FALSE;
              END IF;
         EXCEPTION
              WHEN OTHERS THEN
                   RETURN FALSE;
         END isNumber;
         PROCEDURE writeFile(pName IN VARCHAR2, pText IN VARCHAR2)
         IS
              vFtype utl_file.file_type;
         BEGIN
              vFtype := UTL_FILE.FOPEN(vDir, pName,'w');
              UTL_FILE.PUT_LINE(vFtype,pText);
              UTL_FILE.FCLOSE(vFtype);
         EXCEPTION
              WHEN OTHERS THEN
                   UTL_FILE.FCLOSE(vFtype);
                   RAISE;
         END writeFile;
         PROCEDURE writeFile(pName IN VARCHAR2, pText IN VARCHAR2, pFtyp IN OUT utl_file.file_type)
         IS
              vFtype utl_file.file_type;
         BEGIN
              vFtype := UTL_FILE.FOPEN(vDir, pName,'w');
              UTL_FILE.PUT_LINE(vFtype,pText);
              UTL_FILE.FCLOSE(vFtype);
         EXCEPTION
              WHEN OTHERS THEN
                   UTL_FILE.FCLOSE(vFtype);
                   RAISE;
         END writeFile;
         PROCEDURE writeFile(pName IN VARCHAR2, pText IN DBMS_SQL.VARCHAR2S, pRows IN PLS_INTEGER)
         IS
              vFtype utl_file.file_type;
              vText VARCHAR2(2000);
              vCnt BINARY_INTEGER;
              vRem BINARY_INTEGER;
              vRowcnt PLS_INTEGER := 0;
         BEGIN
              vRem := MOD(pText.COUNT, pRows);
              vFtype := UTL_FILE.FOPEN(vDir, pName, 'w');
              vCnt := pText.FIRST;
              LOOP
                   EXIT WHEN vCnt IS NULL;
              vRowcnt := vRowcnt + 1;
                   IF vCnt = pText.LAST THEN
                        vText := vText||pText(vCnt);
                        UTL_FILE.PUTF(vFtype,vText);
                        UTL_FILE.FFLUSH(vFtype);
                        vText := '';
                   ELSIF MOD(vCnt, pRows) = 0 THEN
                        vText := vText||pText(vCnt)||'\n';
                        UTL_FILE.PUTF(vFtype,vText);
                        UTL_FILE.FFLUSH(vFtype);
                        vText := '';
                   ELSIF vRowcnt = vRem THEN
                        vText := vText||pText(vCnt)||'\n';
                        UTL_FILE.PUTF(vFtype,vText);
                        UTL_FILE.FFLUSH(vFtype);
                   ELSE
                        vText := vText||pText(vCnt)||'\n';
                   END IF;
                   vCnt := pText.NEXT(vCnt);
              END LOOP;
              UTL_FILE.FCLOSE(vFtype);
         EXCEPTION
              WHEN OTHERS THEN
                   dbms_output.put_line('ERROR...ERROR...SYSTEM_UTIL.WRITE_FILE');
                   UTL_FILE.FCLOSE(vFtype);
                   RAISE;
         END writeFile;
         PROCEDURE appendFile(pName IN VARCHAR2, pText IN DBMS_SQL.VARCHAR2S, pRows IN PLS_INTEGER)
         IS
              vFtype utl_file.file_type;
              vText VARCHAR2(2000);
              vCnt BINARY_INTEGER;
              vRem BINARY_INTEGER;
              vMode VARCHAR2(2) := 'a';
              vRowcnt PLS_INTEGER := 0;
         BEGIN
              vRem := MOD(pText.COUNT, pRows);
              vFtype := UTL_FILE.FOPEN(vDir, pName, vMode);
              vCnt := pText.FIRST;
              LOOP
                   EXIT WHEN vCnt IS NULL;
                   vRowcnt := vRowcnt + 1;
                   IF vCnt = pText.LAST THEN
                        vText := vText||pText(vCnt);
                        UTL_FILE.PUTF(vFtype,vText);
                        UTL_FILE.FFLUSH(vFtype);
                        vText := '';
                   ELSIF MOD(vCnt, pRows) = 0 THEN
                        vText := vText||pText(vCnt)||'\n';
                        UTL_FILE.PUTF(vFtype,vText);
                        UTL_FILE.FFLUSH(vFtype);
                        vText := '';
                   ELSIF vRowcnt = vRem THEN
                        vText := vText||pText(vCnt)||'\n';
                        UTL_FILE.PUTF(vFtype,vText);
                        UTL_FILE.FFLUSH(vFtype);
                   ELSE
                        vText := vText||pText(vCnt)||'\n';
                   END IF;
                   vCnt := pText.NEXT(vCnt);
              END LOOP;
                   UTL_FILE.FCLOSE(vFtype);
         EXCEPTION
              WHEN UTL_FILE.INVALID_OPERATION THEN
                   IF vMode = 'a' THEN
                        writeFile(pName, pText, pRows);
                   ELSE
                        RAISE;
              END IF;
         WHEN OTHERS THEN
              dbms_output.put_line('ERROR...ERROR...SYSTEM_UTIL.APPENDFILE');
              UTL_FILE.FCLOSE(vFtype);
              RAISE;
         END appendFile;
         PROCEDURE appendFile(pName IN VARCHAR2, pText IN VARCHAR2)
         IS
              vFtype utl_file.file_type;
              vMode VARCHAR2(2) := 'a';
         BEGIN
              vFtype := UTL_FILE.FOPEN(vDir, pName, vMode);
              UTL_FILE.PUTF(vFtype, pText);
              UTL_FILE.FFLUSH(vFtype);
              UTL_FILE.FCLOSE(vFtype);
         EXCEPTION
         WHEN UTL_FILE.INVALID_OPERATION THEN
         IF vMode = 'a' THEN
              writeFile(pName, pText);
         ELSE
              RAISE;
         END IF;
         WHEN OTHERS THEN
              dbms_output.put_line('ERROR...ERROR...SYSTEM_UTIL.APPENDFILE');
              UTL_FILE.FCLOSE(vftype);
              RAISE;
         END appendFile;
         PROCEDURE clearFile(pName IN VARCHAR2)
         IS
              vFtype utl_file.file_type;
              vText VARCHAR2(2000);
              vCnt BINARY_INTEGER;
              vRem BINARY_INTEGER;
              vRowcnt PLS_INTEGER := 0;
         BEGIN
              vFtype := UTL_FILE.FOPEN(vDir, pName, 'w');
              UTL_FILE.PUTF(vFtype,'');
              UTL_FILE.FFLUSH(vFtype);
              UTL_FILE.FCLOSE(vFtype);
         EXCEPTION
         WHEN OTHERS THEN
         dbms_output.put_line('ERROR...ERROR...System_Util.CLEARFILE');
         UTL_FILE.FCLOSE(vFtype);
         RAISE;
         END clearFile;
         PROCEDURE checkSyntax(pSql IN VARCHAR2)
         IS
         sqlCur PLS_INTEGER := DBMS_SQL.OPEN_CURSOR;
         errPos PLS_INTEGER;
         sqlStmt VARCHAR2(2000);
         BEGIN
              sqlStmt := pSql;
              DBMS_SQL.PARSE(sqlCur, sqlStmt, DBMS_SQL.NATIVE);
         EXCEPTION
              WHEN OTHERS THEN
                   errPos := DBMS_SQL.LAST_ERROR_POSITION;
                   DBMS_OUTPUT.PUT_LINE(SQLERRM);
                   DBMS_OUTPUT.PUT_LINE(sqlStmt);
                   DBMS_OUTPUT.PUT_LINE(' ');
                   DBMS_OUTPUT.PUT_LINE(LPAD('^', errPos, '-'));
                   DBMS_SQL.CLOSE_CURSOR(sqlCur);
         END checkSyntax;
         FUNCTION isEmpty(pValue IN VARCHAR2) RETURN BOOLEAN
         IS
         BEGIN
              IF pValue IS NULL OR pValue = '' OR pValue = ' ' THEN
                   RETURN TRUE;
              ELSE
                   RETURN FALSE;
              END IF;
         END isEmpty;
         FUNCTION getTimeInMins (pDate IN DATE) RETURN NUMBER
         IS
              vHours NUMBER;
              vMins NUMBER;
              vRetval PLS_INTEGER;
         BEGIN
              vHours := TO_NUMBER(TO_CHAR(pDate,'HH24'));
              vMins := TO_NUMBER(TO_CHAR(pDate,'MI'));
              vRetval := ((60 * vHours) + vMins);
              RETURN vRetval;
         EXCEPTION
              WHEN OTHERS THEN
                   RAISE;
         END getTimeInMins;
         PROCEDURE getTimeInMins (pDate IN DATE)
         IS
              vHours NUMBER;
              vMins NUMBER;
              vRetval PLS_INTEGER;
         BEGIN
              vHours := TO_NUMBER(TO_CHAR(pDate,'HH24'));
              vMins := TO_NUMBER(TO_CHAR(pDate,'MI'));
              vRetval := ((60 * vHours) + vMins);
              DBMS_OUTPUT.PUT_LINE('The time IN minutes IS: '||vRetval);
         EXCEPTION
              WHEN OTHERS THEN
                   RAISE;
         END getTimeInMins;
         FUNCTION incDate(pInc IN NUMBER DEFAULT .999999, pDate IN DATE DEFAULT SYSDATE) RETURN DATE
         IS
         BEGIN
         RETURN (TO_DATE(TO_CHAR(pDate + pInc, 'DD/MM/YYYY HH24:MI:SS'), 'DD/MM/YYYY HH24:MI:SS'));
         EXCEPTION
              WHEN OTHERS THEN
                   RAISE;
         END incDate;
         FUNCTION decDate(pInc IN NUMBER DEFAULT .999999, pDate IN DATE DEFAULT SYSDATE) RETURN DATE
         IS
         BEGIN
         RETURN (TO_DATE(TO_CHAR(pDate - pInc, 'DD/MM/YYYY HH24:MI:SS'), 'DD/MM/YYYY HH24:MI:SS'));
         EXCEPTION
              WHEN OTHERS THEN
                   RAISE;
         END decDate;
         FUNCTION getTime RETURN NUMBER
         IS
         BEGIN
              RETURN dbms_utility.get_time;
         END getTime;
         FUNCTION daysDiff(pHigh IN DATE, pLow IN DATE) RETURN NUMBER
         IS
              vHighdate DATE;
              vLowdate DATE;
         BEGIN
         IF pHigh > pLow THEN
                   vHighdate := TO_DATE(TO_CHAR(pHigh, 'YYYYMMDD'), 'YYYYMMDD');
                   vLowdate := TO_DATE(TO_CHAR(pLow, 'YYYYMMDD'), 'YYYYMMDD');
         ELSIF pLow > pHigh THEN
                   vHighdate := TO_DATE(TO_CHAR(pLow, 'YYYYMMDD'), 'YYYYMMDD');
                   vLowdate := TO_DATE(TO_CHAR(pHigh, 'YYYYMMDD'), 'YYYYMMDD');
         END IF;
              RETURN (vHighdate - vLowdate);
         EXCEPTION
              WHEN OTHERS THEN
                   RAISE;
         END daysDiff;
         PROCEDURE dateCheck(pDateFrom IN OUT DATE, pDateTo IN OUT DATE)
         IS
              /* Declare the variable to hold the "from" date */
              vDateFrom DATE;
         BEGIN
              /* If either date_from or date_to is null then set to todays date **
              ** using the sysdate **
              ** today's DATE AND IN the correct format */
              pDateFrom := NVL(pDateFrom, SYSDATE);
              pDateTo := NVL(pDateTo, SYSDATE);
              /* Check that the from date is not greater than the to date if so **
              ** use the system_util.incDate to Increment the date by 1 day */
              IF (pDateFrom > pDateTo) THEN
              vDateFrom := pDateFrom;
              pDateTo := System_Util.incDate(1, vDateFrom);
              END IF;
         EXCEPTION
              WHEN OTHERS THEN
              RAISE;
         END;
         /* calculates the difference of two numbers always taken the high from the low*/
         FUNCTION difference(pAnum IN NUMBER, pBnum IN NUMBER)RETURN NUMBER
         IS
              vTotal NUMBER;
         BEGIN
              IF (pAnum > pBnum )OR (pAnum = pBnum)THEN
                   vTotal := (pAnum - pBnum);
              ELSIF (pAnum < pBnum) THEN
                   vTotal := (pBnum - pAnum);
              END IF;
              RETURN (vTotal);
         EXCEPTION
              WHEN OTHERS THEN
                   RAISE;
         END difference;
         /* calculates the Total of two numbers*/
         FUNCTION total(pAnum IN NUMBER, pBnum IN NUMBER)RETURN NUMBER
         IS
              vTotal NUMBER;
         BEGIN
              vTotal := (pAnum + pBnum);
         RETURN (vTotal);
         EXCEPTION
              WHEN OTHERS THEN
                   RAISE;
         END total;
         FUNCTION numberToWords(pNumb IN NUMBER) RETURN VARCHAR2
         IS
              vRetval VARCHAR2(255);
              vNumb PLS_INTEGER;
         BEGIN
              vNumb := pNumb;
              vRetval := REPLACE(TO_CHAR(TO_DATE(vNumb,'j'),'jsp'),'-',' ');
              RETURN (vRetval);
         EXCEPTION
              WHEN OTHERS THEN
              RAISE;
         END;
    /*************** Only Available on 8i ********************************\
         FUNCTION Catcherr(pStr IN VARCHAR2) RETURN VARCHAR2
         IS
              LANGUAGE JAVA
              NAME 'catchErr.run(java.lang.String) return String';
         PROCEDURE runShell(pCmnd IN VARCHAR2, pErrMsg IN OUT VARCHAR2)
         IS
         BEGIN
              pErrMsg := Catcherr(pCmnd);
         EXCEPTION
         WHEN OTHERS THEN
              RAISE;
         END runShell;
    BEGIN
    getDir;
    END;

  • How to trace pl/sql code version over time

    Hi,
    As there are many pl/sql developers in the office I work in, we're thinking about how to mantain the old versions of pl/sql code and, above all, to forbid two different programmes to work on the same code at the same time.
    I've been told we could use Subversion (http://subversion.apache.org/) also for pl/sql
    What do you generally use for this target? Do you use Subversion or what else?
    Thanks in advance!

    Mark1970 wrote:
    As there are many pl/sql developers in the office I work in, we're thinking about how to mantain the old versions of pl/sql code and, above all, to forbid two different programmes to work on the same code at the same time.
    I've been told we could use Subversion (http://subversion.apache.org/) also for pl/sql
    What do you generally use for this target? Do you use Subversion or what else?We use Subversion and have been for many years (used CVS prior to that).
    PL/SQL code is no different than Java code, C/C++ code, or any other code. So why should using a version control system like Subversion be used any differently (or not work correctly) for PL/SQL code?

  • How to traverse level by level in tree

    Wondering if there were any suggestions on how to efficiently traverse through a tree level by level.
    Here is my code for creating the tree.
    public static void main(String[] args)
              String userInput = "";
              StringTokenizer tokenizedUserInput;
              int numAdd = 0;
              STree<Integer> completeTree = new STree<Integer>();
              Scanner keyboard = new Scanner(System.in);
              System.out.println("Enter values for tree: ");
              userInput = keyboard.nextLine();
              tokenizedUserInput = new StringTokenizer(userInput, ", ");
              while (tokenizedUserInput.hasMoreTokens())
                 numAdd = Integer.parseInt(tokenizedUserInput.nextToken());
                 completeTree.add(numAdd);             
            } 

    I have found a method to traverse through the tree level by level but it takes in a parameter of a node. I'm
    not sure how to take my tree and pass it through the method. Here is the method:
    public static <T> String levelByLevel(TNode<T> t)
              LinkedQueue<TNode<T>> q = new LinkedQueue<TNode<T>>();
              TNode<T> p;
              String s = "";
              q.push(t);
              while(!q.isEmpty())
                   p = q.pop();
                   s += p.nodeValue + " ";
                   if(p.left != null)
                        q.push(p.left);
                   if(p.right != null)
                        q.push(p.right);
              return s;
    }

  • How to reference the value of a af:inputText at View level in a java clas

    How to reference the value of a <af:inputText> at View level in a java class at Model level? Thanks!

    Create AppModuleImpl class and create ther for example setMyParam procedure.
    (You can use AppModule. There simple interface to do this classes
    In JDev 11:
    1. Go to AppModule and in Java bookmark generate application module class.(AppModuleImpl.java)
    2. Put "private String myParam;" and method to access myParam "public void setMyParam(String myParam)".
    3. Again in the AppModule in the Java bookmark add method to client interface.
    AppModuleImpl.java
    public class AppModuleImpl extends ApplicationModuleImpl implements AppModule {
    * This is the default constructor (do not remove).
    private String myParam;
    public AppModuleImpl() {
    //this.
    public void prepareSession(Session session)
    super.prepareSession(session);
    myParam = myParam + myParam;
    public void setMyParam(String myParam) {
    this.myParam = myParam;
    prepareSession(getSession());
    AppModule.java
    public interface AppModule extends ApplicationModule {
    void setMyParam(String myParam);
    AppModuleClient.java
    public class AppModuleClient extends ApplicationModuleImpl implements AppModule {
    * This is the default constructor (do not remove).
    public AppModuleClient() {
    public void setMyParam(String myParam) {
    Object _ret =
    this.riInvokeExportedMethod(this,"setMyParam",new String [] {"java.lang.String"},new Object[] {myParam});
    return;
    And you can use method setMyParam as you wish :))) You can find it in AppModuleDataControl..
    Edited by: Victor_V_S on Jun 5, 2009 1:31 AM
    Edited by: Victor_V_S on Jun 5, 2009 1:33 AM
    Edited by: Victor_V_S on Jun 5, 2009 7:30 AM

  • How to reference the Parent view Object attribute in Child View object

    Hi , I have the requirememt to generate Tree like struture to display Salary from joining date to retirement date in yearly form.I have writtent two Pl/SQL function to return parent node and child nodes(based on selected year).
    1.First function --> Input paramter (employee id, retirement date , joining date) --> return parent node row with start_date and end_date
    2. 2nd function --> input paarmter(employee id, startDate, end_date) --> return child node based on selected parent node i.e. start date and end date
    I have created two ADF view object based on two function return
    Parent Node --> select * from Table( EUPS.FN_GET_CONTR_SAL_BY_YR(employeeId,retirement Date, dateOf joining)) ;
    Child Node --> select * FROM TABLE( EUPS.FN_GET_CONTR_SAL_FOR_YEAR( employeId,startDate, endDate) ) based on selected parent node.
    I am giving binding variable as input for 2nd function (child node) . I don't know how to reference the binding variable value in child view from parent view.
    Like I have to refernce employeId,startDate, endDate values in 2nd function from parent view object. some thing like parentNode.selectedStart_date parentNode.employeeId.
    I know we can achive this writing the code in backing bean.But i want to know how can we refernce parent view object attribute values in child view object using Groovy or otherway?
    I will appreciate your help.
    Thanks

    I have two view com.ContractualSalaryByYearlyView for Parent Node and com.ContractualSalaryByYearlyView for child Node.
    I have created view link(ContractualSalYearlyByYearViewLink) betweem two view by giving common field empId, stDate , endDate.(below is the view link xml file).
    I tried give the binding attribute values using parent object reference like below in com.ContractualSalaryByYearlyView xml file but getting error
    Variable ContractualSalaryByYearlyView not recognized.I think i am using groovy expression.
    Thanks for quick response.
    com.ContractualSalaryByYearlyView xml
    <ViewObject
    <DesignTime>
    <Attr Name="_isExpertMode" Value="true"/>
    </DesignTime>
    <Variable
    Name="empId"
    Kind="where"
    Type="java.lang.Integer">
    <TransientExpression><![CDATA[adf.object.ContractualSalaryByYearlyView.EmpId]]></TransientExpression>
    </Variable>
    ContractualSalYearlyByYearViewLink.xml file
    <ViewLinkDefEnd
    Name="ContractualSalaryByYearlyView"
    Cardinality="1"
    Owner="com.ContractualSalaryByYearlyView"
    Source="true">
    <DesignTime>
    <Attr Name="_finderName" Value="ContractualSalaryByYearlyView"/>
    <Attr Name="_isUpdateable" Value="true"/>
    </DesignTime>
    <AttrArray Name="Attributes">
    <Item
    Value="com.ContractualSalaryByYearlyView.EmpId"/>
    <Item
    Value="com.ContractualSalaryByYearlyView.StDate"/>
    <Item
    Value="com.ContractualSalaryByYearlyView.EndDate"/>
    </AttrArray>
    </ViewLinkDefEnd>
    <ViewLinkDefEnd
    Name="ContractualSalaryForYearView"
    Cardinality="-1"
    Owner="com.ContractualSalaryForYearView">
    <DesignTime>
    <Attr Name="_finderName" Value="ContractualSalaryForYearView"/>
    <Attr Name="_isUpdateable" Value="true"/>
    </DesignTime>
    <AttrArray Name="Attributes">
    <Item
    Value="com.ContractualSalaryForYearView.EmpId"/>
    <Item
    Value="com.ContractualSalaryForYearView.StDate"/>
    <Item
    Value="com.ContractualSalaryForYearView.EndDate"/>
    </AttrArray>
    </ViewLinkDefEnd>

  • Change an attribute value in the last level of a tree

    Hi,
    I'm using jdev 11.1.1.0.1
    I have a tree composed of 5 VO. Each VO represent a level of the tree. I made an "executeWithParam" in my VO level 1 to pass some parameters.
    I would like to make a "setAttribute" on my VO level 5. I'm working with a tree, so i can't do : "getMyVo.getCurrentRow.setAttribute..."
    How can i do?
    ideas :
    - Today, i use bind variable to pass parameters from first level VO to last level VO : can i put the bind variable value in an attribute value?
    - Is there a method to override in the viewRowImpl.java to catch the "setAttributeInternal" made by ADF? so i could change the value of this attribute
    - Is there a method to override in the viewImpl.java which can help me?
    I try a lot of think without success... hope someone can help me
    Thanks in advance
    Clément

    Hi Frank,
    Thanks for your help.
    My need is to initialize all the rows of my VO level 5. Not only the selected ones. But i keep your solution for later :)
    Today, that is what i'm doing :
    - First, i use "executeWithParam" to complete a bind parameter of the first VO.
        public void executeWithParamTreeNiv1() {
            VoLvl1ViewImpl view =
                (VoLvl1ViewImpl) getLvl1View ();
            VoSourceId rowSrc =
                (VoSourceIdRowImpl) getVoSourceIdView().getCurrentRow();
            if (rowSrc != null) {
                saisPrevTreeView.setFkId(rowSrc.getId());
        }- Then, i use the method "createViewLinkAccessorRS" of the viewImpl, to pass bindParmeters between VOs.
            protected ViewRowSetImpl createViewLinkAccessorRS(AssociationDefImpl assocDef, ViewObjectImpl accessorVO,
                                                          Row masterRow, Object[] values) {
            ViewRowSetImpl v = super.createViewLinkAccessorRS(assocDef, accessorVO, masterRow, values);
            Number fkId = (Number)((ViewRowImpl)masterRow).getViewObject().getNamedWhereClauseParam("FkId");
            accessorVO.setNamedWhereClauseParam("FkId", fkId );
            v.setNamedWhereClauseParam("FkId", fkId );- Finally, i use the method "isAttributeUpdateable" of my VO level 5, to get the bind parameter and make a setAttribute.
        @Override
        public boolean isAttributeUpdateable(int i) {
            Number fkId= (Number)this.getViewObject().getNamedWhereClauseParam("FkId");
            if (fkId!= null) {
                this.setFkId(fkId);
        }What do you think about this method?
    Thanks
    Clément

Maybe you are looking for

  • Polling interval in file adapter.

    Hi, I have a doubt regarding the file adapter polling interval. Suppose we get a file of size 512 MB and PI file adapter taking long time (say 15 Min) to process it, we have a polling interval of 10 min. I have a 2 doubt in this case. 1. what will ha

  • How to add the value of the two text boxes in the 3rd text box in ssrs table?

    Hi , in my ssrs table i encountered a situation where i need to computing for the two text box values and i have to show that value in page header. for example i have to add the textbox9 value and textbox12 value then i have to show that value in the

  • How do I upload my contacts, calendar and notes from outlook 2007 to my new iPad with retina display

    I just cleaned up my outlook 2007 contact files. I have an iPhone 5, a new iPad with retina display, and a PC, which is where the outlook program is. I also have an iCloud account How do I get the contacts, calendar and notes from outlook to any of t

  • SAP HR Authorisation

    Where would authorisation amount be stored in HR. i.e i need to extract from HR whether a user has the correct authorisation to approve a workflow based on the users amount e.g if i have an invoice for $500,000 and the user is only able to approve in

  • Type on a path ignores text wrap around objects?

    Indesign CS3: type on a path ignores text wrap around objects? is this true? or do I have a setting that I'm missing? thanks.