0 pts.
 sql query ASAP
SQL
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?) ##

Software/Hardware used:
ASKED: September 23, 2005  11:07 PM
UPDATED: September 28, 2005  11:43 AM

Answer Wiki:
If you want people to help you, you need to state the question much more clearly than that. Most people aren't going to work that hard to understand the question and then work, perhaps, even harder to answer it. That's asking too much of people. What DBMS are you using? What version? What error or undesirable behavior are you getting? Are all those ?s supposed to be in your SQL? Are those #s in your actual SQL? The problem is in the AND clause? Does it work if you don't use an IN clause?
Last Wiki Answer Submitted:  September 26, 2005  11:26 am  by  DaveInAZ   0 pts.
All Answer Wiki Contributors:  DaveInAZ   0 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

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

 0 pts.

 

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

 0 pts.

 

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

 0 pts.