When DWTRXGRP.XGRPG_GROUP_TYPE_CODE in ("IE","IF","II") use GRP_RRE.ELEM_VAL_TXT = 0011 for ELEM_ID = RATPOL
now table DWTRXGRP is in schema1
and GRP_RRE is in schema2
UPDATE Schema1.GRP_RRE
SET ELEM_VAL_TXT = `0011?
WHERE ELEM_ID = `RATPOL? AND
## WHAT ABOUT Schema2.DWTRXGRP.XGRPG_GROUP_TYPE_CODE in (`IE?,?IF?,?II?) ##
DaveINAz came down a little too blountly on the questioner but he is wright. The question was posed ambigously.
We are all here waiting to to help you, please repose your question.
++ Olu
the basic aim is to
update a column of one table based on values of other column in other table.
Its like
Update schema1.table1.col1=0011
when schema1.table1.col2=RATPOL
And When schema2.table2.col in ("IE","IF","II")
i am working on oracle 9.2 database
i have tried :
1> update schema1.table1 a
set a.col1 = '0014'
where a.col2 = 'RATPOL' and schema2.table2.col in ('IE','IF','II')
Err: schema2.table2.col invalid identifier
2> update schema1.table1 a
set a.col1 = '0014'
where a.col2 = 'RATPOL' and b.col = (select b.col from schema2.table2 b where b.col in ('IE','IF','II'))
Err: b.col invalid identifier
Well, that's a bit clearer. It sounds like you're running into permissions issues. You'll need to verify that the user that's trying to execute the query has SELECT privileges on both schemas and tables, as well as UPDATE privs on schema1.table1.
If you have access to view the grants on schema2, you can simply look at them to verify this. If not, you can test it with a simpler query. See if you can do something like;
SELECT a.col1, b.col2
FROM schema1.table1 a,
schema2.table2 b
WHERE a.col2 = 'RATPOL'
AND a.col? = b.col?
You'll need to replace the col?s with the correct columns, of course. (I assume you had a similar link between tables in your original query, that you didn't include in the question. If not, you'll almost certainly want/need to add one.) If this produces the same error, and you're sure the names are correct, it's a lack of privileges on the second schema.
By default, no one has privileges on a new schema except the user that created it (and any "superusers", admins, etc.). You (or the dba) need to grant access to it, something like this;
GRANT SELECT ON TABLE2 TO SUMEET
Free Guide: Managing storage for virtual environments
Complete a brief survey to get a complimentary 70-page whitepaper featuring the best methods and solutions for your virtual environment, as well as hypervisor-specific management advice from TechTarget experts. Don’t miss out on this exclusive content!
Discuss This Question: 3  Replies