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

Tags: ColdFusion

Similar Questions

  • 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 (+)

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

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

  • Problem with the join relationship condition master / detail

    Hello
    I need to join with master detail such as if there is no trace of the foreign key in detail to the primary master key, the foreign key must be attached to another column based on certain conditions in the master. For example:

    Control columns: pk1, rk1, rk2
    Detail of the columns: fk1, a, b, c

    I created a relationship with detail with the join condition, pk1 = fk1 in master.
    But according to value rk1, I actually join fk1 to rk2 in master and if the condition fails then join the pk1. I can't put this condition in the relationship that the form does not accept complex join conditions.

    I hope that my example has not confused everyone.

    Can someone help me to achieve this goal.

    TIA

    TIA,
    I agree with DM, rather than using the RELATIONSHIP between the blocks that I would create logic to manually set the DEFAULT_WHERE clause on the block of RETAIL with the criteria you need to MASTER block. This can be a little difficult if you want to form work the same way if you had defined a relationship because you will have to create all the triggers event coordination. The most difficult part is to choose the right triggers to coordinate the synchronization when a user accesses a folder of master to another. For just the basics (the block of retail is questioned when the user navigates to the retail block), you could do the following:
    1. create a When-new-folder-Instance trigger on the Master block to capture the relevant details to query the block detail and define the DEFAULT_WHERE.
    2 create a trigger in a times - news - block - Instance on the block of retail to run the query on the block of retail and display the details records.

    For example:

    /* Sample When-New-Record-Instance trigger */
    DECLARE
         v_temp_where          VARCHAR2(500); /* make larger if needed. */
    BEGIN
         IF ( :MASTER_BLOCK.First_Item IS NOT NULL ) THEN
              /* this is needed for when the user navigates to a NEW record in the MASTER Block. */
    
              /* Add your conditional logic here to determine how to build your WHERE clause */
              IF ( RK1 = 'Dependent Values' ) THEN
                   v_temp_where := 'PK1 = FK1';
              ELSE
                   v_temp_where := 'RK2 = FK1';
              END IF;
    
              Set_Block_Property('DETAIL_BLOCK',ONETIME_WHERE,v_temp_where);
              /* If you are using Forms 6i, the ONETIME_WHERE property is not available so you will have to */
              /* use the DEFAULT_WHERE property instead. */
         END IF;
    END;
    
    /* Sample When-New-Block-Instance trigger
    BEGIN
         /* This sample code assumes the user has not navigated to a New Record */
         /* so there will always be a NOT NULL default where assigned to the DETAIL BLOCK.*/
         Clear_Block(ASK_COMMIT); /* just in case the user made changes... */\
         Execute_Query;
    END;
    

    Please understand it is the EXAMPLE of Code and is intended to be a starting point for you - not the complete solution.

    I hope this helps.
    Craig...

    If a response is appropriate or useful, please mark accordingly

  • 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 Outer join and filter

    Hello

    I join two tables in the source using a left outer join. Outside of the join, I have a filter specified with condition TabA.C1 > TabB.C2.

    Now, when ODI generates the query it puts the left outer join on the filter condition as well. So he puts filter as

    where
    (1 = 1)
    And ((TabA.C1 = TabB.C1 (+)) AND)
    (TabA.C2 = TabB.C2 (+))
    And TabA.C10 > TabB.C14 (+)

    How to avoid this problem. I tried this performance on stage as well, always generated query remains the same.

    I use the incremental update of the IKM Oracle. My source and target are both on the same PB.


    ~ Chikk

    Hi Chikk,

    If you analyze the data, you'll see it's OK to have the "(+)" to the filter...

    Anyway, if you want to drop it, leave it as inner join and put the "(+)" manually to the join object.

    This help you?

  • error in the update with a join query

    Hi all

    IM using oracle 10g on windows.

    im not able to use this update query with join...

    UPDATE
    b
    SET
    b.is_stud = 1
    Of
    b Boy
    JOIN IN-HOUSE
    the relationship r
    WE
    b.ID = r.boy_id;

    Thank you very much...
    MERGE into emp trg
    using(Select distinct b.ename ename,a.empno empno from emp a,
                 emp_status b where  a.empno=b.empno) src
    on
    (trg.empno=src.empno)
    when matched then
    update
    SET trg.name = src.ename;
    
  • problems with natural join

    Hello!

    I learn SQL and I have a lot of doubts but I think with this example I can generalize.

    I have the tables:

    Book {idbook (PK), namebook}
    auhor {idauthor (PK), nameauthor, idcountry (FK)}
    fatherhood {idauthor (FK), idbook (FK)} (both the same strain of PK)
    country {idcountry (PK), namecountry}

    I want the name of the books that are the authors of the Canada.

    I assumed that a correct query would be:

    SELECT namebook FROM book NATURAL JOIN (paternity NATURAL JOIN (author country NATURAL JOIN)) WHERE country.namecountry = 'Canada ';

    The result I was waiting for was:

    Book3
    Book5

    but this query returns me all the books that have relationships in the co-author (with the authors of all countries), 2 times! as:

    Book2
    book3
    Book4
    Book5
    Book2
    book3
    Book4
    Book5

    the best I can do to get my correct result is:

    SELECT namebook FROM book NATURAL JOIN (author, NATURAL JOIN) WHERE author.idcountry = 2;

    But of course I can't use this one...

    Can someone explain to me what is happening?

    Thank you very much!

    Published by: user12040235 on 10/15/2009 09:37

    Published by: user12040235 on 10/15/2009 09:51

    Hello

    Maybe it's a bug.

    Get the correct results (2 ranks) to Oracle 10.1, but I get the same bad results you (12 rows) in Oracle 11.1.
    In Oracle 11, I get results so say "SELECT *" instead of "SELECT book.namebook".
    I also get the correct results, if I add the join columns in the SELECT clause. Adding a column to join no, for example

    SELECT  BOOK.namebook, author.nameauthor
    FROM            book
    ...
    

    Gets results.

    In the interest of all those who want to try this:

    DROP TABLE     author;
    
    create table     author     AS
    SELECT  1 AS idauthor, 'Jose Luiz do Rego' AS nameauthor, 1 AS idcountry     FROM dual     UNION ALL
    SELECT         2, 'Barbara Bela',                                      2          FROM dual     UNION ALL
    SELECT         3, 'Juan Domingues',                                    5          FROM dual     UNION ALL
    SELECT         4, 'José Mauro de Vasconcelos',                         1          FROM dual     UNION ALL
    SELECT         5, 'Vader',                                             2          FROM dual     UNION ALL
    SELECT         6, 'navathe',                                           4          FROM dual     UNION ALL
    SELECT         7, 'Machado de Assis',                                  1          FROM dual
    ;
    
    drop table     AUTHORSHIP;
    
    CREATE TABLE     authorship     AS
    SELECT         2 AS idauthor,          5 AS idbook     FROM dual     UNION ALL
    SELECT         1 AS idauthor,          1 AS idbook     FROM dual     UNION ALL
    SELECT         5 AS idauthor,          3 AS idbook     FROM dual     UNION ALL
    SELECT         6 AS idauthor,          2 AS idbook     FROM dual     UNION ALL
    SELECT         7 AS idauthor,          4 AS idbook     FROM dual     UNION ALL
    SELECT         7 AS idauthor,          6 AS idbook     FROM dual;
    
    drop table     book;
    
    CREATE TABLE   book     AS
    SELECT         1 AS idbook, 'book1' AS namebook     FROM dual     UNION ALL
    SELECT         2 AS idbook, 'book2' AS namebook     FROM dual     UNION ALL
    SELECT         3 AS idbook, 'book3' AS namebook     FROM dual     UNION ALL
    SELECT         4 AS idbook, 'book4' AS namebook     FROM dual     UNION ALL
    SELECT         5 AS idbook, 'book5' AS namebook     FROM dual     UNION ALL
    SELECT         6 AS idbook, 'book6' AS namebook     FROM dual     UNION ALL
    SELECT         7 AS idbook, 'book7' AS namebook     FROM dual;
    
    DROP TABLE     country;
    
    CREATE TABLE     country     AS
    SELECT         1 AS idcountry, 'Brazil' as namecountry     FROM dual     UNION ALL
    SELECT         2 AS idcountry, 'Canada' as namecountry     FROM dual     UNION ALL
    SELECT         3 AS idcountry, 'Chile' as namecountry     FROM dual     UNION ALL
    SELECT         4 AS idcountry, 'Venezuela' as namecountry    FROM dual     UNION ALL
    SELECT         5 AS idcountry, 'USA' as namecountry          FROM dual     UNION ALL
    SELECT         6 AS idcountry, 'Argentina' as namecountry    FROM dual     ;
    
  • with clause with self-join query

    Hi all

    I have the following table
     Name                                      Null?    Type
     ----------------------------------------- -------- ----------------
     SURVEY_ID                                 NOT NULL NUMBER(5)
     USER_ID                                   NOT NULL VARCHAR2(15)
     ACADEMIC_SEMESTER                                  VARCHAR2(25)
     USER_TYPE                                          VARCHAR2(7)
     Q1                                            NUMBER(1)
     Q2                                            NUMBER(1)
    Q1 and Q2 have five questions 1,2,3,4,5.

    I want to see how much user of has slected option 1, how much the user select option2 so on and so forth for each question.

    How to do this?

    I write the following query

    with
    Q1_count like)
    Select user_id, Q1_STAFF, Q13_STAFF, SURVEY_ID in css_survey
    )
    Select count (c.user_id) total_users, q.Q1_STAFF, q.Q13_STAFF
    of css_survey c, q1_count q
    where c.survey_id = q.survey_id and c.user_id = q.user_id
    Q.Q1_STAFF group, q.Q13_STAFF

    which generates the following results
    TOTAL_USERS     Q1         Q2
    ----------- ----------             ----------
              1              2               5
              1              5               5
    instead I need the results below;
    TOTAL_USERS     Q1         Q2
    ----------- ----------             ----------
              1              2               
              1              5               
              1                            5
              1                            5
    kindly help.

    I do not remember, this qustion was requested before

    And the solution was also given at that time

    select count (*) total,q1,q2
    from css_survey
    group by  grouping sets (q1,q2);
    
  • 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 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

Maybe you are looking for

  • Satego X 200-need for win XP ACPI common Modules

    Hello Could I get information how to operate the keys work in windows XP (downloaded all drivers XP Toshiba Web site, install them according to the documentation of installation also available on this page). After I've read about this problem on seve

  • The a6 - 5400 k in my hp p7 - 1436 max loads to 64 degrees celsius

    the A4-3420 in my p6 2316 s past 40 degrees Celsius maximum to the maximum load with the temperature of 46 degrees Fahrenheit air. My p7 - 1436 s is still under warranty, what do I do?

  • I've got Blue Screen Of Death

    I have the blue screen of death, and I get the following code:STOP: 0X000000F4 (0 X 00000003, 0X8A899020, 0X8A899194, 0 X 80604428)What is the problem? TNX

  • client for Microsoft Network

    June 26, 2012 FROM: jgbcorr Operating system: Vista Edition Home Premium Service Pack 2 I tried to reinstall the Client of Microsoft Networks on the PC several times. I had deleted to reinstall because I couldn't connect to the Internet once I have g

  • 9 48 error message - system to try again to install IE9

    original title: 9 48 error message. Hi- Vista running; I have already installed IE9. Update prompts me to install the "update important" identified as "Windows Internet Explorer 9 for Windows Vista" - 19.1 MB. The update has failed repeatedly, get th