SQL Error 00905. 00000 - "missing keyword" - oracle

I am trying to execute this query ;
Grant SELECT on TYPE PPZ_C.BTS_BAUTEIL_STATION_INFO to PPZ_W;
and I get the folowing error:
Error starting at line : 3 in command - Grant SELECT on TYPE
PPZ_C.BTS_BAUTEIL_STATION_INFO to PPZ_W Error report - ORA-00905:
missing keyword
00905. 00000 - "missing keyword"
*Cause:
*Action:
Does anyone know what keyword I am missing ?

Firstly you need to remove TYPE. This will fix your first part of issue.
Try this
Grant SELECT on PPZ_C.BTS_BAUTEIL_STATION_INFO to PPZ_W
Now when you execute the above , you will further get the error:
ORA-02305: only EXECUTE, DEBUG, and UNDER privileges are valid for
types
Which means you cannot grant select on any type. Only EXECUTE, DEBUG, and UNDER privileges are valid for types.
So you can use EXECUTE when you want it to be used in select statement :
Grant EXECUTE on PPZ_C.BTS_BAUTEIL_STATION_INFO to PPZ_W;
EDIT:
Your select statement should be :
SELECT ppz_bts.na_stat_anf( PPZ_C.BTS_BAUTEIL_STATION_INFO ('','IG','12345679') ) FROM dual;
See demo:
CREATE OR REPLACE TYPE myschema.array_t is varray(2) of number ;
---Running in My schema
SQL> select * from table(array_t('1','2'));
COLUMN_VALUE
------------
1
2
--Granted from myschema to otherschema
SQL> grant execute on myschema.array_t to othersschema ;
--Running in otherschema
SQL> select * from table(myschema.array_t('1','2'));
COLUMN_VALUE
------------
1
2

When Oracle receives requests for type information, it verifies that the requestor has EXECUTE privilege on the type before supplying the requested information.
Try this :
Grant EXECUTE on PPZ_C.BTS_BAUTEIL_STATION_INFO to PPZ_W;
Then try doing :
SELECT ppz_bts.na_stat_anf( PPZ_C.bts_bauteil_station_info('','IG','12345679') )
FROM dual;

Related

Cakephp 2.5 can not find an Oracle sequence

I create a CakePhp model following the right CakePhp naming conventions and add into the $sequence property the name of the sequence as it was created on the Oracle database.
Inserting one record via sql plus was ok, but inserting data via Cakephp triggers the error:
[code] => 2289
[message] => ORA-02289: the sequence does not exists
[offset] => 7 [sqltext] => SELECT my_sql_table_seq.currval FROM dual
Even after cleaning up the tmp/cache content i see the same error as if cakephp try to guess the sequence name even having the sequence property named in the right way.
Is there a way to see why it happens ?
It's obvious that you don't have a sequence called my_sql_table_seq in your oracle schema,
or perhaps you have this sequence in another schema and you're missing related schema name as prefix let's call myschema : select myschema.my_sql_table_seq.currval from dual;
( provided your schema is granted for this sequence to execute ) :
SQL> conn otherschema/password1
SQL> grant execute on my_sql_table_seq to myschema;
SQL> conn myschema/password2
SQL> select otherschema.my_sql_table_seq.currval from dual;
or just create a sequence :
SQL> conn myschema/password2
SQL> create sequence my_sql_table_seq increment by 1 minvalue 0;
SQL> select my_sql_table_seq.currval from dual;

store value of column into variable

I want to get a value of column, and put it into variable of the same type of that column, as the following :
select FRI_SEC_TEMP into friday_seconds
from TEMPTABLE
where rownum<2;
DBMS_OUTPUT.PUT_LINE(friday_seconds);
but when I run the script, it give me the following error:
Query Run In:Query Result 6
Error starting at line : 61 in command -
DBMS_OUTPUT.PUT_LINE(friday_seconds)
Error report -
Unknown Command
and when I run just the select statement I get the following error:
ORA-00905: missing keyword
00905. 00000 - "missing keyword"
*Cause:
*Action:
Just execute the script as a PL SQL block by surrounding it with begin - end
begin
select FRI_SEC_TEMP into friday_seconds
from TEMPTABLE
where rownum<2;
DBMS_OUTPUT.PUT_LINE(friday_seconds);
end;

SELECT a table from oracle data dictionary

I am new to SQL and recently installed Oracle 11g. I read the post here on selecting all tables from user_tables. I'm trying to select a specific table and following some of the suggestions in the post does not appear to work.
The following executes fine and returns all tables available to me including a table named faculty_t:
select * from user_tables;
select * from dba_tables;
select * from all_tables;
desc faculty_t;
But I get error when I do the following:
select * from user_tables where table_name = FACULTY_T;
The first set of statements confirm that I do have a table named faculty_t. However, trying to select this table from user_tables, all_tables, or dba_tables does not appear to work for me right now. The error message reads something like:
ORA-00904: "FACULTY_T": invalid identifier
00904. 00000 - "%s: invalid identifier"
*Cause:
*Action:
Error at Line: 208 Column: 8
Any thoughts? Thanks!
String literals in SQL are wrapped in '. So:
select * from user_tables where table_name = 'FACULTY_T';
When you did a desc faculty_t, the SQL engine knew that a table name was expected at that spot (the syntax expects a table name there). But in your select query, sql is just looking for the value of a column that happens to have a string data type, so you need to use the ' for a string literal.

Oracle synonym error from Hibernate

I am getting below error in my application.
org.hibernate.util.JDBCExceptionReporter -- ERROR -- ORA-00980: synonym translation is no longer valid
i have checked the synonym,that is valid.
Can anyone please help.
You may have the synonym in VALID status which refers to even non-existing object:
SQL> create synonym t_syn for abrakadabra;
Synonym created.
SQL> select status from user_objects where object_name = 'T_SYN';
STATUS
-------
VALID
SQL> select * from t_syn;
select * from t_syn
*
error in line 1:
ORA-00980: synonym translation is no longer valid
SQL> select status from user_objects where object_name = 'T_SYN';
STATUS
-------
VALID
So first of all you need to check the existance of the object the synonym refers to.

Hashing string in Oracle

I know there's a function to obtain the hash value from a varchar in Oracle, but when I run the query to see the returned value it sends the following message.
ORA-00904: : identificador no válido
00904. 00000 - "%s: invalid identifier"
*Cause:
*Action:
Error en la línea: 70, columna: 7
What I'm doing is the following:
select DBMS_CRYPTO.hash(utl_raw.cast_to_raw('Foo'), 3) FROM dual;
It should return the SHA-1 of the string.
That works for me
SQL> select DBMS_CRYPTO.hash(utl_raw.cast_to_raw('Foo'), 3) FROM dual;
DBMS_CRYPTO.HASH(UTL_RAW.CAST_TO_RAW('FOO'),3)
--------------------------------------------------------------------------------
201A6B3053CC1422D2C3670B62616221D2290929
Are you sure that the user that is running this has been granted EXECUTE access on both the UTL_RAW and the DBMS_CRYPTO packages? If line 70 of your code is this SELECT statement, I'd wager that column 7 is where the DBMS_CRYPTO call starts and that you don't have access to the DBMS_CRYPTO package.

Resources