ORA-00918 issue joining tables for Update
Hi,
I have 2 tables : PAR_SPEC_OPS and T_PAR and I'm trying to update 2 columns in the first one with values from the second table.
Here's my script :
Update
Select membership_id, membership_status
From Par_Spec_Ops P,T_Par T
Where P.Tracking_ID=T.Tracking_ID
Set P.membership_id = T.membership_id,
P.membership_status = T.membership_status;
Running this gives me ORA-00918: column ambiguously defined. I've looked this up and it says it happens when there's a common column in the 2 tables and I'm not using prefixes, but as you can see from my command, I'am using prefixes. I have tried with and without alias but I get the same error.
Do you guys have any ideas?
Thanks and regards,
Ionut
Edited by: 837311 on Nov 8, 2011 4:24 AM
Does this help?
SQL> create table t_par
2 (membership_id number,
3 membership_status varchar2(10),
4 tracking_id number
5 );
Table created.
SQL>
SQL> create unique index t_par_ix1 on t_par(tracking_id);
Index created.
SQL>
SQL> create table par_spec_ops
2 (membership_id number,
3 membership_status varchar2(10),
4 tracking_id number
5 );
Table created.
SQL>
SQL> create unique index tracking_id_ix1 on par_spec_ops(tracking_id);
Index created.
SQL>
SQL> insert into t_par values(111,'new',1111);
1 row created.
SQL> insert into t_par values(222,'new',2222);
1 row created.
SQL> insert into t_par values(333,'new',3333);
1 row created.
SQL>
SQL> insert into par_spec_ops values(111,'expired',1111);
1 row created.
SQL> insert into par_spec_ops values(222,'expired',2222);
1 row created.
SQL>
SQL> Select t.membership_id, t.membership_status,p.membership_id,p.membership_status
2 From T_Par T left outer join par_spec_ops p using(tracking_id)
3 ;
MEMBERSHIP_ID MEMBERSHIP MEMBERSHIP_ID MEMBERSHIP
111 new 111 expired
222 new 222 expired
333 new
SQL>
SQL> Update
2 (
3 Select p.membership_id as p_m_id,
4 t.membership_id as t_m_id,
5 t.membership_status t_m_stat,
6 p.membership_status p_m_stat
7 From Par_Spec_Ops P,T_Par T
8 Where P.Tracking_ID=T.Tracking_ID
9 )
10 Set p_m_id = t_m_id,
11 p_m_stat = t_m_stat;
2 rows updated.
SQL>
SQL> Select t.membership_id, t.membership_status,p.membership_id,p.membership_status
2 From T_Par T left outer join par_spec_ops p using(tracking_id)
3 ;
MEMBERSHIP_ID MEMBERSHIP MEMBERSHIP_ID MEMBERSHIP
111 new 111 new
222 new 222 new
333 new
SQL>
Similar Messages
-
dear all ,
am using Jdeveloper 11.1.1.3 with oracle database 10g,
now what i need to do is when inserting a new row in one of my entities i need to lock the entire database table until the commit happen...
i'll explain to u why I need to do this,,, let say that the table x contains the following columns
x_pk number, ( which is the primary key )
x_serial number,
x_type varchar2 );
now am getting x_pk from a sequence on a database so its not a problem,
but for x_serial it needs to be serialized per x_type , now in oracle forms developer i used to do the following in per-insert trigger on the block level-->
lock table for update then selecting the max serial per the type then use it for setting the :x_serial that is in the same block...
now in ADF , i should do this in the do_dml when the operation==DML_INSERT but am not sure what to write and if it will be working same as it was in the form developer
thanks ,
LamaDelta,
I wrote a [url http://stegemanoracle.wordpress.com/2006/03/15/using-updatable-views-with-adf/]blog post some time ago for an earlier version of JDeveloper that implemented some custom locking behaviour for EOs - perhaps you can adapt the technique there to your needs?
John -
Updatable View issues: cannot select FOR UPDATE from view with DI
Hi All,
I have a simple view XY and an instead of trigger on that to insert data into one table which is used in the my view. When I do insert statement on view XY it is working fine from sql but when i used same thing with page process of " Process Row of XY Automatic Row Processing (DML) " i am getting following error. I am using APEX 3.0 . Please help me.
ORA-20001: Error in DML: p_rowid=xxxx, p_alt_rowid=abc, p_rowid2=, p_alt_rowid2=. ORA-02014: cannot select FOR UPDATE from view with DISTINCT, GROUP BY, etc.
ThanksJames,
are you already on 3.0.1.00.07 or 3.0.1.00.08? Have a look at the release notes, it says something about a bug fix for some occurrences of ORA-02014.
Also have a look at the new substitution value/item FSP_DML_LOCK_ROW which turns locking off if you set it to FALSE. See http://www.oracle.com/technology/products/database/application_express/html/3.0.1_readme.html#CHDIDIAF and also http://download-west.oracle.com/docs/cd/B32472_01/doc/appdev.300/b32471/advnc.htm#BCGFDAIJ
Patrick
My APEX Blog: http://inside-apex.blogspot.com
The ApexLib Framework: http://apexlib.sourceforge.net
The APEX Builder Plugin: http://apexplugin.sourceforge.net/ New! -
What is the better way to join table for ASE 12.5?
To join table with T-SQL, there are 2 options:
select * from tab1 a join tab2 b on a.id = b.id where x=y
select * from tab1a, tab2 b where a.id = b.id and x=y
this is only a syntax difference or there is a performance difference? which one is better for performance?The first query (using the join clause) is the ANSI standard way of writing joins and is usually supported by all mainstream RDBMSs.
The second query is the T-SQL method of writing joins and may have limited re-usability with other RDBMSs.
In most cases which one you use is usually one of preference, ie, which ever one you're comfortable with.
From a technical perspective there are some join constructs that you cannot build with T-SQL joins, but can build with ANSI joins (eg, you may have problems in T-SQL with a table that you want to be both a) an inner table of an outer join and b) part of a equi/inner join).
Soooo, ANSI joins provide you a lot more flexibility in coding as well as portability (between other RDBMSs). But if you're going to work with ASE you'll still need to understand how T-SQL joins work as you'll see quite a lot of T-SQL join-based queries. -
Additional field in join table for CMP EJB
Hello,
I'm trying to perform this task using CMP entity beans:
The entity A has a CMR relation of cardinality m-n with entity B (bidirectional) (This is working fine).
I want to add a parameter to the relation.
Ex : When I find that A1 is linked to B1, I need to perform "x" times an action. x would be my parameter, and I would have kept this parameter as an additional column in the join table A_TO_B.
Could anyone provide an example of how to perform this with CMP EJB?
NOTE: I'm using OC4J 10g 9.0.4 standalone (and cannot change my version).
Thanks
TanguyManohar,
You need to create an append structure for table VBAP (for example ZAVBAP) using SE11. In this structure you create your ZZ fields. If you need a non-SAP domain/data element for your field then you need to create it first using the same transaction and activate it. Attach ZAVBAP to VBAP so the SE11 shows:
.APPEND in the Fields column and
ZAVBAP in the Field type column.
Your ZZ fields will be shown automatically.
When you have finished then activate your ZAVBAP structure. You will notice when you go VA01 (for example) that a lot of programs are being recompiled. Don't worry. It will be ok.
The user-exit screen number for items is 8459 (in program SAPMV45A).
Thanks,
Wojtek -
Joining tables for Mobile apps
can i access multiple table(like normal join) from one CallResponder's token for my mobile apps(flex 4.6)..if we can ,then how can we do this..i think, there is some solution,but i'm not aware of it.. please give me a short demo or link..how can you join table,by data binding.. thanks..
+1 for this. it's taking a while to lad on my 2 year old ipad mini, so this would probably help. though in my case, it's going to be an iOS install that needs to ho on a diet.i haven't worked out if it's the player part of the spp that's swelling or additional social aspects of the app that sre growing in size unecessarily.all things said, a music player shouldn't really need to be 75mb+.the android install on my htc m8s is about 13mb, by comparision, less than 2 thirds of the install size.
-
FM for locking n unlocking a table for update
I have to update a table named bnka, can anyone tel me the FM for locking and unlocking a table before updating the same..
thnkx
amityou can use FM ENQUEUE_EFBNKA to lock the table vbak
and DEQUEUE_EFBNKA to unlock it
Example:
call function 'ENQUEUE_EFBNKA'
EXPORTING
MODE_BNKA = 'E'
BANKS = bnka-banks
BANKL = bnka-bankl
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2
OTHERS = 3.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
update BNKA .....
call function 'DEQUEUE_EFBNKA'
EXPORTING
MODE_BNKA = 'E'
BANKS = bnka-banks
BANKL = bnka-bankl. -
Jobs related issue (how table BDCP updated)
hi expert,
job xxxxx is running in R/3 which update other system (3plp).
The main concept is that. Whatever changes taken place in master
Data this change is passes through Idoc to other system.
My issue is related to customer master data. Job is including those
customer( 321304) which have not been change. I can see this customer
number in job spool. But when I see changes in customer master (321304)
there is no change on that date. So this behavior is wrong.
Job must include those customers who are changed on that date.
Jobs is running fine for more customer but, not working fine for few customer
In ABAP analysis I found that
the program it calls the standard Function Module CHANGE_POINTERS_READ. The function module outputs the customer 321304 and change pointer number 198919387. But when I checked this customer, it hasnu2019t been changed since 2007.
Then I checked table BDCP (for change pointers) and got this:
I donu2019t know how table BDCP was updated and why change pointer 198919387 was created for KNA1.
Regds
alicia kHi Alicia,
Kindly check this to find how BDCP gets updated.
Change pointers are R/3 objects that mark changes to SAP master data. Change pointers are managed by mechanisms in a Shared Master Data (SMD) tool and are based on Change Document (CD) objects. CD objects record the changes occurring to master data at a field level. These changes are stored in tables CDHDR (header table) and CDPOS (detail table). ALE configuration provides a link between CD objects and change pointers. Internal mechanisms update tables BDCP and BDCPS, which host the change pointers. While CD objects are application-data-specific, the processing status of change pointers is message-type-specific. Also, the ALE change pointers are activated first at a general level and then at the message-type level.
Change pointers are log entries to table BDCP which are written every time a transaction modifies certain fields.
Dont forget to reward points if found useful.
Thanks,
Satyesh -
Problem with ORA-19025 when joining tables
I am querying a table that stores xml datata in an xml column. I an query this column without problems. If I join the table with another table (not xml). I get the error below.
ORA-19025: EXTRACTVALUE returns value of only one node
19025. 00000 - "EXTRACTVALUE returns value of only one node"
*Cause: Given XPath points to more than one node.
*Action: Rewrite the query so that exactly one node is returned.
I don't seem to have any subnodes in the fields I am querying and I dont know how joining to the second table introduces the problem.
This produces the error I mentioned before
SELECT a.NAME,
EXTRACTVALUE(xmltype(a.DOCUMENTATION), '/metadata//idinfo/citation/citeinfo/title') TITLE,
EXTRACTVALUE(xmltype(a.DOCUMENTATION), '/metadata//idinfo/citation/citeinfo/origin') ORIGIN,
EXTRACTVALUE(xmltype(a.DOCUMENTATION), '/metadata//idinfo/citation/citeinfo/pubdate') PUBLICATION_DATE,
GDB_ITEMTYPES.NAME
FROM GDB_ITEMS_vw a, GDB_ITEMTYPES b
where a.UUID = b.UUID
This one gives no error
SELECT a.NAME,
EXTRACTVALUE(xmltype(a.DOCUMENTATION), '/metadata//idinfo/citation/citeinfo/title') TITLE,
EXTRACTVALUE(xmltype(a.DOCUMENTATION), '/metadata//idinfo/citation/citeinfo/origin') ORIGIN,
EXTRACTVALUE(xmltype(a.DOCUMENTATION), '/metadata//idinfo/citation/citeinfo/pubdate') PUBLICATION_DATE,
FROM GDB_ITEMS_vw a
I am using 11g 2
Any suggestions are welcome
Thanks
Edited by: user3444035 on Mar 18, 2011 1:43 PMHi,
Could you give some sample data from GDB_ITEMS_vw and GDB_ITEMTYPES? -
Hi ,
I am doing Item UPDATE interface through Back end
i am getting error in the mtl_interface_errors table like below
COLUMN_NAME ERROR_MESSAGE
INSPECTION_REQUIRED_FLAG Inspection Required Flag cannot be set to "Y" if Receipt Routing is not set to Inspection.
what is happening?PranitSaha wrote:
Probably you are using an item template that contains conflicting item attribute values.
Sent from my iPhone
Hi,
Thanks for reply,I am not using Item Template in the Insert statement to the interface table,
I am just inserting into org_id,item_no,process_flag, pr0cess_id...
can you please explain more? -
Help needed in Joining tables for Help view
Hi All ,
My requirement is create a search help , using a view which will join four table ,
I was able to do using a databaser view and joining below tables
KNA1 MANDT = KNVV MANDT
KNA1 KUNNR = KNVV KUNNR
TVV5 MANDT = KNVV MANDT
TVV5 KVGR5 = KNVV KVGR5
TVV5 MANDT = TVV5T MANDT
TVV5 KVGR5 = TVV5T KVGR5
But thes is doing a inner join and help is not providing valuse where tghere are no entries for KNVV-KVGR5
for outer join i came to know we use hep view s instead of database viow ,
But i have problem joining these table s while creating Help View .
Any Help will be appricaited
Thanks
Vinay KollaHi Vinay,
Use the tabls in below given order to get the right view.
KNVV
KNA1
TVV5
TVV5T
KNA1-MANDT = KNVV-MANDT
KNA1-KUNNR = KNVV-KUNNR
TVV5-MANDT = KNVV-MANDT
TVV5-KVGR5 = KNVV-KNVV
TVV5-MANDT = TVV5T-MANDT
TVV5-KVGR5 = TVV5T-KVGR5
Regard
Anees -
hi,
Please suggest me the table or procedure to find the Fixed Cost in SALES ORDER COSTING.
the field name is FK,Data element is CK_FK_S1 ,structure is CKCOSTLINE.
Thanks in Advance.Try these tables.
KALA,KALO,KALM -
Table for updating the employee notice period
Hi gurus,
our organisation wants to update the contarct elements..
i.e notice period should be updated as 03 months
deadlines section in infotype 16
but in the drop down list of ER notice period we are having the following entries 01 30 days
02 60 days
03 1 month
04 2 months.
i want to add the 05 entry as 3 months how to do that..
pls help me...maintain V_T547T
-
Wich is table for match between Infoprovider and update with technical name
Thanks in advance!
Bye!
FerdinandoHello ,
You can check table --> RSUPDINFO table for Update rules with tech ID between Cube and InfoSources.
and other ref tables are --> RSUPDROUT / RSUPDDAT / RSUPDKEY /
--EnjoySAP
**Award credits if you are done with my answer -
Lock Cascade With Select for UPDATE
If I had a employee table and a phone table with a parent/child relationship and a primary key constraint on the employee table-will issuing a select for update on the employee also lock the corresponding child rows on the phone table ?
If not how can I bring this about ?You only need two sessions:
First session: Issue the 'select for update'
statements for the row(s) in both tables, don't
rollback or commit
Second session: try to update a row that you tried to
lock in the first session (with NOWAIT).
Thanks. I can try this definitely. A basic question.
You are asking me to do a join on both the tables right ?
Not two individual SQL statements ?
Updating the primary key is known as a Bad Idea (tm).
The key should never be touched because it should be
meaningless. When you have a column that holds 'real'
information it is no candidate for a primary key.
Rgds,
GuidoYes I am aware of that. I was just wondering what is the meaning behind this statement from this link ?
http://www.akadia.com/services/ora_locks_survival_guide.html
And the exact phrase from that link under the section Referential Integrity Locks (RI Locks)
"RI constraints are validated by the database via a simple SELECT from the dependent (parent) table in question-very simple, very straightforward. If a row is deleted or a primary key is modified within the parent table, all associated child tables need to be scanned to make sure no orphaned records will result. "
Thanks again.
Maybe you are looking for
-
Error reinstalling Yosemite & hard drive can't unmount
Product: MacBook Pro 15-inch, Mid 2009 Processor: 2.8 GHz Intel Core 2 Duo Memory: 8GB 1067 MHz DDR3 (Factory installed Samsung 4GB, upgraded to Crucial 8GB) Graphics: NVIDIA GeForce 9400M 256 MB Software: OS X 10.10.x (base OS X = 10.6.x Snow Leopar
-
IPhone 5 confusing Wi-Fi data with Cellular?
I bought my iPhone 5 just a few hours ago. When it was set-up, naturally it used 4G to access the Internet. Once I got home, I connected to my home Wi-Fi. It is my understanding that the iPhone will always prefer Wi-Fi to 3G or 4G. Plus, the entire n
-
BW ESTIMATION MODEL- Effort Estimate
Hi Gurus, As i am creating a BW estimation model I have put the following effort for complexities for differnt tasks. Please suggest if you think the estimation should be differnt to what I have estimated as I am a rookie in these area.
-
Hi All, What is OC4J and BC4J ?? What is the basic difference between them. I know there is a lot of documentation on OTN on these, but they are very detailed. I just need to know the basic concept and difference between the two. Thanks!! Shalu
-
How long should it take to reset a C1-01?
I started a soft reset on my C1-01 about 3 hours ago and it's still going. At what point to I give up? And what do I do if it doesn't complete properly?