Home » Developer & Programmer » Forms » Cant execute query (Version 10.1.2.0.2)
Cant execute query [message #538499] Fri, 06 January 2012 10:18 Go to next message
winnitbaker
Messages: 20
Registered: January 2012
Junior Member
Hi, I currentl have a form and when I am logged in as the owner the execute query button can be performed. But when I try and do this with another user the query cannot be executed. I have granted the users with the correct privilidges. I have created synonyms but this did not fix the problem. I am now trying to re-create the data block but with using the synonym but the synonyms cannot be found. Please help !!
Re: Cant execute query [message #538518 is a reply to message #538499] Fri, 06 January 2012 11:35 Go to previous messageGo to next message
cookiemonster
Messages: 13937
Registered: September 2008
Location: Rainy Manchester
Senior Member
Are you getting an error when you try to execute query?
If so use display error on the help menu to see what it is.
Re: Cant execute query [message #538537 is a reply to message #538499] Fri, 06 January 2012 13:31 Go to previous messageGo to next message
joy_division
Messages: 4963
Registered: February 2005
Location: East Coast USA
Senior Member
Sounds like you either made private synonyms in the wrong place, you didn't grant proper privileges on the underlying tables, or you gave incorrect grants.
Without knowing what you actually did, saying you "did" something really is no proof at all.
Re: Cant execute query [message #538584 is a reply to message #538537] Sat, 07 January 2012 08:23 Go to previous messageGo to next message
winnitbaker
Messages: 20
Registered: January 2012
Junior Member
Ive got SQL statement in error:
SELECT ROWID,CLIENT_ID,LAST_NAME,FIRST_NAME,ALIAS1,ALIAS2,ADDRESS,PHONE FROM MV_CLIENT_ROWID
and Error:
ORA-00942: table or view does not exist
The problem is the query is trying to select from a table but it cant because it needs to go through the synonym. But when I come to add a data block I cant find any of the synonymns. The synonyms are public
Re: Cant execute query [message #538587 is a reply to message #538584] Sat, 07 January 2012 08:37 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Here's what I think you did.

I'm connected as SCOTT. Create a table:
SQL> create table my_client
  2    (id        number,
  3     cli_name  varchar2(20));

Table created.

SQL> insert into my_client (id, cli_name) values (100, 'Littlefoot');

1 row created.

SQL> create public synonym my_client_syn for my_client;

Synonym created.

SQL> select * from my_client_syn;

        ID CLI_NAME
---------- --------------------
       100 Littlefoot

So far, so good. Now connect as another user (MIKE) and try to select from that public synonym:
SQL> connect mike/lion
Connected.

SQL> select * from my_client_syn;
select * from my_client_syn
              *
ERROR at line 1:
ORA-00942: table or view does not exist


SQL>

Exactly the same error as the one you got.

OK, a step back: connect as the table owner again (SCOTT in my case):
SQL> connect scott/tiger
Connected.

Session altered.

SQL> grant select on my_client to public;

Grant succeeded.

OK, connect as MIKE again and try to select from the synonym:
SQL> connect mike/lion
Connected.

SQL> select * from my_client_syn;

        ID CLI_NAME
---------- --------------------
       100 Littlefoot

SQL>


Success!

So - did you, perhaps, forget to GRANT SELECT (and possibly other privileges) to PUBLIC?

[Updated on: Sat, 07 January 2012 08:38]

Report message to a moderator

Re: Cant execute query [message #538590 is a reply to message #538587] Sat, 07 January 2012 08:48 Go to previous messageGo to next message
winnitbaker
Messages: 20
Registered: January 2012
Junior Member
No this is not the case for my error. In sqlplus the correct users can select from the synonyms, but in oracle forms I would like to create new data blocks via data block wizard. This would to create a data block on the synonyms but the synonyms cannot be found in the data block wizard.
Re: Cant execute query [message #538592 is a reply to message #538590] Sat, 07 January 2012 09:03 Go to previous messageGo to next message
cookiemonster
Messages: 13937
Registered: September 2008
Location: Rainy Manchester
Senior Member
Is the grant a direct grant or is it via a role?
Re: Cant execute query [message #538594 is a reply to message #538592] Sat, 07 January 2012 09:06 Go to previous messageGo to next message
winnitbaker
Messages: 20
Registered: January 2012
Junior Member
the grants are via the role
Re: Cant execute query [message #538601 is a reply to message #538594] Sat, 07 January 2012 09:29 Go to previous message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
The same mistake as in your another topic; privileges acquired via roles won't work in PL/SQL - you'll need to grant them directly to user.
Previous Topic: How to avoid FRM-40401 message?
Next Topic: Need help with button pressed trigger
Goto Forum:
  


Current Time: Sun Sep 08 07:23:14 CDT 2024