Problem with REGEXP_SUBSTR related query.

I'm having a problem with this query:

SELECT *.

FROM (SELECT REGEXP_SUBSTR ('{SUMMER} |)) {} POINT OF SALE}',

'({)([A-Z]+ *[A-Z]*)(})',

1,

LEVEL,

'I,

2)

Val

OF THE DOUBLE

CONNECT BY LEVEL < =.

REGEXP_COUNT ('{SUMMER} |) {} POINT OF SALE} ',' |') + 1)

WHERE val IS NOT NULL

I need the output in 2 rows in this format:

VAL

====

SUMMER

POINT OF SALE

But I'm not able to get the "POINT OF SALE" in the output due to space, or perhaps another reason. Anyone can correct my query?

So, you want something like that?

SQL > ed
A written file afiedt.buf

1. SELECT *.
2 (SELECT REGEXP_SUBSTR ('{SUMMER} |)) {} POS} ',' [^ {|}] + ", LEVEL, 1, 'i') val"
3 FROM TWO
4. CONNECT BY LEVEL<>
5 REGEXP_COUNT ('{SUMMER} |) {} POINT OF SALE} ',' [^ |] +'))
6 * val WHERE IS NOT NULL
SQL > /.

VAL
------------------------
SUMMER
POINT OF SALE

SQL >

Tags: Database

Similar Questions

  • Pool pane there problem with long sql query?

    Hello

    I use Jdeveloper 11.1.2.2.0

    In the application I'm developing, there is a long sql query to call (it's a function from a package, which may take a few minutes to run) and I want to display a progress bar for the user.

    The progress bar component is a "progress indicator" and the percentage of achivement is refreshed by a component 'pool' with 1-second interval.

    The two components are connected in a javabean.

    The function with the sql query is the javabean too.

    To run the sql query that is long on background I am calling from a thread, and the pool component get the advancement of the percentage of a pipe filled with the sql function.

    If the function to run is just a long loop of java operations the progress bar works fine, but if I put my long sql query instead, stop listener pool should be performed to stop long, s sql queryo progress are updated only at the end of the long sql query.

    You have any ideas?

    Thank you

    Thanks for your replies. Unfortunately, it was not the solution to my case, sql procedures to block the entire application while ADF awaits them at the end...

    To solve my problem, I finally used a PL SQL Job to call my sql procedure (dbms_job.submit).

    The application is released right after the call and the component of the pool is not more secure!

    Kind regards

    Yann

  • Problem with the simple query.

    Hi all

    I am facing problem with the query below

    Select A.COL1, A.COL2

    B.COL1, B.COL2

    FROM TABLE1 A

    TABLE 1 B

    WHERE A.header = '123'

    AND B.header = '123'

    AND nvl (A.COL6, 'ABC') = 'ABC '.

    AND NVL (B.COL6, 'DEF') = 'DEF '.

    Basically, my requiremenyt is: I have only one table, TABLE1 here, which has a line two lines (for the same header) as "ABC" and another is "DEF". Table 1 has two columns (col1, col2) that should be displayed for both lines.

    When the header has two records in table1 top query works. and but if I do not have a record for any header example there are a record for "abc" in col6 only. so my query above does not work because there is no record for 'DEF' in col6. But I want to again request to fecth the output (for b.col1 and b.col2 should have null values)

    could you pls suggest me how to get the 4 columns.

    Thanks in advance

    Kind regards

    UVA.

    Try to place the status of outer join on column: analytical_criterion_code as

    and nvl (AUDIT.analytical_criterion_code, 'AUDIT2') = 'verification2. '

    .

    .

    and nvl (TRANS.analytical_criterion_code, 'TRANS2') = 'TRANS2.

    In the sub query based on the opinions that you have given in post # 1, although there is no value "DEF * ' for col6 due to the condition of outer join on b.col6 (+) line is extracted with b.col [1,2,3] as NULL values. Try to remove the (+) sign b.col6 and test.

    with t as)

    Select 111 col1, col2 'aaa', 'ABC' col6 123 header of all the double union

    Select 222 'bbb', 'DEF' col6, 123 double header

    )

    q as (select 123 double header)

    Select A.COL1, A.COL2, A.COL6

    B.COL1, B.COL2, b.COL6

    q.header

    T a

    t b

    q

    where a.col6 (+) = 'ABC '.

    and b.col6 (+) = "DEF."

    and q.header = a.header (+)

    and q.header = b.header (+)

  • Problem with the input query mode. FRM 41009, 40301

    Hi all

    I have a problem with the mode of input query. What can I say, I'm in the mode of input query, and I click on a button. I get the error THAT FRM-41009 displayed.

    Now, I've wanted handled. So I created a trigger of error in order to handle the error.

    IF ERR_CODE = 41009 THEN
    NULL;
    END IF;

    A problem is that when you use the null value, it will not terminate the mode of input query, and then I get frm-40301 error.

    Second, it's that I can't use exit_form in a trigger of the error.

    I am aware that I can press F4 to exit this mode, but I don't want to do whenever I'm sure I'll get the user complaints.

    Another solution would be to put the following code in the trigger when key pressed for each button in the form:

    If: system.mode = "ENTER-QUERY" then
    exit_form;
    end if;

    But I don't want to reproduce this code in my form.

    Please can you give me an idea how to handle this correctly?

    Thank you
    Michael

    PS: Version of the form = > ORACLE FORMS 10g (Forms [32 bit] Version 10.1.2.3.0)

    I have a problem with the mode of input query. What can I say, I'm in the mode of input query, and I click on a button. I get the error THAT FRM-41009 displayed.

    What is the code in the trigger of your button When-Button-Pressed (WBP)? Maybe you should check to see if the form is in the Mode query in your WBP rather than try and remove the error? In other words, eliminate error - do not delete it. :)

    If you want instead to remove the error, there is a technique to built-ins call restricted to a trigger that does not allow them. Do this by the use of a millisecond zero Timer. For example:

    /* Sample On-Error Trigger */
    DECLARE
      n_err_cd   NUMBER := ERROR_CODE;
      t_on_error TIMER;
      ZERO  NUMBER := 0;
    BEGIN
      IF ( n_err_cd = 41009 ) THEN
        /* Create Timer to execute Exit_Form() */
        /* to Cancel Query-Mode. */
        t_timer := Create_Timer('ON_ERROR', ZERO, NO_REPEAT);
      ELSE
        /* Handle all other errors here... */
      END IF;
    END;
    
    /* Sample When-Timer-Expired Trigger */
    DECLARE
      v_Timer  VARCHAR2(30);
    BEGIN
      v_timer := Get_Application_Property(TIMER_NAME);
    
      IF ( v_timer = 'ON_ERROR' ) THEN
        /* Notice, the timer name is case sensative! */
        Exit_Form;
      END IF;
    END; 
    

    I am aware that I can press F4 to exit this mode, but I don't want to do whenever I'm sure I'll get the user complaints.

    Well, it's just standard features of Oracle Forms. If you switch the Mode request form - you must run a query or cancel the query Mode! This is how it works. Your users need to understand that and accept it - just as they accept the functional also for other programs. ;) Another option would be to add a "Cancel request" button to your form and make it so it is enabled only when the form is placed in Query Mode. Just a thought...

    I personally prefer to prevent the occurrence of an error rather than remove the error. :)
    I hope this helps.
    Craig...

  • Lost my copy and I tried to download the iso from the Microsoft web site, but my product key will not validate, pass this message: we had a problem with the validation query

    Original title: error Windows 7 installation files

    I bought a copy of Windows 7 at Tiger Direct on 22/05/2014.  I lost my copy and I tried to download the iso from the Microsoft web site, but my product key is not valid.  I get this error message

    We had a problem with the request for approval.

    FAQ

    See for other directions:

    http://answers.Microsoft.com/en-us/Windows/wiki/Windows_7-update/how-to-what-are-my-options-for-obtaining-Windows-7/528163c1-0b2e-4AD2-a26d-7112851d1dc2

  • Problem with pseudo-HIERARCHICAL query

    Hi all

    I'm writing a piece of SQL to validate the check digit in wines

    (http://en.wikipedia.org/wiki/Vehicle_identification_number#Check_digit_calculation)


    using
    Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
    PL/SQL Release 10.2.0.5.0 - Production


    The logic in the wikipedia article can be encapsulated as follows:
    with val as (select '0' ch, 0 val from dual
                 union all
                 select '1', 1 from dual
                 union all 
                 select 'A',1 from dual
                 union all 
                 select 'J',1 from dual
                 union all 
                 select '2',2 from dual
                 union all 
                 select 'B',2 from dual
                 union all 
                 select 'K',2 from dual
                 union all 
                 select 'S',2 from dual
                 union all 
                 select '3',3 from dual
                 union all 
                 select 'C',3 from dual
                 union all 
                 select 'L',3 from dual
                 union all 
                 select 'T',3 from dual
                 union all 
                 select '4',4 from dual
                 union all 
                 select 'D',4 from dual
                 union all 
                 select 'M',4 from dual
                 union all 
                 select 'U',4 from dual
                 union all 
                 select '5',5 from dual
                 union all 
                 select 'E',5 from dual
                 union all 
                 select 'N',5 from dual
                 union all 
                 select 'V',5 from dual
                 union all 
                 select '6',6 from dual
                 union all 
                 select 'F',6 from dual
                 union all 
                 select 'W',6 from dual
                 union all 
                 select '7',7 from dual
                 union all 
                 select 'G',7 from dual
                 union all 
                 select 'P',7 from dual
                 union all 
                 select 'X',7 from dual
                 union all 
                 select '8',8 from dual
                 union all 
                 select 'H',8 from dual
                 union all 
                 select 'Y',8 from dual
                 union all 
                 select '9',9 from dual
                 union all 
                 select 'R',9 from dual
                 union all 
                 select 'Z',9 from dual)
       ,weight as (select 1 pos, 8 weight from dual
                    union all 
                    select 2, 7 from dual
                    union all 
                    select 3, 6 from dual
                    union all 
                    select 4, 5 from dual
                    union all 
                    select 5, 4 from dual
                    union all 
                    select 6, 3 from dual
                    union all 
                    select 7, 2 from dual
                    union all 
                    select 8, 10 from dual
                    union all 
                    select 9, 0 from dual
                    union all 
                    select 10, 9 from dual
                    union all 
                    select 11, 8 from dual
                    union all 
                    select 12, 7 from dual
                    union all 
                    select 13, 6 from dual
                    union all 
                    select 14, 5 from dual
                    union all 
                    select 15, 4 from dual
                    union all 
                    select 16, 3 from dual
                    union all 
                    select 17, 2 from dual)
    I can easily get the check digit for a WINE of the following logic:

        ,vm as (select row_number() over(partition by vin order by level) rn
                       , substr(vin, level,1) v
                       , vin
                    from (select 'ZAR91600006043427' vin
                            from dual
                         )
                 connect by level <= length(vin))
    select vin
         , mod(sum(checksum),11) calculated_check
         , substr(vin,9,1) existing_check
         , regexp_instr(substr(vin,9,1),mod(sum(checksum),11)) correct
      from (select val.val * weight.weight checksum
                  ,vm.vin 
              from vm
              join val on (val.ch = vm.v)
              join weight on (weight.pos = vm.rn)
      order by vm.rn)
    group by vin;
    which produces:
    VIN                              CALCULATED_CHECK                       EXISTING_CHECK                   CORRECT                                
    ZAR91600006043427                4                                      0                                0                                      
    However, I am having a little problem when I try to combine several wines of a table which I want to do rather than calculate each wine by programming:


    This, for example, produces a line for each letter of the wine ready to match with the other two CTES:
    with vehicle as (select 1000 as vehicle_id, 'ZAR91600006043427' as vin from dual
                       union all 
                     select 1001, 'XXX91600006043427' from dual)
    select level
           , substr(vin, level,1) v
           , vin
        from (select *
                from vehicle
               where vehicle_id = 1000
             )
     connect by level <= length(vin);
    I want ideally is a line for each character of each WINE. but this:
    with vehicle as (select 1000 as vehicle_id, 'ZAR91600006043427' as vin from dual
                       union all 
                     select 1001, 'XXX91600006043427' from dual)
    select level
           , substr(vin, level,1) v
           , vin
        from (select *
                from vehicle
               where vehicle_id in (1000,1001)
             )
     connect by level <= length(vin);
    product 262142 lines!

    and adding
    where vin = prior vin
    just reduced to 131070 lines...


    place a different one on the SQL produced the result that I want, but it is not scalable product lines by adding a third vehicle are exponentially more than two.

    so, in short: what is happening with my connect by statement that I'm missing?

    Hello

    Samir says:
    ... I want ideally is a line for each character of each WINE. but this:

    with vehicle as (select 1000 as vehicle_id, 'ZAR91600006043427' as vin from dual
    union all
    select 1001, 'XXX91600006043427' from dual)
    select level
    , substr(vin, level,1) v
    , vin
    from (select *
    from vehicle
    where vehicle_id in (1000,1001)
    )
    connect by level <= length(vin);
    

    product 262142 lines!

    and adding

    where vin = prior vin
    

    just reduced to 131070 lines...

    place a different one on the SQL produced the result that I want, but it is not scalable product lines by adding a third vehicle are exponentially more than two.

    so, in short: what is happening with my connect by statement that I'm missing?

    Whenever you want to debug a CONNECT BY query, put SYS_CONNECT_BY_PATH in the SELECT clause, to see how the lines are related.
    We will also cut the sting down to only 3 characters, in order to make things faster and easier to read and add ROWNUM just to make it easier to talk about the results:

    with vehicle as (select 1000 as vehicle_id, 'ABC' as vin from dual
                       union all
                     select 1001, 'XYZ' from dual)
    select level
           , substr(vin, level,1) v
           , vin
           , sys_connect_by_path ( vin
                        , ','
                        )     AS path_3
           , sys_connect_by_path ( substr (vin, level, 1)
                        , ','
                        )     AS path_1
           , ROWNUM
        from (select *
                from vehicle
               where vehicle_id in (1000,1001)
             )
    -- where     vin     = PRIOR vin
     connect by level <= length(vin);
    

    Output:

    `    LEVEL V    VIN PATH_3               PATH_1         ROWNUM
    ---------- ---- --- -------------------- ---------- ----------
             1 A    ABC ,ABC                 ,A                  1
             2 B    ABC ,ABC,ABC             ,A,B                2
             3 C    ABC ,ABC,ABC,ABC         ,A,B,C              3
             3 Z    XYZ ,ABC,ABC,XYZ         ,A,B,Z              4
             2 Y    XYZ ,ABC,XYZ             ,A,Y                5
             3 C    ABC ,ABC,XYZ,ABC         ,A,Y,C              6
             3 Z    XYZ ,ABC,XYZ,XYZ         ,A,Y,Z              7
             1 X    XYZ ,XYZ                 ,X                  8
             2 B    ABC ,XYZ,ABC             ,X,B                9
             3 C    ABC ,XYZ,ABC,ABC         ,X,B,C             10
             3 Z    XYZ ,XYZ,ABC,XYZ         ,X,B,Z             11
             2 Y    XYZ ,XYZ,XYZ             ,X,Y               12
             3 C    ABC ,XYZ,XYZ,ABC         ,X,Y,C             13
             3 Z    XYZ ,XYZ,XYZ,XYZ         ,X,Y,Z             14
    
    14 rows selected.
    

    There is no START WITH clause, so it will start by each of the 2 rows. It is very good; Take the first case of 'ABC'.
    Level = 1, we have row "ABC", so the substring added to this level is 'A'
    The lines are connected to this line to LEVEL = 2? All rows that satisfy the condition of LEVEL<= length="" (vin),="" which,="" in="" this="" sample="" set,="" means="" both="" rows.="" let's="" take="" 'abc'="" first,="" which="" is="" what="" happened="" on="" the="" line="" where="" rownum="">
    The lines are connected to this line (the line at the end of the path_3 ", ABC, ABC' ') = 3 level? All rows that satisfy the condition of LEVEL<= length="" (vin),="" which,="" in="" this="" sample="" set,="" means="" both="" rows.="" let's="" take="" 'abc'="" first,="" which="" is="" what="" happened="" on="" the="" line="" where="" rownum="">
    So far, so good; the results were exactly what we wanted. But here's where it won't.
    The lines are connected to the line at the end of the path ", ABC, ABC, ABC' level = 4?" All rows that satisfy the condition of LEVEL<= length="" (vin),="" which,="" in="" this="" sample="" set,="" means="" no="" rows.="" so="" let's="" back="" up="" the="" tree="" and="" see="" if="" any="" of="" the="" nodes="" we've="" already="" vistited="" has="" any="" other="" children.="" we="" back="" up="" to="" the="" row="" where="" path_3=',ABC,ABC' does="" 'abc'="" have="" any="" other="" children="" (that="" is,="" rows="" that="" meet="" the="" condition="" 3="">< length="" (vin)?="" yes,="" 'xyz'="" meets="" that="" condition,="" so="" 'xyz'="" is="" a="" child="" of="" 'abc',="" and="" we="" get="" the="" output="" row="" where="" rownum="">

    A CONNECT BY query WHERE clause is applied after the CONNECT BY is done. Adding a WHERE clause only deletes the rows from the result set once they have been generated. If we have a comment the WHERE clause above, the results are:

    `    LEVEL V    VIN PATH_3               PATH_1         ROWNUM
    ---------- ---- --- -------------------- ---------- ----------
             2 B    ABC ,ABC,ABC             ,A,B                1
             3 C    ABC ,ABC,ABC,ABC         ,A,B,C              2
             3 Z    XYZ ,ABC,XYZ,XYZ         ,A,Y,Z              3
             3 C    ABC ,XYZ,ABC,ABC         ,X,B,C              4
             2 Y    XYZ ,XYZ,XYZ             ,X,Y                5
             3 Z    XYZ ,XYZ,XYZ,XYZ         ,X,Y,Z              6
    

    Better, but it is still bad. All the 14 ranks were always generated, and then some of them have been excluded by the WHERE clause.
    Why the lines like the one with ROWNUM = included 3? Because the WHERE 'wine = wine PRIOR' condition is true: on this line, the wine is "XYZ", and wine PRIOR is also "XYZ". The status of research only in the last 2 levels. (PREREQUISITE may only be 1 level.) It does not matter that, earlier in the path, there is a knot where wine! = wine BEFOREHAND; This condition applies only to the finished result set. So the output row with path_3 =', ABC, XYZ "was excluded the result defined by the WHERE clause, but the descendants of this line can remain.

    Moral: If you do a query CONNECT BY and provided to connect BY is 'LEVEL '.<= x",="" then="" the="" table="" had="" better="" have="" only="" one="">
    Odie showed how to use CONNECT BY in this problem, by making the relative to the double CONNECT BY and joining your table of multiple row results.

  • Problem with REGEXP_SUBSTR

    Hello

    I'm trying to use the regexp_substr function in Oracle 10 to split a string into several lines (semicolon is the delimiter).

    So I use:

    Select Site_List, trim(regexp_substr(Site_List, '[^;]+, 1, level)) FROM (Select Site_List FROM ALL_SITES) Connect by  trim(regexp_substr(Site_List, '[^;]+, 1, level)) is not null
    

    No, you did nothing wrong.

    Tools such as SQL Developer, TOAD etc. tend to just return the first 50 rows (or however many) very quickly.  It is an indication that the query is performed quickly, but the time it takes to process and send you all data is clearly going to take more time, so if you do a count (*) it must process first before she she can count.

    Is the number of rows of data in your table?  How many 'elements' is in each string are some gettnig separated?

    I suppose that you run it on multiple lines?

    I, in which case you may need to add to your connect by clause that you create a sort - to connect a Cartesian product.

    for example, with the following data, we expect 5 rows of two strings...

    SQL > ed
    A written file afiedt.buf

    1 with t as (select 'item1, item2, 3' as txt of the union double all the)
    2 Select 'item4, element5' double)
    3  --
    4. Select txt
    5, regexp_substr(txt,'[^,]+',1,level) in el
    6 t
    7 * connect by regexp_substr(txt,'[^,]+',1,level) is not null
    SQL > /.

    TXT                        EL
    -------------------------- --------------------------
    Item1, item2, element1 3
    Item1, item2, item2 3
    Item1, item2, 3 3
    Element4 element5 element5
    Item1, item2, 3 3
    Item4, element4 element5
    Item1, item2, item2 3
    Item1, item2, 3 3
    Element4 element5 element5
    Item1, item2, 3 3

    10 selected lines.

    but we have more than we expected.

    If you try to make sure just connect for each line that you treat...

    SQL > ed
    A written file afiedt.buf

    1 with t as (select 'item1, item2, 3' as txt of the union double all the)
    2 Select 'item4, element5' double)
    3  --
    4. Select txt
    5, regexp_substr(txt,'[^,]+',1,level) in el
    6 t
    7. connect by regexp_substr(txt,'[^,]+',1,level) is not null
    8 * and txt = txt prior
    SQL > /.

    ERROR:
    ORA-01436: CONNECT loop in the user data

    no selected line

    ... you get a connection in a loop (cycle) in your data.

    This can be achieved by making every single cycle...

    SQL > ed
    A written file afiedt.buf

    1 with t as (select 'item1, item2, 3' as txt of the union double all the)
    2 Select 'item4, element5' double)
    3  --
    4. Select txt
    5, regexp_substr(txt,'[^,]+',1,level) in el
    6 t
    7. connect by regexp_substr(txt,'[^,]+',1,level) is not null
    8 and txt = txt prior
    9 * and prior sys_guid() is not null
    SQL > /.

    TXT                        EL
    -------------------------- --------------------------
    Item1, item2, element1 3
    Item1, item2, item2 3
    Item1, item2, 3 3
    Item4, element4 element5
    Element4 element5 element5

    so now, we get the 5 rows, as we expected.

    I suspect that you produce a lot more lines than you expected.

  • Problem with regexp_substr if the string with null values between commas.

    Hi all

    My version of DB is 10.1.0.5.0
    I want to extract the string values using query below, but I am unable to provide the correct result.
    WITH t  AS ( select '123,1,3,22' col FROM DUAL
            UNION ALL
            SELECT '123,,2,1' FROM DUAL
            UNION ALL
            SELECT '5,1,2,,' FROM DUAL
            ) 
    SELECT regexp_substr(t.col,'[^,]*',1,1)
          ,regexp_substr(t.col,'[^,]*',1,2)
          ,regexp_substr(t.col,'[^,]*',1,3)
          ,regexp_substr(t.col,'[^,]*',1,4) FROM DUAL,t   ;
    My required result as below.
    123     1      3      22
    123            2       1
    5       1      2        
    Please help me to get the required result by using regular expressions.
    Thanks, Ram

    Hello

    In Oracle 10, you can do so by combining REGEXP_SUBSTR with something else like RTRIM:

    SELECT     RTRIM (REGEXP_SUBSTR (col, '[^,]*(,|$)', 1, 1), ',')     AS part_1
    ,     RTRIM (REGEXP_SUBSTR (col, '[^,]*(,|$)', 1, 2), ',')     AS part_2
    ,     RTRIM (REGEXP_SUBSTR (col, '[^,]*(,|$)', 1, 3), ',')     AS part_3
    ,     RTRIM (REGEXP_SUBSTR (col, '[^,]*(,|$)', 1, 4), ',')     AS part_4
    FROM     t
    ;
    

    Starting Oracle 11 REGEXP_SUBSTR alone can do.

    But look at the first response; regular expressions will be probably less effective than less powerful features, especially when all channels have the same number of separators.

    Published by: Frank Kulash on 29 December 2012 08:36

  • Problem with comparing (related excel)

    Problem: Essentially the vi does that retrieve values from excel and compare it with a predetermined value and if the return value is equal to or superior to the vi stops and returns the cell that gave him a thar value. I think that it can think I tell excel to compare a value of string to a decimal value, but I tried and it seems to stop instantly with a value which is cleary.

    I have attached the vi and examples file excel which he searches through

    Don't see a problem. Start A4 and it will stop on the first iteration, as it should be (because the cell is empty it converts a 0 which is greater than-30). A5-again he steps up to the A368, just as it should.

    Mike...

  • problems with basic spatial query

    I am trying to learn Oracle Spatial, in collaboration with 11 g R2 and georeferenced 3D data (specifically buildings describing data in a city).

    But I'm unable to get a basic query to work on my dataset (he works for the example in the book), and I'm doing it exactly as is done in the space for 11 g Developer Guide.

    To learn how queries work, I implemented the cola_markets tables in the documentation, makes manual registration in the view user_sdo_geom_metadata and created the index. Having done this, I can run the following simple query (as well as others in the manual) on the book tables:

    SELECT SDO_GEOM. SDO_DISTANCE (c_b.shape, c_d.shape, 0.005)
    OF cola_markets c_b, c_d cola_markets
    WHERE c_b.name = 'cola_b' AND c_d.name = 'cola_d ';

    but when I try to do the same thing on my own paintings (created from citygml data), I get an error. There is the difference that the data is 3D, and that the index was created with no PARAMETERS (...), is therefore just 2D. But still I do not understand why the following query does not work:

    SELECT SDO_GEOM. SDO_DISTANCE (c_w.envelope, c_b.envelope, 0.0005)
    OF cityobject c_w,.
    cityobject c_b
    WHERE c_w.id = 50025
    AND c_b.id = 50018;

    The id for the buildings is valid, and I used the same tolerance used by software which has set up the database.

    Here is the error I get in SQL Developer:

    ORA-29532: Java call terminated by eception Java exception: java.lang.Exception: 54535
    ORA-06512: at the 'MDSYS. SDO_3GL', line 637
    ORA-06512: at the 'MDSYS. SDO_GEOM", line 1973
    ORA-06512: at the 'MDSYS. SDO_GEOM", line 1990
    29532 00000 - "Java call terminated by eception Java exception: %s."
    * Cause: A mistake or a Java exception has been reported and could not be
    solved by Java code.
    * Action: Modify Java code, if this behavior is not expected.

    So, thinking it could have something to do with the fact that it's a Java interface, I also tried to run from the command-line SQL/PL and get essentially the same thing:

    ERROR on line 1:
    ORA-29532: Java completed by eception Java exception appeal:
    java.lang.Exception: 54535
    ORA-06512: at the 'MDSYS. SDO_3GL', line 637
    ORA-06512: at the 'MDSYS. SDO_GEOM", line 1973
    ORA-06512: at the 'MDSYS. SDO_GEOM", line 1990

    Any ideas why it does not work?

    54535 error means that the geometry data are not valid.
    If you run validate_geometry_with_context on the data to check for errors and correct the data first.

    Siva

  • Problem with a join query

    Having trouble getting my head around that, so would appreciate any help.

    I run the query below, which includes a join. If I run this query through Navicat (for those who don't know, a MySQL GUI) - I get the expected result.

    I also have a similar query running on the site elsewhere with success, so I am struggling to understand why it does not work.

    The request is;

    < name cfquery = "getwatched" datasource = "#datasource #" >
    SELECT r.retailer_name, r.id, r.shortname, d.id, d.merchant_id, d.user_id, d.e_updates
    OF cc_watchlists d
    LEFT JOIN merchant r
    ON d.merchant_id = r.id
    WHERE d.user_id = #SESSION. Auth.ID #.
    ORDER BY r.retailer_name ASC
    < / cfquery >

    and the exit;

    < cfoutput query = "getwatched" >
    < TD > < a href = "page.cfm? for = #shortname #" > #retailer_name # < /a > < /dt >
    < / cfoutput >

    Error States;

    coldfusion.runtime.UndefinedVariableException: Variable SHORTNAME is undefined.

    I would appreciate any help!

    Make a the entire query just before the line which is the slightest error, and
    Make sure that it contains what you think that it contains.

    --
    Adam

  • Problem with a simple query

    Hello, I'll start by saying that I am a noob. in any case, I'm trying to do what I thought was a simple query for records that are greater or equal to the date of the day: it's my request...

    < cfquery name = "getUpcoming" datasource = 'events' >
    SELECT title, eventDate FROM event WHERE eventDate > = #Now () # ORDER BY ASC eventDate
    < / cfquery >

    It works, so, I get the records that are greater than the current date, but all records that match to are not.

    I guess that it is looking at the time as well, or should I completely wrong. I do not know? Any help would be greatly appreciated.

    Good reading up on top of (http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7f 6f.html), which you must use when you pass dynamic values to the DB, instead of hard-coding the in your SQL string.  And when using , use a param of CF_SQL_DATE type, and must ignore the time portion of the date/time value, you pass (I'm not 100% certain of this... only about 99% certain... but give it a go).  Or spend only the date part of the date/time value in the query.  Using createOdbcDate() fact, without all the extra horsing around adding things together and using the dateFormat() attribute as the previous poster suggested.

    --

    Adam

  • Wat is the problem with this simple query?

    I use 10gxe.
    This is the query that does not work
    Whenever I'm him running a pop-up windows is coming
    and asks me to enter the bind variables... Should wat I do?
    Here's a question prntscrn.

    http://potupaul.webs.com/at.html


    G_message VARIABLE VARCHAR2 (30)
    BEGIN
    : g_message: = "Œuvres of My PL/SQL block;
    END;
    /
    G_message IMPRESSION

    Edited by: user4501184 may 18, 2010 12:42 AM

    use sqlplus 't's work' ng

    run
    cmd
    sqlplus / as sysdba
    G_message VARIABLE VARCHAR2 (30)
    BEGIN
    : g_message: = "Œuvres of My PL/SQL block;
    END;
    /
    G_message IMPRESSION

    hope this helps
    Daniele

  • Problem with exit (related ratings)

    So what I'm trying to do, is make a row of my data set and only the first three rankings of output. However, is there a link to say the 1st ranking and it is 3 lines or more, so I want only the lines with a ranking of one output. For example...

    *******************************************
    *(1)*
    Data in the table:
            YEAR     NUM     NAME     ID
    1     2010     11     JOHN     1110
    2     2010     11     MIKE     1111
    3     2010     11     BOB     1112
    4     2010     11     TERRY     1115
    5     2010     3     CARL     1113
    6     2010     3     BOB     1114
    7     2010     0     DEREK     1115
    I want to only output:
            YEAR     NUM     NAME     ID
    1     2010     11     JOHN     1110
    2     2010     11     MIKE     1111
    3     2010     11     BOB     1112
    4     2010     11     TERRY     1115
    *******************************************
    *(2)*
    However, if the table looked like this:
    1     2010     11     JOHN     1110
    2     2010     10     MIKE     1111
    3     2010     3     BOB     1112
    4     2010     3     TERRY     1115
    5     2010     3     CARL     1113
    6     2010     3     BOB     1114
    7     2010     0     DEREK     1115
    I don't want to output:
    1     2010     11     JOHN     1110
    2     2010     10     MIKE     1111
    3     2010     3     BOB     1112
    4     2010     3     TERRY     1115
    5     2010     3     CARL     1113
    6     2010     3     BOB     1114
    *******************************************

    Oracle: 10.2 G

    *******************************************

    Here is my code with some sample data:
    WITH xTable AS
        (   
                SELECT 2010 AS YEAR, 11 AS NUM, 'JOHN' AS NAME, 1110 AS ID fROM DUAL UNION ALL
                SELECT 2010 AS YEAR, 10 AS NUM, 'MIKE' AS NAME, 1111 AS ID FROM DUAL UNION ALL
                SELECT 2010 AS YEAR, 3 AS NUM, 'BOB'  AS NAME, 1112 AS ID FROM DUAL UNION ALL
                SELECT 2010 AS YEAR, 3 AS NUM, 'TERRY'  AS NAME, 1115 AS ID FROM DUAL UNION ALL
                SELECT 2010 AS YEAR, 3  AS NUM, 'CARL' AS NAME, 1113 AS ID  FROM DUAL UNION ALL
                SELECT 2010 AS YEAR, 3  AS NUM, 'BOB'  AS NAME, 1114 AS ID FROM DUAL UNION ALL
                SELECT 2010 AS YEAR, 0 AS NUM,'DEREK' AS ITEMS, 1115 AS ID FROM DUAL
        )
            SELECT rank () over (order by num desc) as rank,
            num,year,name, id
            FROM XTABLE
    *******************************************

    Here are the requirements once more for clarity:

    Line three first in the classification of output, if there is a tie for 1st place and it's a tie of three people or more to output only the 1st class individual (even if a 100 people are tied for 1st place). Is there no links for rankings one and two, but three ranking has a bunch of links, exit individuals who occupy one and two, and tied third in the individual. I hope that all makes sense.

    Solomon Yakobson says:
    Use dense_rank:

    I misread your reqs. Looks like you want something like:

    -- Case (1)
    WITH xTable AS (
                    SELECT 2010 AS YEAR, 11 AS NUM, 'JOHN'  AS NAME, 1110 AS ID fROM DUAL UNION ALL
                    SELECT 2010 AS YEAR, 11 AS NUM, 'MIKE'  AS NAME, 1111 AS ID FROM DUAL UNION ALL
                    SELECT 2010 AS YEAR, 11 AS NUM, 'BOB'   AS NAME, 1112 AS ID FROM DUAL UNION ALL
                    SELECT 2010 AS YEAR, 11 AS NUM, 'TERRY' AS NAME, 1115 AS ID FROM DUAL UNION ALL
                    SELECT 2010 AS YEAR, 3  AS NUM, 'CARL'  AS NAME, 1113 AS ID  FROM DUAL UNION ALL
                    SELECT 2010 AS YEAR, 3  AS NUM, 'BOB'   AS NAME, 1114 AS ID FROM DUAL UNION ALL
                    SELECT 2010 AS YEAR, 0  AS NUM, 'DEREK' AS NAME, 1115 AS ID FROM DUAL
                   )
    SELECT  rank,
            num,
            year,
            name,
            id
      FROM  (
             SELECT  rank,
                     num,
                     year,
                     name,
                     id,
                     count(case rank when 1 then 1 end) over() rank1_rowcount
               FROM  (
                      SELECT  dense_rank() over(order by num desc) as rank,
                              num,
                              year,
                              name,
                              id
                        FROM  XTABLE
                     )
            )
      WHERE rank = 1
         OR (
                 rank IN (2,3)
             AND
                 rank1_rowcount < 3
            )
    /
    
          RANK        NUM       YEAR NAME          ID
    ---------- ---------- ---------- ----- ----------
             1         11       2010 JOHN        1110
             1         11       2010 MIKE        1111
             1         11       2010 BOB         1112
             1         11       2010 TERRY       1115
    
    SQL> -- Case (2)
    WITH xTable AS (
                    SELECT 2010 AS YEAR, 11 AS NUM, 'JOHN' AS NAME, 1110 AS ID fROM DUAL UNION ALL
                    SELECT 2010 AS YEAR, 10 AS NUM, 'MIKE' AS NAME, 1111 AS ID FROM DUAL UNION ALL
                    SELECT 2010 AS YEAR, 3 AS NUM, 'BOB'  AS NAME, 1112 AS ID FROM DUAL UNION ALL
                    SELECT 2010 AS YEAR, 3 AS NUM, 'TERRY'  AS NAME, 1115 AS ID FROM DUAL UNION ALL
                    SELECT 2010 AS YEAR, 3  AS NUM, 'CARL' AS NAME, 1113 AS ID  FROM DUAL UNION ALL
                    SELECT 2010 AS YEAR, 3  AS NUM, 'BOB'  AS NAME, 1114 AS ID FROM DUAL UNION ALL
                    SELECT 2010 AS YEAR, 0 AS NUM,'DEREK' AS ITEMS, 1115 AS ID FROM DUAL
                   )
    SELECT  rank,
            num,
            year,
            name,
            id
      FROM  (
             SELECT  rank,
                     num,
                     year,
                     name,
                     id,
                     count(case rank when 1 then 1 end) over() rank1_rowcount
               FROM  (
                      SELECT  dense_rank() over(order by num desc) as rank,
                              num,
                              year,
                              name,
                              id
                        FROM  XTABLE
                     )
            )
      WHERE rank = 1
         OR (
                 rank IN (2,3)
             AND
                 rank1_rowcount < 3
            )
    /
    
          RANK        NUM       YEAR NAME          ID
    ---------- ---------- ---------- ----- ----------
             1         11       2010 JOHN        1110
             2         10       2010 MIKE        1111
             3          3       2010 BOB         1112
             3          3       2010 TERRY       1115
             3          3       2010 CARL        1113
             3          3       2010 BOB         1114
    
    6 rows selected.
    
    SQL>  
    

    SY.

  • What is the problem with this dynamic query? help

    with the following code, I get the correct answer.
    I just want to know maxempno current (and care for the 3rd, 4th tank only)

    declare
    Temp varchar2 (2);
    Start

    Select substr (A1.empno, 3, 2) in the emp A1 temp where A1.empno = (select (max (A2.empno) of emp A2) and rownum = 1;)
    HTP.p ('temp' is |) Temp)
    end;

    Temp is 34

    =====================================
    Now I need to make a call to the procedure and pass the name of a table and column

    P_CHECK_MAX
    ('emp' = > p_table,)
    ('empno' = > p_column)

    create or replace procedure 'P_CHECK_MAX '.
    (p_table in VARCHAR2,
    p_column in varchar2)

    is
    Temp varcahr2 (2);
    d_select varchar2 (500);

    Start
    d_select: ='SELECT substr (A1.'| p_column | 3: 2) IN ' | "temp" | 'FROM ' | p_table | "A1 WHERE A1.' | p_column | "= (SELECT max (A2.' | p_column |')) OF ' | p_table | ("A2) AND rownum = 1';
    immediately run d_select;

    end;

    I'm getting ORA - 00905 missing keywords. Can you help me what is the missing word here? I am stomped for hours on it.

    Published by: wanwan63 on September 29, 2009 06:23
    Sorry I reverse the setting in the call. must be p_table = > 'emp', p_column = > 'empno '.

    P_CHECK_MAX
    ("emp"-online p_table,
    'empno'-online p_column)

    It must be

    p_check_max(p_table=>'emp', p_column=> 'empno)
    

    d_select: ='SELECT substr (A1.'| p_column | 3: 2) IN ' | "temp" | 'FROM ' | p_table | "A1 WHERE A1.' | p_column | "= (SELECT max (A2.' | p_column |')) OF ' | p_table | ("A2) AND rownum = 1';
    immediately run d_select;

    IN is not part of the SQL syntax. Its syntax PL. If you can not use dynamic SQL. It should be like this

    d_select:='SELECT substr(A1.'||p_column|| ',3,2)  FROM ' || p_table || '  A1 WHERE A1.' ||p_column ||'= (SELECT max(A2.' ||p_column||') FROM ' || p_table||' A2) AND rownum=1';
    execute immediate d_select into temp;
    

Maybe you are looking for