Home » SQL & PL/SQL » SQL & PL/SQL » Query contain MODEL cause "column not allowed here" in select statement
|
|
Re: Query contain MODEL cause "column not allowed here" in select statement [message #667483 is a reply to message #667482] |
Mon, 01 January 2018 23:46   |
 |
vincenttic
Messages: 3 Registered: January 2018
|
Junior Member |
|
|
I supplement the detail sql here for reference,Thanks for the reply.
1) This sql runs successfully
select
address_id,
customer_id,
sex,
substr(contact_id,2,1) contact_id
from testoracle.contact
where customer_id in ('5','6')
model
return updated rows
partition by (customer_id)
dimension by (sex,contact_id)
measures (address_id)
rules
(
address_id['F',9] = 1,
address_id['M',9] = 2,
address_id['F',1] = 3,
address_id['M',1] = 4)
order by address_id,customer_id,sex;
2) If we add a table alias in select statement - "c.address_id", the sql runs failed, the error output is "Error at line 2: ORA-00984: column not allowed here"
select
c.address_id,
customer_id,
sex,
substr(contact_id,2,1) contact_id
from testoracle.contact c
where customer_id in ('5','6')
model
return updated rows
partition by (customer_id)
dimension by (sex,contact_id)
measures (address_id)
rules
(
address_id['F',9] = 1,
address_id['M',9] = 2,
address_id['F',1] = 3,
address_id['M',1] = 4)
order by address_id,customer_id,sex;
3)If use table prefix directly in select statement - "testoracle.contact.address_id", it also failed, the error is the same "Error at line 2: ORA-00984: column not allowed here"
select
testoracle.contact.address_id,
customer_id,
sex,
substr(contact_id,2,1) contact_id
from testoracle.contact
where customer_id in ('5','6')
model
return updated rows
partition by (customer_id)
dimension by (sex,contact_id)
measures (address_id)
rules
(
address_id['F',9] = 1,
address_id['M',9] = 2,
address_id['F',1] = 3,
address_id['M',1] = 4)
order by address_id,customer_id,sex;
|
|
|
|
|
Goto Forum:
Current Time: Tue Sep 26 03:22:46 CDT 2023
|