google-code-export / oragoods

Automatically exported from code.google.com/p/oragoods
1 stars 0 forks source link

SQL with inner select not being parsed #7

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Add a data source that does not have an included select that works:
insert into gdatasources values ('sch3_7_2','select mu.mailing_key as mk,
mu.mailing_sent as st from MAILING_CAMPAIGN mu where mailing_desc like
''Partner E-mail%''');

2. Add a data source with an inner select that does not work:
insert into gdatasources values ('sch3_7_3','select mu.mailing_key as mk,
mu.mailing_sent as st, (select count(*) from mailing_event where
mailing_key = mu.mailing_key and event_type_hnd in (1,8)) as om from
MAILING_CAMPAIGN mu where mailing_desc like ''Partner E-mail%''');

What is the expected output? 
Data parsed properly

What do you see instead?
google.visualization.Query.setResponse(
{
version: "0.7",
status: "error",
reqId: 0,
errors: [
{reason: "-20017", message: "ORA-20017: Parsing error: opened parenthesis is
never closed"}
]
}
)

What version of the product are you using? On what operating system?
Oracle 10.2.0.3, Red Hat Enterprise Linux AS release 3 (Taroon Update 5)

Please provide any additional information below.
There may be a work around - I could wrap this piece in a select statement
but still not sure if this particular sql can be parsed.

Thanks so much.

Original issue reported on code.google.com by mrosse...@experience.com on 12 May 2010 at 4:04

GoogleCodeExporter commented 9 years ago
OraGoods parses the SELECT clause of your query to determine the columns. If you
include an INNER query, it will probably fail. Try to use an inner query to 
wrap the
column.

Instead of this

  select mu.mailing_key as mk, 
       mu.mailing_sent as st, 
       (select count(*) 
          from mailing_event 
          where mailing_key = mu.mailing_key and event_type_hnd in (1,8)
       ) as om 
  from MAILING_CAMPAIGN mu 
  where mailing_desc like 'Partner E-mail%'

Use an inner query like this:

select mk, st, om
from (
  select mu.mailing_key as mk, 
       mu.mailing_sent as st, 
       (select count(*) 
          from mailing_event 
          where mailing_key = mu.mailing_key and event_type_hnd in (1,8)
       ) as om 
  from MAILING_CAMPAIGN mu 
  where mailing_desc like 'Partner E-mail%'
)

Original comment by jose.can...@gmail.com on 12 May 2010 at 4:24

GoogleCodeExporter commented 9 years ago
Thank you.

Original comment by mrosse...@experience.com on 12 May 2010 at 5:43