Column ambigously defined
select distinct kmt.tag_number , fa.tag_number from kfupm_mcr_tag kmt, fa_additions fa
where kmt.TAG_NUMBER = fa.TAG_NUMBER
SUBSTR( tag_number, 1,6) tag_number;
can any one help me out
Thanks
Arifuddin
Edited by: user11309801 on Jan 1, 2011 8:28 AM
Thanks it's working.
select distinct SUBSTR( kmt.tag_number, 1,6) from kfupm_mcr_tag kmt, fa_additions fa
where kmt.TAG_NUMBER =fa.TAG_NUMBER
and
select itm.inventory_item_id "Item#",itm.segment1,itm.description,qty.SUBINVENTORY_CODE as SHI,
sum(qty.primary_transaction_quantity) "On Hand Qty"
from MTL_ONHAND_QUANTITIES_DETAIL qty,
mtl_system_items itm
WHERE itm.inventory_item_id=qty.inventory_item_id
and itm.ORGANIZATION_ID=qty.ORGANIZATION_ID
and qty.SUBINVENTORY_CODE IN ('ITC-8888', 'ITC-9999')
and trunc(qty.last_update_date) <=:P_DATE_FROM
AND trunc(SYSDATE) >=:P_DATE_TO
group by qty.SUBINVENTORY_CODE,itm.inventory_item_id,itm.segment1,itm.description;
guide me solve the above
Regards
Arifuddin
Edited by: user11309801 on Jan 1, 2011 8:54 AM
Similar Messages
-
"column ambigously defined" error
ORA-00918: column ambigously defined
00918.00000 - "column ambigously defined"
*Cause:
*Action
Vendor code 918
I've gotten this error on a few of the queries I've ran in SQL Developer 1.5 and tried to export to xls, but when I run and try to export the same query in 1.2.1 it's fine. There is another popup box that provides this detail (below). What causes this error and how can it be fixed?
java.lang.NullPointerException
at oracle.dbtools.raptor.dialogs.export.ColumnPanel.addColumnsToTree(ColumnPanel.java:85)
at oracle.dbtools.raptor.dialogs.export.ColumnPanel.showPanel(ColumnPanel.java:61)
at oracle.dbtools.raptor.dialogs.export.ColumnPanel.<init>(ColumnPanel.java:50)
at oracle.dbtools.raptor.dialogs.actions.TableExportAction.showPanels(TableExportAction.java:291)
at oracle.dbtools.raptor.dialogs.actions.TableExportAction.launchDlg(TableExportAction.java:189)
at oracle.dbtools.raptor.format.ui.ExportContextMenuListener$1.actionPerformed(ExportContextMenuListener.java:137)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at javax.swing.AbstractButton.doClick(AbstractButton.java:302)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1000)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1041)
at java.awt.Component.processMouseEvent(Component.java:5488)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
at java.awt.Component.processEvent(Component.java:5253)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3955)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1774)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)The problem is that SQL Developer 1.5.0/1 generates and executes a query that is not quite your original query to assist with the export dialog (presumably to populate the Columns tab). Note that it also does a single bulk fetch against this query, which can cause performance issues when trying to export the results of long running queries.
For the example query of:
select t.id, t2.id from t,t2;
this generated query is:
select * from ( select "ID","ID" from ( select t.id, t2.id from t,t2 ) )
The export works in 1.2.1 simply because they did not generate this additional query, but re-executed the original query.
theFurryOne -
Oracle 11g bug for column ambigously defined error
I have below format query running on Oracle 10g without any issues
select col1
from (select col1
from (select 'A' col1
from dual)
) v1
inner join (select col1 as col2
from (select 'A' col1
from dual)
) v2
on (v1.col1=v2.col2);
When I run the exact same query on Oracle 11g I get column ambiguously defined error. But when I change the query to as below it works fine on 11g
select v1.col1
from (select col1
from (select 'A' col1
from dual)
) v1
inner join (select col1 as col2
from (select 'A' col1
from dual)
) v2
on (v1.col1=v2.col2);
Is it because 11g ignores column alias in my inner queries.I'd tend to agree that this seems to be a bug in 11.1.0.7 (at least, that's the version I'm running it in)
It's not even that Oracle doesn't know about the column aliases, you can remove the aliases in the ON without a problem, i.e.
SELECT v1.col1
FROM
(SELECT col1 FROM
(SELECT 'A' col1 FROM dual
) v1
INNER JOIN
(SELECT col1 AS col2 FROM
(SELECT 'A' col1 FROM dual
) v2
ON (col1=col2);works fine. Using the old join syntax also seems to work fine
SELECT col1
FROM
(SELECT col1 FROM
(SELECT 'A' col1 FROM dual
) v1,
(SELECT col1 AS col2 FROM
(SELECT 'A' col1 FROM dual
) v2
WHERE (col1=col2);So it appears that something in the SQL 99 parser is broken. Have you logged a bug in Metalink?
Justin -
How to get rid of ROWID in Join query -- ORA-00918: column ambiguously defined
Hi, All
the source of my data block is from two tables Emp and Title. My select statements is:
select a.name, b.title, b.start_date, b.end_date from Emp a, Title b where a.id = b.emp_id
But at run time, I got "ORA-00918: column ambiguously defined"
the wrapped statement becomes:
SELECT ROWID,a.name, b.title, b.start_date, b.end_date from Emp a, Title b where a.id = b.emp_id
I run the query in SQL*PLUS, found out it was ROWID caused problem.
Can anybody tell me how to get rid of ROWID? or I missed something in datablock defination?
Thanks in adance.
DeborahI guess you are using oracle 7.x. In Oracle 8 and onwards, database lets you select ROWID from the views based on multiple views as long as view definition does not contain any aggregated functions or DISTINCT in it. Now coming back to forms ..Forms runtime engine uses ROWID to identify rows uniquely unless specified otherwise. If you are using forms 4.5/5.0 against Oracle 7.x , then change these properties and you should be able to run the form.
BLOCK PROPERTY
Key Mode : can be either updateable OR Non-updateable
( Certainly not 'Unique' .. That forces forms runtime engine to use ROWID to identify unique rows. )
ITEM PROPERTY
Identify one of the block items as unique. And then set the following property
Primary Key : True.
This should take care of rowid problem.
Regards,
Murali.
Hi, All
the source of my data block is from two tables Emp and Title. My select statements is:
select a.name, b.title, b.start_date, b.end_date from Emp a, Title b where a.id = b.emp_id
But at run time, I got "ORA-00918: column ambiguously defined"
the wrapped statement becomes:
SELECT ROWID,a.name, b.title, b.start_date, b.end_date from Emp a, Title b where a.id = b.emp_id
I run the query in SQL*PLUS, found out it was ROWID caused problem.
Can anybody tell me how to get rid of ROWID? or I missed something in datablock defination?
Thanks in adance.
Deborah -
Strange behaviuor (bug?) with view (ora-918 column ambiguously defined)
Hallo everybody,
the following code works as expected;
select substr(fire_id,-4,2) as ct,zone_id, count(fire_id),sum(a_total) from
(select *
from fire right join fire_zone using (fire_id)
where definition_id = 1
and checked = 1
and substr(fire_id,-4,2) in (21,23)
and fire_id between 190400000000 and 200900000000)
group by substr(fire_id,-4,2),zone_id
order by ct, zone_id
but when a define a view for the subquery:
create or replace view tempfire as
select *
from fire right join fire_zone using (fire_id)
where definition_id = 1
and checked = 1
and substr(fire_id,-4,2) in (21,23)
and fire_id between 190400000000 and 200900000000
and then run
select substr(fire_id,-4,2) as ct,zone_id, count(fire_id),sum(a_total) from tempfire
group by substr(fire_id,-4,2),zone_id
order by ct, zone_id
I got the error ora-00918 column ambiguously defined for zone_id.
Is this a bug or is there a reason?
Thank you in advance,
Cheers,
Boris
Edited by: boris on Nov 19, 2009 6:49 AM
Edited by: boris on Nov 19, 2009 6:52 AMuser503699
I followed your suggestion and now it works. Thank you !
But something is strange ... this is the result of the desc tempfire ... and all the column names are different ...
desc tempfire
Name Null Type
FIRE_ID NOT NULL NUMBER(12)
START_DATE DATE
END_DATE DATE
LOCALITY VARCHAR2(56)
X_COORD NUMBER(6)
Y_COORD NUMBER(6)
COORD_RELIABILITY_ID NUMBER(1)
ALTITUDE NUMBER(4)
SITE_ID NUMBER(1)
EXPO_ID NUMBER(1)
SLOPE NUMBER(3)
X_BUSH NUMBER(1)
X_COPPICE NUMBER(1)
X_COPPICE_MIXED NUMBER(1)
X_SELVA NUMBER(1)
X_HIGH_FOREST_HARDWOOD NUMBER(1)
X_HIGH_FOREST_SOFTWOOD NUMBER(1)
X_HIGH_FOREST_MIXED NUMBER(1)
X_PIONEER NUMBER(1)
X_FORESTATION NUMBER(1)
S_BUSH NUMBER(8,2)
S_COPPICE NUMBER(8,2)
S_COPPICE_MIXED NUMBER(8,2)
S_SELVA NUMBER(8,2)
S_HIGH_FOREST_HARDWOOD NUMBER(8,2)
S_HIGH_FOREST_SOFTWOOD NUMBER(8,2)
S_HIGH_FOREST_MIXED NUMBER(8,2)
S_PIONEER NUMBER(8,2)
S_FORESTATION NUMBER(8,2)
A_FOREST NUMBER(8,2)
A_GRASSLAND NUMBER(8,2)
A_NONPRODUCTIVE NUMBER(8,2)
A_TOTAL NUMBER(8,2)
D_CASTANEA NUMBER(1)
D_QUERCUS NUMBER(1)
D_FAGUS NUMBER(1)
D_BETULA NUMBER(1)
D_OTHER_HARDWOOD NUMBER(1)
D_PINUS NUMBER(1)
D_PICEA NUMBER(1)
D_LARIX NUMBER(1)
D_OTHER_SOFTWOOD NUMBER(1)
DIAMETER NUMBER(3)
LITTER_ID NUMBER(1)
HERB_LAYER_ID NUMBER(1)
BUSH_LAYER_ID NUMBER(1)
FIRE_SURFACE NUMBER(1)
FIRE_CROWN NUMBER(1)
FIRE_SINGLE_TREE NUMBER(1)
FIRE_SUBSURFACE NUMBER(1)
DAMAGE_FOREST_ID NUMBER(1)
DAMAGE_SOIL_ID NUMBER(1)
HEIGHT_DAMAGE NUMBER(4,2)
F_PROTECTION NUMBER(1)
F_ECONOMIC NUMBER(1)
F_RECREATION NUMBER(1)
CAUSE_ID NUMBER(2)
OTHER_CAUSE VARCHAR2(200)
CAUSE_RELIABILITY_ID NUMBER(1)
ALARM_FORESTDEP DATE
CHECKED NUMBER(1)
DATA_FROM_FORESTDEP NUMBER(1)
DATA_FROM_FIREMANDEP NUMBER(1)
DATA_FROM_HISTORY NUMBER(1)
INSERT_DATE DATE
INSERT_BY VARCHAR2(16)
UPDATE_DATE DATE
UPDATE_BY VARCHAR2(16)
OLD_TI_AFFDFO VARCHAR2(1)
OLD_TI_S_SPES NUMBER(8,2)
OLD_TI_PICFOR VARCHAR2(1)
OLD_TI_FIRE_TYPE VARCHAR2(1)
OLD_TI_DOMINANT_SPECIES VARCHAR2(1)
OLD_TI_CAUSE VARCHAR2(2)
OLD_TI_FOREST_TYPE VARCHAR2(1)
START_DATE_RELIABILITY_ID NUMBER(1)
END_DATE_RELIABILITY_ID NUMBER(1)
DEFINITION_ID NUMBER(1)
ZONE_ID NOT NULL NUMBER(8)
79 rows selected
I'm still interested hoe to use hints. Can anybody tell me?
Thank you
Boris -
'column ambiguously defined' due to automatic addition of rowid to every JDBC calls
We are using Weblogic 6.0 spf 1 and Oracle as back end.
When ever we fire an SQL using JDBC, Weblogic automatically adds 'rowid' to the
select clause and fires the SQL. If Oralce returns the error 'ORA-00918: column
ambiguously defined', the rowid is removed and the SQL is run as requested.
For example, when we say -
SELECT *
FROM SOME_TABLE
Rowid is added blindly and executed query will be
SELECT rowid, *
FROM SOME_TABLE
Oracle throws 'Column Ambigiously defined'. Upon this error weblogic fires originally
requested query
SELECT *
FROM SOME_TABLE
Another condition where it always fails is in case of SQL joins.
Is there any way to avoid adding rowid to the SQL statments?
Thanks
SatishI would appreciate an answer to this same question: "Can the automatic addition of rowid after the select be prevented"? as it is causing several index hints to be rejected.
-
Table names and column names defined by other languages, not English.
Hi, everyone.
I am wondering if there are any possible problems or any inconvenience
when I define table names and column names by Japanese, not English.
Currently, we are using SQL server 2000 as a db and windows as a operating
system. In the near future, we have the plan to change the database software
and operating system to "Oracle 10g" and "Linux O/S".
I have not experienced the oracle database, which has table names and column
names defined by other languages, not English.
Personally, I would like to use English as table names and column names.
In this case, I might have to provide appropriate reasons.
Are there any possible problems or any "inconvenience" in terms of
system maintenance, development, or something else ?
What could be pros and cons in this case?
Thanks in advance.
Have a nice day.
Best Regards.
Ho.First you need to make sure your database has character set that support Japanese.
Choosing a Character Set
http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14225/ch2charset.htm#i1007681
The main "inconvenience" you will have is if the client doesn't support Japanese or unicode, it will have trouble to access the table.
And say in future after the application been developed, you want to implement the schema in some English environment, you will have hard time to do it.
My point is English tablename and column names doesn't prevent you use it in Japanese environment and save Japanese data but not vice-versa. Hope you understand. -
Column Ambiguosly Define error
Hi,
I have a query that goes like this
select * from
( select a.data1, b.data2
from table1 a, table2 b
where a.xxx = b.xxx
union all
select a1.data1, b1.data2
from table11 a1, table21 b1
where a1.xxx1 = b1.xxx1
union all
select a2.data1, b2.data2
from table31 a2, table32 b2
where a2.xxx2 = b2.xxx2
when i run this query, i get the error "*Column Ambiguosly Defined*" error. However when i run the query without hte explicit select i.e.
select a.data1, b.data2
from table1 a, table2 b
where a.xxx = b.xxx
union all
select a1.data1, b1.data2
from table11 a1, table21 b1
where a1.xxx1 = b1.xxx1
union all
select a2.data1, b2.data2
from table31 a2, table32 b2
where a2.xxx2 = b2.xxx2
this query returns valid data. i need this data to be part of a custom report and need to add the select * from to the whole result set.
Please respond to this query and provide me with a valid solution for the same.
Thanks in advance
BharathYour constant re-posting of this message is NOT increasing your chances of getting a solution.
This forum is not a chat line, and it is not paid support.
No one is responsible for monitoring it and giving a quick response.
Furthermore, it is a global forum. The person with the information you seek may very well live 20 time zones away from you and was going to bed just as you posted. He will not even see your post for several more hours.
Your original post went up in the middle of the night for half the world.
No one with the information you seek is deliberately withholding it until you sound sufficiently desperate. -
Column Ambigiously defined error message
I'm getting Column Ambigiously defined error message. How do I fix it ?
select c.guid,d.teritorryname,a.permission,e.CLASSIFICATIONNAME from Apps_PERMISSION a , Apps_PERMISSION_CLASSIFICATION b , Apps_USER_MASTER c ,Apps_TERRITORY_MASTER d , Apps_CLASSIFICATION_MASTER e where a.PERMISSIONID=b.PERMISSIONID and a.TERRITORYID=d.TERRITORYID and a.USERID=c.USERID and b.CLASSIFICATIONID=e.CLASSIFICATIONID and a.USERID IN (select userid from Apps_USER_MASTER ) order by useridMay be
select c.guid,d.teritorryname,
DECODE(a.permission,1,'Create',2,'View',3,'Edit'),
e.CLASSIFICATIONNAME from Apps_PERMISSION a , Apps_PERMISSION_CLASSIFICATION b , Apps_USER_MASTER c ,Apps_TERRITORY_MASTER d , Apps_CLASSIFICATION_MASTER e where a.PERMISSIONID=b.PERMISSIONID and a.TERRITORYID=d.TERRITORYID and a.USERID=c.USERID and b.CLASSIFICATIONID=e.CLASSIFICATIONID and a.USERID IN (select userid from Apps_USER_MASTER ) order by a.useridOr you can use CASE also. -
ORA-00918: column ambiguously defined : while using inner Select
Hi
could you please help me to solve the following from.
I have a query like this
SELECT * FROM (SELECT ZMV.VENDOR_NAME,FR.PO_NUM,ZMV.PART_NUMBER,FR.ZAC_ITEM_DESCRIPTION,ZMV.QUANTITY_ORDERED,FR.QUANTITY_RECEIVED,ZMV.PO_UOM_CODE,FR.VENDOR_INV,FR.FORWARDER_REF,FR.PCS,TY.DESCRIPTION,FR.GROSS_WGT,FR.NET_WGT,FR.CFT,TR.DESCRIPTION,FR.PRO,FR.FORWARDER_REMARK,FR.RECAP_ID,FR.ZAC_REMARK,FR.SHIPMENT_BY FROM FWD_RECAP FR,ZAC_METRO_VIEW ZMV,FWD_MASTER_TYPE TY,FWD_MASTER_TRUCK TR WHERE FR.TYPE_ID=TY.TYPE_ID AND FR.TRUCK_ID=TR.TRUCK_ID AND FR.PO_LINE_ID=ZMV.PO_LINE_ID AND FR.PACKAGE_ID=0 AND FR.OPERATIONING_UINT_ID=511 AND FR.FORWARDER='METRO,ITALY' ORDER BY FR.PO_LINE_ID DESC) WHERE ROWNUM <=10
But while executing the following error showing,
SELECT * FROM (SELECT ZMV.VENDOR_NAME,FR.PO_NUM,ZMV.PART_NUMBER,FR.ZAC_ITEM_DESCRIPTION,ZMV.QUANTIT
ERROR at line 1:
ORA-00918: column ambiguously defined
For this problem i got some answers from web sites, they saying as follows, but i am using like that only.
(ORA-00918: COLUMN AMBIGUOUSLY DEFINED)
Use table aliases and prefix all column names by their aliases when more than one table is involved in a query. This reduces parse time AND prevents future syntax errors if someone adds a column to one of the tables with the same name as a column in another table.
awaiting your immediate reply
Thankyou
Jobin [[email protected]]In your inline view you have fields
TY.DESCRIPTION and TR.DESCRIPTION which are the same
name DESCRIPTION for covered SQL.
place TY.DESCRIPTION TY_DESCRIPTION and
TR.DESCRIPTION TR_DESCRIPTION in your code:
SELECT * FROM (SELECT ZMV.VENDOR_NAME,FR.PO_NUM,ZMV.PART_NUMBER,FR.ZAC_ITEM_DESCRIPTION,ZMV.QUANTITY_ORDERED,FR.QUANTITY_RECEIVED,ZMV.PO_UOM_CODE,FR.VENDOR_INV,FR.FORWARDER_REF,FR.PCS,TY.DESCRIPTION TY_DESCRIPTION ,FR.GROSS_WGT,FR.NET_WGT,FR.CFT,TR.DESCRIPTION TR_DESCRIPTION,FR.PRO,FR.FORWARDER_REMARK,FR.RECAP_ID,FR.ZAC_REMARK,FR.SHIPMENT_BY FROM FWD_RECAP FR,ZAC_METRO_VIEW ZMV,FWD_MASTER_TYPE TY,FWD_MASTER_TRUCK TR WHERE FR.TYPE_ID=TY.TYPE_ID AND FR.TRUCK_ID=TR.TRUCK_ID AND FR.PO_LINE_ID=ZMV.PO_LINE_ID AND FR.PACKAGE_ID=0 AND FR.OPERATIONING_UINT_ID=511 AND FR.FORWARDER='METRO,ITALY' ORDER BY FR.PO_LINE_ID DESC) WHERE ROWNUM <=10
Rgds -
Hi,
Our oracle version has been upgraded from 10g to 11g.
After upgrade we face serious problem in compiling several packages, procedures and views and that throws an error "Column Ambiguously Defined", which was running perfectly in 10g version.
I have come through several blogs like, this problem occurs for many ppl as part of upgrade from 10g to 11g and the only solution is to change the code.
But in our case we have many numbers of objects like procedures, packages and views where this error occurs, do we have any common solution for overcome this problem (without changing the code)?
Regards,
Ananthe7a47215-0e59-4d88-a082-7ad5e83ce5b0 wrote:
Hi,
Our oracle version has been upgraded from 10g to 11g.
After upgrade we face serious problem in compiling several packages, procedures and views and that throws an error "Column Ambiguously Defined", which was running perfectly in 10g version.
I have come through several blogs like, this problem occurs for many ppl as part of upgrade from 10g to 11g and the only solution is to change the code.
But in our case we have many numbers of objects like procedures, packages and views where this error occurs, do we have any common solution for overcome this problem (without changing the code)?
Regards,
Ananth
You will need to bite the bullet & change the code -
Getting error Column ambiguosly defined even though column is referenced
select dh_events.case_id
FROM ah_events_to_drgs FULL OUTER JOIN dh_events
ON ah_events_to_drgs.case_id=dh_events.case_id
and ah_events_to_drgs.case_id='2007SP000006'
getting error Column ambiguosly defined even though column is referenced, Please let me know why it is giving error.
Thanks
MurthyCould you demonstrate this in details ?
SQL> create table ah_events_to_drgs (case_id varchar2(20));
Table created.
SQL> create table dh_events (case_id varchar2(20));
Table created.
SQL> select dh_events.case_id
2 FROM ah_events_to_drgs FULL OUTER JOIN dh_events
3 ON ah_events_to_drgs.case_id=dh_events.case_id
4 and ah_events_to_drgs.case_id='2007SP000006'
5 /
no rows selected
SQL> select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - ProductionRgds -
Getting an error-column ambigiusly defined
MERGE INTO TEMP_MED_PARTIAL_RECORDS_0002 Tmpr
USING (SELECT callstart,
seqno,
totduration,
callreleasetime mplcallreleasetime,
connectedcallingnumber mplconnectedcallingnumber,
mplimsi,
mplchargingid,
msisdn mplsisdn,
FILEID mplfileid,
FILENAME mplfilename,
SLNO mplslno,
IMEI mplimei,
UTCTIMEOFFSET mplutctimeoffset,
CAUSEFORTERMINATION mplcausefortermination,
CALLTYPE mplcalltype,
SERVICETYPE mplservicetype,
SERVICECODE mplservicecode,
SUPPLSERVICECODE mplsupplservicecode,
DIALLEDDIGITS mpldialleddigits,
CONNECTEDCALLINGNUMBER mplconnectedcallingnumber,
THIRDPARTYNUMBER mplthirdpartynumber,
RECORDINGENTITYIDENTIFICATION mrecordingentityidentification,
CALLREFERENCE mplcallreference,
ACCESSPOINTNAMENI mplaccesspointnameni,
ACCESSPOINTNAMEOI mplaccesspointnameoi,
SGSNADDRESS mplsgsnaddress ,
GGSNADDRESS mplggsnaddress,
CHARGEAMOUNT mplchargeamount,
MSISDN mmsisdn,
PDPADDRESS mplpdpaddress,
PLMNID mplplmnid ,
CELLID mplcellid ,
LOCATIONAREACODE mpllocationareacode ,
RES_1 mplres1,
RES_2 mplres2,
RES_3 mplres3,
RES_4 mplres4,
RES_5 mplres5,
CALLRELEASETIME mplcallreleasetime
FROM (
SELECT MIN (CALLEVENTSTARTTIMESTAMP) callstart,
MAX (sequence_number) seqno,
SUM (CALLEVENTDURATION) totduration,
imsi mplimsi,
SUM(DATAVOLUMEINCOMING) download,
SUM(DATAVOLUMEOUTGOING) upload,
chargingid mplchargingid
FROM MED_PARTIAL_RECORDS_0002_LOAD
GROUP BY chargingid,imsi
) subset ,
(select FILEID ,
FILENAME ,
SLNO ,
IMEI ,
UTCTIMEOFFSET ,
CAUSEFORTERMINATION ,
CALLTYPE ,
SERVICETYPE ,
SERVICECODE ,
SUPPLSERVICECODE ,
DIALLEDDIGITS ,
CONNECTEDCALLINGNUMBER ,
THIRDPARTYNUMBER ,
RECORDINGENTITYIDENTIFICATION ,
CALLREFERENCE ,
ACCESSPOINTNAMENI ,
ACCESSPOINTNAMEOI ,
SGSNADDRESS ,
GGSNADDRESS ,
CHARGEAMOUNT ,
MSISDN ,
PDPADDRESS ,
PLMNID ,
CELLID ,
LOCATIONAREACODE ,
RES_1 ,
RES_2 ,
RES_3 ,
RES_4 ,
RES_5,
callreleasetime,
sequence_number,
imsi,
chargingid
from MED_PARTIAL_RECORDS_0002_LOAD
) subsetinfo
where
SUBSETINFO.IMSI=subset.mplimsi
and
subsetinfo.chargingid=subset.mplchargingid
and
subsetinfo.sequence_number=subset.seqno
mpl
on
(tmpr.imsi=mpl.mplimsi
and
tmpr.chargingid=mpl.mplchargingid
and
tmpr.sequence_number=mpl.seqno+1
WHEN MATCHED THEN ---------------------column ambigiously defined
update SET sequence_number=seqno,
CALLEVENTDURATION= totduration,
datavolumeincoming =downloabytes,
datavolumeoutgoing=uploadbytes;May be this error on following column names.
Change aliases and try again
connectedcallingnumber mplconnectedcallingnumber,
CAUSEFORTERMINATION mplcausefortermination,
CONNECTEDCALLINGNUMBER mplconnectedcallingnumber,
RECORDINGENTITYIDENTIFICATION mrecordingentityidentification,
ACCESSPOINTNAMENI mplaccesspointnameni,
ACCESSPOINTNAMEOI mplaccesspointnameoi,
LOCATIONAREACODE mpllocationareacode , -
Getting an error-column ambigiously defined
DECLARE
p_temptablename VARCHAR2(30);
p_loadtablename VARCHAR2(30);
p_retval number;
BEGIN
p_retval := 0;
MERGE INTO TEMP_MED_PARTIAL_RECORDS_0002 Tmpr
USING (SELECT callstart,
seqno,
totduration,
callreleasetime mplcallreleasetime,
connectedcallingnumber mplconnectedcallingnumber,
mplimsi,
mplchargingid,
msisdn mplsisdn,
FILEID mplfileid,
FILENAME mplfilename,
SLNO mplslno,
IMEI mplimei,
UTCTIMEOFFSET mplutctimeoffset,
CAUSEFORTERMINATION mplcausefortermination,
CALLTYPE mplcalltype,
SERVICETYPE mplservicetype,
SERVICECODE mplservicecode,
SUPPLSERVICECODE mplsupplservicecode,
DIALLEDDIGITS mpldialleddigits,
CONNECTEDCALLINGNUMBER mplconnectedcallingnumber,
THIRDPARTYNUMBER mplthirdpartynumber,
RECORDINGENTITYIDENTIFICATION mrecordingentityidentification,
CALLREFERENCE mplcallreference,
ACCESSPOINTNAMENI mplaccesspointnameni,
ACCESSPOINTNAMEOI mplaccesspointnameoi,
SGSNADDRESS mplsgsnaddress ,
GGSNADDRESS mplggsnaddress,
CHARGEAMOUNT mplchargeamount,
MSISDN mmsisdn,
PDPADDRESS mplpdpaddress,
PLMNID mplplmnid ,
CELLID mplcellid ,
LOCATIONAREACODE mpllocationareacode ,
RES_1 mplres1,
RES_2 mplres2,
RES_3 mplres3,
RES_4 mplres4,
RES_5 mplres5,
CALLRELEASETIME mplcallreleasetime
FROM (
SELECT MIN (CALLEVENTSTARTTIMESTAMP) callstart,
MAX (sequence_number) seqno,
SUM (CALLEVENTDURATION) totduration,
imsi mplimsi,
SUM(DATAVOLUMEINCOMING) download,
SUM(DATAVOLUMEOUTGOING) upload,
chargingid mplchargingid
FROM MED_PARTIAL_RECORDS_0002_LOAD
GROUP BY chargingid,imsi
) subset ,
(select FILEID ,
FILENAME ,
SLNO ,
IMEI ,
UTCTIMEOFFSET ,
CAUSEFORTERMINATION ,
CALLTYPE ,
SERVICETYPE ,
SERVICECODE ,
SUPPLSERVICECODE ,
DIALLEDDIGITS ,
CONNECTEDCALLINGNUMBER ,
THIRDPARTYNUMBER ,
RECORDINGENTITYIDENTIFICATION ,
CALLREFERENCE ,
ACCESSPOINTNAMENI ,
ACCESSPOINTNAMEOI ,
SGSNADDRESS ,
GGSNADDRESS ,
CHARGINGID ,
CHARGEAMOUNT ,
MSISDN ,
PDPADDRESS ,
PLMNID ,
CELLID ,
LOCATIONAREACODE ,
RES_1 ,
RES_2 ,
RES_3 ,
RES_4 ,
RES_5,
callreleasetime,
sequence_number,
imsi,
chargingid
from MED_PARTIAL_RECORDS_0002_LOAD
) subsetinfo
where
SUBSETINFO.IMSI=subset.mplimsi -----------column abbigiuosly defined
and
subsetinfo.chargingid=subset.mplchargingid -----------column abbigiuosly def
and
subsetinfo.sequence_number=subset.seqno
mpl
on
(tmpr.imsi=mplimsi
and
tmpr.chargingid=mplchargingid
WHEN MATCHED THEN
update SET sequence_number=seqno,
--CALLEVENTSTARTTIMESTAMP=callstart,
CALLEVENTDURATION= totduration,
datavolumeincoming =downloabytes,
datavolumeoutgoing=uploadbytes
WHEN NOT MATCHED THEN
INSERT (FILEID,
FILENAME,SLNO,IMSI,IMEI,CALLEVENTSTARTTIMESTAMP,UTCTIMEOFFSET,CALLEVENTDURATION,CAUSEFORTERMINATION,CALLTYPE,
SERVICETYPE,SERVICECODE,SUPPLSERVICECODE,DIALLEDDIGITS,
CONNECTEDCALLINGNUMBER,THIRDPARTYNUMBER,RECORDINGENTITYIDENTIFICATION,CALLREFERENCE,ACCESSPOINTNAMENI,ACCESSPOINTNAMEOI,DATAVOLUMEINCOMING,
DATAVOLUMEOUTGOING,SGSNADDRESS,
GGSNADDRESS,CHARGINGID,CHARGEAMOUNT,MSISDN,PDPADDRESS,PLMNID,CELLID,LOCATIONAREACODE,RES_1,RES_2,RES_3,RES_4,RES_5,CALLRELEASETIME,SEQUENCE_NUMBER
values
(mplFILEID,mplFILENAME,mplSLNO,mplIMSI,mplIMEI,callstart,mplUTCTIMEOFFSET,totduration,mplCAUSEFORTERMINATION,mplCALLTYPE,mplSERVICETYPE,mplSERVICECODE,mplSUPPLSERVICECODE,
mplDIALLEDDIGITS,mplCONNECTEDCALLINGNUMBER,mplTHIRDPARTYNUMBER,mRECORDINGENTITYIDENTIFICATION,mplCALLREFERENCE,mplACCESSPOINTNAMENI,mplACCESSPOINTNAMEOI,mplDATAVOLUMEINCOMING,mplDATAVOLUMEOUTGOING,mplSGSNADDRESS,
mplGGSNADDRESS,mplCHARGINGID,mplCHARGEAMOUNT,mplMSISDN,mplPDPADDRESS,mplPLMNID,mplCELLID,mplLOCATIONAREACODE,mplRES1,mplRES2,mplRES3,mplRES4,mplRES5,callend,seqno);
--commit
exception
when others then
--ROLLBACK
p_retval:=-1;
p3_errorlog('partial_stiching',SQLERRM);
--COMMIT;*/
end;
/Handle: user8731258
Status Level: Newbie
Registered: Aug 20, 2009
Total Posts: 293
Total Questions: 129 (121 unresolved) -
Eclipselink producing incorrect sql - ORA-00918: column ambiguously defined
We have a table with many columns .A1 .A2 .A3.... .A125 .N1 .N2 .N3... .N95 and with a simple jpql join it comes up with 2 columns that are ...AS N1150 and causing an ambiguous column error ...
Does any one know of a valid workround or if this is a known bug. No problems were present in toplink, just eclipselink....
it appears to be doing a count and suffixing the count to the column name to make sure the columns have unique id's - but failing:
K1 -> K1 _1_
N41 -> N41 _2_
N11 -> N11 _50_
... then 100 columns later
N1 -> N1 _150_
the jpql is :
@NamedQuery(name=NamedQueryNames.XREF_IMPORT_SELECT,
query="SELECT t FROM Tran t, Xref x "+
" WHERE t.key = x.a1 "+
" AND x.key.k1 = :partial "+
" AND x.key.k2 LIKE :partialX " +
" ORDER BY x.key.k2")
Tran has fields k1,k2, a1, a2...a125, n1, n2...n95
xref has k1,k2,a1,a2..a5, n1,n2,n3
the sql eclipse link produces for the query is :
SELECT *
FROM
(SELECT
/*+ FIRSTROWS */
a.*,
ROWNUM rnum
FROM
(SELECT t1.K1 AS K11,
t1.N41 AS N412,
t1.N40 AS N403,
t1.N45 AS N454,
t1.N44 AS N445,
t1.A120 AS A1206,
t1.N43 AS N437,
t1.A121 AS A1218,
t1.N42 AS N429,
etc
t1.N25 AS N2547,
t1.N10 AS N1048,
t1.N12 AS N1249,
t1.N11 AS N1150,
t1.N17 AS N1751,
a load more columns
t1.A65 AS A65147,
t1.A68 AS A68148,
t1.A67 AS A67149,
t1.N1 AS N1150,
t1.A41 AS A41151,
t1.N5 AS N5152,
etc
FROM COREXFA t0,
CORETRA t1
WHERE (((t1.K1 = t0.A1)
AND (t0.K1 = ?))
AND (t0.K2 LIKE ?))
ORDER BY t0.K2 ASC
) a
WHERE ROWNUM <= ?
WHERE rnum > ?This issue is cause by the aliasing done because you are using firstResult/maxResult. I think there is already a bug logged for this issue, please vote for the bug.
See,
http://old.nabble.com/Duplicate-aliases-generated-for-columns-%281.1.3%29-td28039552.html
Some workarounds would be,
- avoid using firstResult/maxResult
- rename the columns
- use native SQL
- use a cursor query instead of firstResult/maxResult
James : http://www.eclipselink.org
Maybe you are looking for
-
G/L Accounts Balance by days
Hello, can anybody help how to display account balance by days? Is there any report? thanks D.
-
Hi guys, we have a batch job for 1. creating invoice 2. and printing invoices. How do i identify the background job being used for the above two. REgards, Anand
-
How tp push data from VDS view to Identity Store
Hi, i have created a view in VDS which connects two datasource. Both the datasource are DB. i'm joining 2 table from two different DB server. i want to push this view data from VDS to identity store. Please help. Regards, Pricy
-
Changing CP4-filetype in Win 64-bit
Hello, Do have an issue on a Win7 64-bit laptop. Installed: eLearning Suite 1, Technical Communication suite 2 and eLearning Suite 2. For some reasons CP4-files are recognized as Captivate 5 filetype, which means that I cannot open existing files any
-
In our manager most of the manager that had relationships of chief used MSS. There is also a Professional manager for example a nurses professional manager that responsibe not direct but Professional on all the nuses in the organization. She had a