Syntax for the existing index based on a function

Hello:

I'm on 10.2.0.3.

Below is the list of indexes and the columns in the index on one of the tables. Aparantly one of the columns (SYS_NC00220$) is actually a function-based index.

Anyone know how to get the SQL syntax for this index? TIA.

INDEX_NAME UNIQUENES COLUMN_NAME POSITION_COLONNE
------------------------------ --------- ------------------------------ ---------------
PS0BI_HDR not BILL_TO_CUST_ID 1
PS0BI_HDR don't BUSINESS_UNIT 2
PS0BI_HDR only SYS_NC00220$ 3
PS1BI_HDR not BILL_STATUS 1
PS1BI_HDR don't BUSINESS_UNIT 2
PS1BI_HDR only SYS_NC00220$ 3
PS2BI_HDR not CONTRACT_NUM 1
PS2BI_HDR don't BUSINESS_UNIT 2
PS2BI_HDR only SYS_NC00220$ 3
NON-UNIQUE PSABI_HDR BILL 1
PSABI_HDR don't BILL_TO_CUST_ID 2
PSABI_HDR don't BUSINESS_UNIT 3
PSABI_HDR not BILL_STATUS 4
UNIQUE PROCESS_INSTANCE PSBBI_HDR 1
UNIQUE BUSINESS_UNIT PSBBI_HDR 2
INVOICE SINGLE PSBBI_HDR 3
UNIQUE BUSINESS_UNIT PS_BI_HDR 1
UNIQUE SYS_NC00220 PS_BI_HDR $ 2

query user_ind_expressions and search for COLUMN_EXPRESSION.

This will give you an expression.

Tags: Database

Similar Questions

  • Check for the existing index

    I'm a DBA working with 3 application developers, they want to know how to check for existing indexes for some columns
    in a table in their schema.

    a friend told me to check the existing index for some column you have to query
    view dba_ind_columns so you must be a sysdba user

    but I don't want to give the developers of the application of the privilege sysdba

    but my friend told me, to avoid sysdba grant for application developers, they can query the user_indexes view in their scheme, but after watching the user_indexes view,.

    It gives me a lot of data but does not give me the NAME of COLUMN

    How can I solve this problem, which is:

    Let application developers check existing indexes for some columns in their schema without granting them sysdba privilege.

    user_ind_columns

  • Invalidation of the index based on a function because the recompilation

    Hello

    one of our customers has two indices according to the functions that fall under the State "off" in some situations. After looking more closely at the situation, there are some things that my opinion are different from what I expected of a function-based index. Because I am unable to find anything about either on metalink (or I'm not asking the right question) I would appreciate a second opinion of you.

    To keep things simple, I gave an example to illustrate the behavior. I use Oracle 12.1.0.2, although it can also be reproduced on versions 10.2 and 11.2.

    It's my environment and three parameters that I find relevant to the discussion:

    SQL> select banner from v$version;
    
    BANNER
    ----------------------------------------------------------------------------
    
    Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
    PL/SQL Release 12.1.0.2.0 - Production
    CORE    12.1.0.2.0      Production
    TNS for Linux: Version 12.1.0.2.0 - Production
    NLSRTL Version 12.1.0.2.0 - Production
    
    SQL> show parameter remote_dependencies
    
    NAME                                 TYPE        VALUE
    ------------------------------------ ----------- ----------
    remote_dependencies_mode             string      TIMESTAMP
    
    SQL> show parameter query_rewrite
    
    NAME                                 TYPE        VALUE
    ------------------------------------ ----------- -------------
    query_rewrite_enabled                string      TRUE
    query_rewrite_integrity              string      enforced
    

    Test case:

    SQL> CREATE OR REPLACE FUNCTION f1 (p_string IN VARCHAR2)
      2  RETURN VARCHAR2
      3  DETERMINISTIC
      4  IS
      5  BEGIN
      6    RETURN lower(p_string);
      7  END f1;
      8  /
    
    Function created.
    
    SQL> CREATE TABLE tmp_t1 (a_string VARCHAR2(10));
    
    Table created.
    
    SQL> INSERT INTO tmp_t1 VALUES ('a');
    
    1 row created.
    
    SQL> COMMIT;
    
    Commit complete.
    
    SQL> CREATE INDEX x1_tmp_t1 ON tmp_t1(f1(a_string));
    
    Index created.
    
    SQL> set linesize 80;
    SQL> column index_name format a10;
    SQL> SELECT index_name, index_type, status, funcidx_status
      2    FROM user_indexes;
    
    INDEX_NAME INDEX_TYPE                  STATUS   FUNCIDX_
    ---------- --------------------------- -------- --------
    X1_TMP_T1  FUNCTION-BASED NORMAL       VALID    ENABLED
    

    We have our table and our based on an index function which basically converts the values to lowercase. From here on things, download a little weird. What happens with the index based on a function if the underlying function is recompiled? I always thought (and which is also stated in the Concepts and the use of function index (Doc ID 66277.1)) that the index would change its status to "disabled". Here is an excerpt of the said Doc ID:

    The index depends on the State of the PL/SQL function. The index can be

    struck down or rendered useless by changes to the function. The index is marked

    People with DISABILITIES, if he is brought to the function or function is re-created.

    The timestamp of the function is used to validate the index.

    To allow the index after it is created, the function if the signature of the

    the function is identical to the front:

    ALTER INDEX ENABLE;

    If the signature of functions is changed, to make the changes effective

    in the index, the index must be renewed to make it valid.

    ALTER INDEX REBUILD.

    It seems that this is not the case, as the index remains valid and activate.

    SQL> alter function f1 compile;
    
    Function altered.
    
    SQL> SELECT index_name, index_type, status, funcidx_status
      2    FROM user_indexes;
    
    INDEX_NAME INDEX_TYPE                  STATUS   FUNCIDX_
    ---------- --------------------------- -------- --------
    X1_TMP_T1  FUNCTION-BASED NORMAL       VALID    ENABLED
    

    OK, explicitly recompiling function F1 single timestamp changed. What if we replace the function completely and we change the output of the function - for example we will switch from a LOWER function to SUPERIOR function in the body of the F1. Again, it is change that I thought would be not only to disable the index based on a function, but also force its reconstruction. At least that is my understanding of the explanation in Doc ID).

    SQL> CREATE OR REPLACE FUNCTION f1 (p_string IN VARCHAR2)
      2  RETURN VARCHAR2
      3  DETERMINISTIC
      4  IS
      5  BEGIN
      6    RETURN UPPER(p_string);
      7  END f1;
      8  /
    
    Function created.
    
    SQL> SELECT index_name, index_type, status, funcidx_status
      2    FROM user_indexes;
    
    INDEX_NAME INDEX_TYPE                  STATUS   FUNCIDX_
    ---------- --------------------------- -------- --------
    X1_TMP_T1  FUNCTION-BASED NORMAL       VALID    ENABLED
    
    

    Should not be. Because of the function "create or replace" F1 never go through a "invalid" phase which may be necessary for index becomes unusable? What about queries on the TMP_T1 table? Does optimizer always uses access index or not? What about the results?

    SQL> EXPLAIN PLAN SET statement_id='s1' FOR
      2  SELECT a_string, f1(a_string) as f1_a_string, f1('a') as f1_literal
      3    FROM tmp_t1
      4   WHERE f1(a_string) = 'a';
    
    Explained.
    
    SQL> SELECT * from table(dbms_xplan.display(statement_id=>'s1'));
    
    PLAN_TABLE_OUTPUT                                                                                                   
    ------------------------------------------------------------------------------------------------------------------------
    Plan hash value: 3133804460                                                                                         
                                                                                                                        
    -------------------------------------------------------------------------------------------------                   
    | Id  | Operation                           | Name      | Rows  | Bytes | Cost (%CPU)| Time     |                   
    -------------------------------------------------------------------------------------------------                   
    |   0 | SELECT STATEMENT                    |           |     1 |  2024 |     2   (0)| 00:00:01 |                   
    |   1 |  TABLE ACCESS BY INDEX ROWID BATCHED| TMP_T1    |     1 |  2024 |     2   (0)| 00:00:01 |                   
    |*  2 |   INDEX RANGE SCAN                  | X1_TMP_T1 |     1 |       |     1   (0)| 00:00:01 |                   
    -------------------------------------------------------------------------------------------------
    

    The index is used by the optimizer, see the results.

    SQL> column f1_a_string format a15;
    SQL> column f1_literal format a15;
    SQL> SELECT a_string, f1(a_string) as f1_a_string, f1('a') as f1_literal
      2    FROM tmp_t1
      3   WHERE f1(a_string) = 'a';
    
    A_STRING   F1_A_STRING     F1_LITERAL
    ---------- --------------- ---------------
    a          a               A
    

    A_STRING = value in the table

    F1_A_STRING = value of f1 (a_string) but the value is not evaluated because it comes from an index, so tiny value (remember, at the time index created the function returned small values)

    F1_LITERAL = value of the function f1 newly evaluated, using literal instead of the value in the table.

    Predicate f1 (a_string) = 'a' should return no rows because no character uppercase is equivalent to "a". Query with f1 (a_string) = 'A' should return a line, but it doesn't.

    SQL> SELECT a_string, f1(a_string) as f1_a_string, f1('a') as f1_literal
      2    FROM tmp_t1
      3   WHERE f1(a_string) = 'A';
    
    no rows selected
    

    Anyone know if this is an expected behavior? And, is it possible to disable the index based on a function whenever the underlying function signature is changed? The parameter query_rewrite_integrity = applied from

    DOC-ID 66277.1 does not seem to do the trick:

    (c) session variables

    ~~~~~~~~~~~~~~~~~~~~

    QUERY_REWRITE_ENABLED (true, false),

    QUERY_REWRITE_INTEGRITY (confidence, forced, stale_tolerated)

    determines the optimizer to use index based on a function with

    expressions using SQL, user defined functions functions.

    TRUST: Oracle allows rewrites using relationships that have

    was declared.

    APPLIED: Oracle ensures and guarantees consistency and integrity.

    STALE_TOLERATED: Oracle allows rewrites using vessels of the relationship not applied.

    Used in the case of materialized views.

    Set session variable cost function optimizer to choose the

    a function-based index

    Kind regards

    SAMO

    From the Manual 11.2 ( https://docs.oracle.com/cd/E11882_01/appdev.112/e41502/adfns_indexes.htm#ADFNS254 )

    "If you change the semantics of a DETERMINISTIC run and recompile, then you must manually rebuild all addicts depending on index and materialized views." Otherwise, they report results for the previous version of the function. »

    This note is not that I made my initial comment well - which was based on an incorrect memory the relationship between function-oriented and autonomous pl/sql functions, so I won't try to explain it. In fact, I went back to Oracle 8i practice to see if something had changed between yesterday and today and found that I had described exactly the behavior that the OP has been seeing. It's the way it is supposed to be.

    Concerning

    Jonathan Lewis

  • our company had Adobe CS 3, we ship adobe creative cloud member of more than 2 years now. How can I get credit for the existing customer.

    our company had Adobe CS 3, we ship adobe creative cloud member of more than 2 years now. But we must all credit for the existing customer.

    There is no current discount for loyal customers.  You must have missed the opportunity to get a discount at the end of May.  Before that if you were an owner of Creative Suite, you can get the first year at a reduced rate.

  • ORA-19030: invalid method for the schema not based XML Documents

    Hi everyone can u help me please when I am trying to execute query below his throw errror

    DECLARE

    doc xmltype.

    BEGIN

    SELECT

    XMLAGG (XMLElement ("employee",

    XMLAttributes)

                      ' http://www.Oracle.com/emp_simple.xsd ' AS 'xmlns',

                      ' http://www.w3.org/2001/XMLSchema-instance ' AS ' xmlns: xsi ",

                      ' http://www.Oracle.com/emp_simple.xsd

    http://www.oracle.com/emp_simple.xsd'

    AS "xsi: schemaLocation").

    XMLForest (e.employee_id LIKE "EmployeeId",

    Select AS "name."

    e.job_id AS "Job."

    e.manager_id "MANAGER."

    e.hire_date AS "Hire Date"

    e.Salary AS "wages."

    e.commission_pct AS 'The Commission',

    XMLForest)

    d.department_id AS "DeptNo."

    d.department_name AS "DeptName",.

    d.location_id AS 'Place') AS 'Dept')))

    in the doc

    E employees, departments d

    WHERE e.department_id = d.department_id;

    doc.schemaValidate ();

    END;

    /

    The error I get is following

    ORA-19030: invalid method for the schema not based XML Documents

    Yes, Odie meant something like that.

    
        
            
                
                    
                        
                            
                                
                                
                                
                                
                                
                                
                                
                                
                                    
                                        
                                            
                                            
                                            
                                        
                                    
                                
                            
                        
                    
                
            
        
    
    

    See how the employee node can now occur more than once in the employees node.

  • For the loop index rebuild

    DB version 10.2
     BEGIN
          FOR vIdxList IN (select INDEX_NAME from user_indexes where table_name in('PORT') and index_type='NORMAL')
          LOOP
       EXECUTE IMMEDIATE 'ALTER INDEX ' || vIdxList.INDEX_NAME || ' REBUILD nologging parallel 4 ';
          5      dbms_output.put_line('-----------------');
             --EXECUTE IMMEDIATE 'ALTER INDEX ' || vIdxList.INDEX_NAME || 'NOPARALLEL';
          END LOOP;
          begin
         FOR vIdxList IN (select INDEX_NAME from user_indexes where table_name in('PORT') and index_type='NORMAL')
         LOOP
         EXECUTE IMMEDIATE 'ALTER INDEX ' || vIdxList.INDEX_NAME || 'NOPARALLEL';
         end loop;
         end;
       END;
       /
    When I try to do more high I am hit with ORA-02242 after reconstitution with nologging parallel 4. But when I run manually
     ALTER INDEX'  <index_name> NOPARALLEL 
    then ok.

    Some can help me please

    ERROR on line 1:
    ORA-02242: no option specified for the ALTER INDEX statement
    ORA-06512: at line 11 level
    BEGIN
          FOR vIdxList IN (select INDEX_NAME from user_indexes where table_name in('EMPLOYEES') and index_type='NORMAL')
          LOOP
              EXECUTE IMMEDIATE 'ALTER INDEX ' || vIdxList.INDEX_NAME || ' REBUILD nologging parallel 4 ';
              EXECUTE IMMEDIATE 'ALTER INDEX ' || vIdxList.INDEX_NAME || ' NOPARALLEL ';
           END LOOP;
    END;
    / 
    
  • syntax for the compilation of the pll in oracle11i on windows files

    Hello

    What is the syntax for the compilation of files of pll in oracle11i?

    When executing pll, I got the below error

    E:\oracle\testappl\au\11.5.0\resource > f60gen module = CUSTOM.pll userid = apps/app0305apps output_file = CUSTOM.plx
    module_type = library package = no compile_all = special
    'f60gen' is not recognized as an internal or external command
    operable program or batch file.


    Thank you

    Regarding

    Umair

    Umair,

    I changed the fichier_de_sortie so I ran which command that was successful.

    It should work, but you must replace the original file, so enforcement is necessary.

    Means I have to stop application services (forms + Apache).

    Correct (mainly the forms).

    Kind regards
    Hussein

  • Using syntax for the 'If' statement in the query?

    Hi, I work at the end before the PS 9.2 via the request handler and need help

    What I want to do, it's a field of expression to create
    another field of expression that I can use to group on. Maybe the query like
    expressions based on expressions...? Maybe because I'm on an Oracle database, I need to use Decode? If so, how can I use decode?

    Details:

    The field I created Gets the length of the employee in
    service and it works very well

    MONTHS_BETWEEN (SYSDATE, A.SERVICE_DT) / 12

    It works as a character or a numeric field.

    This is the problem... The next field, I would like that the query is one that goes like this...

    IF ((MONTHS_BETWEEN(SYSDATE,A.SERVICE_DT)/12))
    < = 4.99, "minus 5"

    ELSE IF ((MONTHS_BETWEEN(SYSDATE,A.SERVICE_DT)/12)) > = 5 AND
    ((MONTHS_BETWEEN(SYSYDATE,A.SERVICE_DT)/12)) < = 9.99, "5 to 9".

    ELSE IF ((MONTHS_BETWEEN(SYSDATE,A.SERVICE_DT)/12)) > = 10 AND
    ((MONTHS_BETWEEN(SYSYDATE,A.SERVICE_DT)/12)) < = 14.99, '10 to 14', "15 and"
    More»

    I get an error message that "a SQL error has occurred. For more details, please see your system log. Error in running because the SQL query is 972. Message = ORA-00972 identifier is too long (50 380)

    Can you tell me what expression should I use? And please keep in mind that I do not have access to the SQL Developer, so I have to use the query. Thank you!... Mary



    I would recommend using BOX WHEN if you're on an Oracle database.  Something like:

    CASE WHEN ((MONTHS_BETWEEN(SYSDATE,A.SERVICE_DT)/12)) <=4.99 then="" 'less="" than="" 5'="" when="" ((months_between(sysdate,a.service_dt)/12))="">= 5 AND

    ((MONTHS_BETWEEN(SYSDATE,A.SERVICE_DT)/12)) <=9.99 then="" '5="" to="" 9'="" when="" ((months_between(sysdate,a.service_dt)/12))="">= 10 AND ((MONTHS_BETWEEN(SYSDATE,A.SERVICE_DT)/12))<=14.99 then="" '10="" to="" 14'="" else="" '15="" and="" over'="">

    You can find more on the syntax of the CASE on the Oracle's Web site:

    http://docs.Oracle.com/CD/B19306_01/AppDev.102/b14261/case_statement.htm

  • Check for the existing XML element

    Hi all

    I'm writing a simple script first check if an XML element exists and creating so if it's not. I tried to change a piece of code that I used previously to do the same for paragraph styles, but apparently it's not that simple. Currently, all I get is the error "Unable to run the script in the 'main' target engine!" Without checking them, adding the XML element based on the result of the search works very well.

    /* Find all instances of the word "Superscript" */
    app.findTextPreferences.findWhat = "Superscript";
    var mySuperscript = myDocument.findText(); // Save search result for future reference
    
    /* See if an XML element named "Superscript" already exists, and create it if that's not the case; then add it to all instances of the word "Superscript" */
    var myXMLElementSuper = myDocument.xmlElements.item("Superscript");
    try {
    var myName = myXMLElementSuper.name;
    }
    catch (myError){
        var myXMLElementSuper = myDocument.xmlElements.add({markupTag:"Superscript", xmlContent:mySuperscript[i]});}
    

    Any help would be greatly appreciated!

    Regards and thanks in advance.

    Julian

    The myDocument.xmlElements always has a single element - the root element.

    If you want your element directly below that, you have to work a level down.

    To try-catch for such situations regular aid is bad because you spend so usually the ESTK option stop on exceptions and real problems don't miss. Use the isValid property.

    var rootXE = myDocument.xmlElements.item(0);
    var superXE = rootXE.xmlElements.itemByName("Superscript");
    if( !superXE.isValid )
      superXE = rootXE.xmlElements.add(...
    else
     superXE = superXE.getElements()[0]; // take first of potentially multiple elements
    
  • The details of the max/min for the spatial index

    Hello

    I am new to Oracle Spatial and perhaps this is a stupid question, but when I create an index for a table of geo, I always manually insert a line into the USER_SDO_GEOM_METADATA table. The DIMINFO table contains the bounding box, which are in my case X min/max / coordinated full geo (Lat/Long) of the table.

    The SDO_GEOMETRY column in my table of geo contains some polygons. How can I automatically query the table of geo to return the desired max/min X / Y coordinates? I'm looking for something like maxX (geo_data) SELECT... OF geo_table. Is this possible?

    Thank you!

    Hello Hans,.

    Well, I think that the old gods of Oracle Spatial of ages had intended a workflow by which metadata records were filled with knowledge not stored in the database or the spatial column.  Thus, for example the tolerance whence?  He comes to your head or your documentation that you hold outside the database, etc..  I mean that you put in this recording in order to enter the database.  So I would say that generally metadata was never intended to be created from the data.

    Now, we must know that the values stored in USER_SDO_GEOM_METADATA min/max are largely informative to my knowledge.  You can insert values garbage if you love without worrying much Oracle Spatial.  The only function I can think of who actually reads these values is the MD without papers. HHENCODE (everyone knows others?).  But that being said its always a good idea to avoid the garbage and properly document your spatial layers.

    So, in terms of generation of these values. I would say that your DIMINFO values should ideally include the size of your current data more any new data you could insert as part of your workflow.  So I would not shake this until your min/max values accurate unless your data is very, very static.  It could well be.  Still, usually I if I had a layer of data to the United States mainland that the values that run in the South enough to cover all the Florida keys, etc. (with some tampons too).  Even if I have no data for Florida keys in that exact moment.  It's rather subjective, to deduce the data, it must come from your documentation and your needs.

    But you probably still want something.  Good then, voila.

    SELECT
    a.bef || a.dim_xy || a.dim_3 || a.aft AS dim_info
    FROM (
      SELECT
       'MDSYS.SDO_DIM_ARRAY(' AS bef
      ,'MDSYS.SDO_DIM_ELEMENT(''X'',' || MDSYS.SDO_GEOM.SDO_MIN_MBR_ORDINATE(aa.shape,1) || ',' || MDSYS.SDO_GEOM.SDO_MAX_MBR_ORDINATE(aa.shape,1) || ',0.05)'
       ||
       ',MDSYS.SDO_DIM_ELEMENT(''Y'',' || MDSYS.SDO_GEOM.SDO_MIN_MBR_ORDINATE(aa.shape,2) || ',' || MDSYS.SDO_GEOM.SDO_MAX_MBR_ORDINATE(aa.shape,2) || ',0.05)'
       AS dim_xy
      ,CASE
       WHEN aa.shape.get_dims() > 2
       AND  aa.shape.get_lrs_dim() = 0
       THEN
          ',MDSYS.SDO_DIM_ELEMENT(''Z'',' || MDSYS.SDO_GEOM.SDO_MIN_MBR_ORDINATE(aa.shape,3) || ',' || MDSYS.SDO_GEOM.SDO_MAX_MBR_ORDINATE(aa.shape,3) || ',0.001)'
       ELSE
          NULL
       END AS dim_3
      ,')' AS aft
      FROM (
         SELECT
         MDSYS.SDO_AGGR_MBR(a.shape) AS shape
         FROM
         my_table a
      ) aa
    ) a;
    

    Note again once the tolerances must be hard-coded.

    And also it will not work for the LRS geometries.

    I respect the old gods and not go this route.

    See you soon,.

    Paul

  • Eligibility for the benefits scheme based on participation in another plan

    We must control an eligibility of joint plan based on participation and registration to the scheme for the employees in the same program. Employee can if enter two plans at the same time, but we do need an audit that would not allow employees to enroll in an RRSP without registering under the plan. We must maintain these plans as each have their own insurance amounts because it is optional life insurance. If I use eligibility criteria then he is obliging used to be enrolled in the plan outlined before even the life event has been processed. Need help how to have the validation during registration? Any help is greatly appreciated.
    Thank you very much

    Hello

    See reference Guide Oracle FastFormula (FF) for Standard (OSB) and advanced benefits (OAB) (Doc ID 218059.1)
    Type of formula: election Post

    This could help you.

    Kind regards
    Aneesh N

  • OSDM support for the context index

    OSDM supports context indexes?
    I need create specific context with storage preference indexes etc.
    Please me know. (OSDM v3.0.0.665)

    Hello

    I suggest that you take care of the anonymous block using a separate out data maker script.

    BTW, I don't understand what you mean by 'set with the help of an Index Expression, rather than a list of columns'. can you please help us with that?

    When you add an Index (in the relational model), you can select the columns in the Index, or you can define the Expression of Index check box, that allows a column_expression to enter (so that the index becomes a 'a function-based index'). The column_expression may include references to columns in the table and the functions.

    David

  • [JS CS5.5] Sort order for the topic index messes up script

    I'm stumped on this one. If anyone has a suggestion, I would appreciate it!

    The following script iterates through my index and works very well if none of the index entries have "sort by" text that causes the entry down the list in alphabetical order. It works fine if the text ' sort by ' causes the index entry back into the list alphabetically.

    = CODE

    var myTopics = myDoc.indexes [0] .allTopics;

    for (var i = myTopics.length - 1; I > - 1; i--) {/ / for each subject index...}

    for (var j = myTopics [i].pageReferences.length - 1; j > - 1; j--) {/ / for each reference page in the topic...}

    var myAttributeValue = topic_path (myTopics [i], myTopics [i] .name);

    var myInsertionPoint is myTopics [i] [j] .pageReferences, .sourceText;. THIS LINE THROWS ERROR

    Do something at the insertion point.

    }

    }

    }

    Create the subject string. Subheadings are separated by "#".

    function topic_path (top, str) {}

    If (top.parent.constructor.name == 'Index') {}

    return str;

    }

    else {}

    Return topic_path (top.parent, top.parent.name + ', ' + str);

    }

    }

    = END OF CODE

    So it seems to me that given that the script is an iteration through the bottom-up index entries and page references, happens to a topic that is displayed below the list in, but it is actually "" upward earlier in the list alphabetically, so the script can not get corresponds to the page in the source text reference.

    Is it possible to iterate through index entries other than what I do? I don't see any alternative workaround.

    No, you nothing is missing! Sorry, I had assumed just because you can add script tags to practically anything, you could add them to the topics as well. But now that I checked, it turns out that you can't. Two ways out that could be

    (1) temporarily add sort by name of the item, separated by a single, empty string field to sort by. Subsequently restore the field sort by and the name of the topic.

    (2) If for any reason, you can add the value of sorting by name, you will need to build a table with the topic names and sort by values, blank the sort by fields, then restore them later using the table.

    Complicated, but nothing else I can think.

    Peter

  • Not finding the correct syntax for the select statement

    Hello

    The following statement works very well and gives the expected results:
    prompt
    prompt Using WITH t
    prompt
    
    with t as
      (
       select a.proj_id,
              a.proj_start,
              a.proj_end,
              case when (
                         select min(a.proj_start)
                           from v b
                          where (a.proj_start  = b.proj_end)
                            and (a.proj_id    != b.proj_id)
                        )
                        is not null then 0 else 1
              end as flag
         from v a
        order by a.proj_start
      )
    select proj_id,
           proj_start,
           proj_end,
           flag,
           --
           -- the following select statement is what I am having a hard time
           -- "duplicating" without using the WITH clause
           --
           (
            select sum(t2.flag)
              from t t2
             where t2.proj_end <= t.proj_end
           ) s
      from t;
    As an academic exercise, I wanted to rewrite the above statement without using the WITH clause, I tried this (amongst dozens of other tests - I hit a mental block and cannot understand):
    prompt
    prompt without with
    prompt
    
    select c.proj_id,
           c.proj_start,
           c.proj_end,
           c.flag,
           --
           -- This is what I've tried as the equivalent statement but, it is
           -- syntactically incorrect.  What's the correct syntax for what this
           -- statement is intended ?
           --
           (
            select sum(t2.flag)
              from c t2
             where t2.proj_end <= c.proj_end
           ) as proj_grp
      from (
            select a.proj_id,
                   a.proj_start,
                   a.proj_end,
                   case when (
                              select min(a.proj_start)
                                from v b
                               where (a.proj_start  = b.proj_end)
                                 and (a.proj_id    != b.proj_id)
                             )
                             is not null then 0 else 1
                   end as flag
              from v a
             order by a.proj_start
           ) c;
    Thanks for the help, much appreciated.

    John.

    PS: The DDL for table v used by the above statements is:
    drop table v;
    
    create table v (
    proj_id         number,
    proj_start      date,
    proj_end        date
    );
    
    insert into v values
           ( 1, to_date('01-JAN-2005', 'dd-mon-yyyy'),
                to_date('02-JAN-2005', 'dd-mon-yyyy'));
    insert into v values
           ( 2, to_date('02-JAN-2005', 'dd-mon-yyyy'),
                to_date('03-JAN-2005', 'dd-mon-yyyy'));
    insert into v values
           ( 3, to_date('03-JAN-2005', 'dd-mon-yyyy'),
                to_date('04-JAN-2005', 'dd-mon-yyyy'));
    insert into v values
           ( 4, to_date('04-JAN-2005', 'dd-mon-yyyy'),
                to_date('05-JAN-2005', 'dd-mon-yyyy'));
    insert into v values
           ( 5, to_date('06-JAN-2005', 'dd-mon-yyyy'),
                to_date('07-JAN-2005', 'dd-mon-yyyy'));
    insert into v values
           ( 6, to_date('16-JAN-2005', 'dd-mon-yyyy'),
                to_date('17-JAN-2005', 'dd-mon-yyyy'));
    insert into v values
           ( 7, to_date('17-JAN-2005', 'dd-mon-yyyy'),
                to_date('18-JAN-2005', 'dd-mon-yyyy'));
    insert into v values
           ( 8, to_date('18-JAN-2005', 'dd-mon-yyyy'),
                to_date('19-JAN-2005', 'dd-mon-yyyy'));
    insert into v values
           ( 9, to_date('19-JAN-2005', 'dd-mon-yyyy'),
                to_date('20-JAN-2005', 'dd-mon-yyyy'));
    insert into v values
           (10, to_date('21-JAN-2005', 'dd-mon-yyyy'),
                to_date('22-JAN-2005', 'dd-mon-yyyy'));
    insert into v values
           (11, to_date('26-JAN-2005', 'dd-mon-yyyy'),
                to_date('27-JAN-2005', 'dd-mon-yyyy'));
    insert into v values
           (12, to_date('27-JAN-2005', 'dd-mon-yyyy'),
                to_date('28-JAN-2005', 'dd-mon-yyyy'));
    insert into v values
           (13, to_date('28-JAN-2005', 'dd-mon-yyyy'),
                to_date('29-JAN-2005', 'dd-mon-yyyy'));
    insert into v values
           (14, to_date('29-JAN-2005', 'dd-mon-yyyy'),
                to_date('30-JAN-2005', 'dd-mon-yyyy'));
    select c.proj_id,
           c.proj_start,
           c.proj_end,
           c.flag,
           --
           -- This is what I've tried as the equivalent statement but, it is
           -- syntactically incorrect.  What's the correct syntax for what this
           -- statement is intended ?
           --
           (
            select sum(t2.flag)
              from (select a.proj_id,
                           a.proj_start,
                           a.proj_end,
                           case when (
                              select min(a.proj_start)
                                from v b
                               where (a.proj_start  = b.proj_end)
                                 and (a.proj_id    != b.proj_id)
                                     )  is not null then 0 else 1
                           end as flag
                      from v a
                     order by a.proj_start
                   ) t2
             where t2.proj_end <= c.proj_end
           ) as proj_grp
      from (
            select a.proj_id,
                   a.proj_start,
                   a.proj_end,
                   case when (
                              select min(a.proj_start)
                                from v b
                               where (a.proj_start  = b.proj_end)
                                 and (a.proj_id    != b.proj_id)
                             )
                             is not null then 0 else 1
                   end as flag
              from v a
             order by a.proj_start
           ) c;
    
  • What is the correct syntax for the use of a variable in an ad-hoc query?

    Hi all

    I'm a casual user of the DB and right now need to update the records about 1000 + so that a certain column gets a unique value.

    So I thought I'd use a variable for this.

    Then, I built this type of SQL statement for only a small subset of records:
    ----------
    variable number recNumber;
    exec: recNumber: = 1;
    UPDATE TABLE_TO_BE_UPD
    SET COL_TO_BE_UPD = COL_TO_BE_UPD + recNumber
    WHERE COL_TO_BE_UPD IN ('VAL_A', 'VAL_B');
    ----------

    I get invalid SQL statement error when you try to run above (except for the guest who asks for a value I want to omit).

    In any case, I also tried this one:
    ----------
    CREATE SEQUENCE seqCounter;
    UPDATE TABLE_TO_BE_UPD
    SET COL_TO_BE_UPD = COL_TO_BE_UPD + seqCounter.NEXTVAL
    WHERE COL_TO_BE_UPD IN ('VAL_A', 'VAL_B');
    ----------

    Of it, I got the error ORA-01722: invalid number... I guess it's because seqCounter is of type number and the COL_TO_BE_UPD is of type character... (?)

    Then I want to ask is what is the correct way to define and use a counter variable type to add a number at the end of a string?

    Also another question I would ask is that are variables that are used in queries ad hoc, also called "bind variables"?

    Thank you muchly

    If you want to add a unique number to a column, then it would be:

    UPDATE TABLE_TO_BE_UPD
    SET COL_TO_BE_UPD = COL_TO_BE_UPD ||to_char(rownum)
    WHERE COL_TO_BE_UPD IN ('VAL_A','VAL_B');
    

Maybe you are looking for

  • Migrating applications to the Chinese version of windows?

    Hello So, I wrote a few applications that are used in our US sites to control via GPIB hardware. We now have locations in Asia and I need these applications to work on this side of the pond. Looking for feedback or people with experience to warn me o

  • Cannot remove a program from the start menu icon

    Original title: icons in the Start Menu;. Cannot delete the program start menu icon to remove/uninstall, need help? S pie Menu icons; Ghost of icons I deleted a program and uninstalled completely, but the program icon always appears in the start menu

  • Windows updates break the computer

    I have Windows 7 and it did its updates during the shutdown and departure to the top of the computer. But this time there not even to get to the part at the start when applying updates, it just went to Windows Startup Repair. He has done this before,

  • Keyboard on my Dell laptop is much too sensitive. It can be adjusted?

    The keyboard uses a delicate touch to make the screen jump to other locations. In this case, anyone using the computer. I have an another Dell laptop that does not have this problem. Is there a way to make the keyboard less sensitive?

  • Apex 5.0 Page Designer JSON error on the page to load an application of 4.2 imported

    After you import our application written with version 4.2 (issue 26, modified) at APEX 5.2 when I try to open a page with the page designer, I get the following messageError: parsererror - SyntaxError: JSON.parse: unexpected end of data to column 1 o