8.1.7: ORA-01410 in PL/SQL but not SQL*Plus
This has been driving me crazy, and a search here and in comp.databases.oracle didn't turn up any solutions.
When the following code is part of a stored procedure, it fails with ORA-01410 (Invalid ROWID). It executes perfectly from SQL*Plus, I've verified that TMP_TASK_DATA contains data, and the query clearly specifies a ROWID.
As noted in the subject, this occurs on 8.1.7. TMP_TASK_DATA and TMP_TASK_RETRIEVAL are both global temp tables. I don't currently have access to Metalink, so was hoping that someone has run across this and has some hints.
Thx,
(query edited to limit "IN" list):
INSERT INTO TMP_TASK_RETRIEVAL
(TASK_ID, TD_ROWID, SORT_ORDER)
SELECT TASK_ID, TD_ROWID, ROWNUM
FROM (
SELECT TASK_ID, TD_ROWID
FROM (
SELECT TASK_ID,
ROWID as TD_ROWID,
SF_GET_PRIORITY(TASK_TYPE, 1 ) as PRIORITY_COMM,
COMPLETED_TIME as FINISH_TIME,
FIRST_READY_TIME as QUEUE_TIME
FROM TMP_TASK_DATA
WHERE USER_NUMBER = v_USER_NUM
AND TASK_TYPE in
'AAAA', 'BBBB', 'CCCC'
ORDER BY
PRIORITY_COMM,
decode(PRIORITY_COMM, 10, FINISH_TIME, QUEUE_TIME)
);
Thanks for the info. It turned out that I was wrong about removing the PL/SQL variable from the query; either that, or the error occurs at arbitrary times.
As best I can tell, a ROWID simply can't be passed between nested inline views, so I reduced them to one level (which means that I have to run the function twice in the ORDER BY, rather than once in the nested select).
Similar Messages
-
ORA-01031: insufficient privileges in PL/SQL but not in SQL
I have problem with following situation.
I switched current schema to another one "ban", and selected 4 rows from "ed"
alter session set current_schema=ban;
SELECT * FROM ed.PS WHERE ROWNUM < 5;
the output is OK, and I get 4 rows like
ID_S ID_Z
1000152 1
1000153 1
1000154 1
1000155 1
but following procedure is compiled with warning
create or replace
procedure proc1
as
rowcnt int;
begin
select count(*) into rowcnt from ed.PS where rownum < 5;
end;
"Create procedure, executed in 0.031 sec."
5,29,PL/SQL: ORA-01031: insufficient privileges
5,2,PL/SQL: SQL Statement ignored
,,Total execution time 0.047 sec.
Could you help me why SELECT does work in SQL but not in PL/SQL procedure?
Thanks.
Message was edited by:
MattSkPrivs granted via a role are only valid from SQL - and not from/within stored PL/SQL code.
Quoting Tom's (from http://asktom.oracle.com) response to this:I did address this role thing in my book Expert one on one Oracle:
<quote>
What happens when we compile a Definer rights procedure
When we compile the procedure into the database, a couple of things happen with regards to
privileges. We will list them here briefly and then go into more detail:
q All of the objects the procedure statically accesses (anything not accessed via dynamic SQL)
are verified for existence. Names are resolved via the standard scoping rules as they apply to the
definer of the procedure.
q All of the objects it accesses are verified to ensure that the required access mode will be
available. That is, if an attempt to UPDATE T is made - Oracle will verify the definer or PUBLIC
has the ability to UPDATE T without use of any ROLES.
q A dependency between this procedure and the referenced objects is setup and maintained. If
this procedure SELECTS FROM T, then a dependency between T and this procedure is recorded
If, for example, I have a procedure P that attempted to 'SELECT * FROM T', the compiler will first
resolve T into a fully qualified referenced. T is an ambiguous name in the database - there may be
many T's to choose from. Oracle will follow its scoping rules to figure out what T really is, any
synonyms will be resolved to their base objects and the schema name will be associated with the
object as well. It does this name resolution using the rules for the currently logged in user (the
definer). That is, it will look for an object owned by this user called T and use that first (this
includes private synonyms), then it will look at public synonyms and try to find T and so on.
Once it determines exactly what T refers to - Oracle will determine if the mode in which we are
attempting to access T is permitted. In this case, if we as the definer of the procedure either
owns the object T or has been granted SELECT on T directly or PUBLIC was granted SELECT, the
procedure will compile. If we do not have access to an object called T by a direct grant - the
procedure P will fail compilation. So, when the object (the stored procedure that references T) is
compiled into the database, Oracle will do these checks - and if they "pass", Oracle will compile
the procedure, store the binary code for the procedure and set up a dependency between this
procedure and this object T. This dependency is used to invalidate the procedure later - in the
event something happens to T that necessitates the stored procedures recompilation. For example,
if at a later date - we REVOKE SELECT ON T from the owner of this stored procedure - Oracle will
mark all stored procedures this user has that are dependent on T, that refer to T, as INVALID. If
we ALTER T ADD some column, Oracle can invalidate all of the dependent procedures. This will cause
them to be recompiled automatically upon their next execution.
What is interesting to note is not only what is stored but what is not stored when we compile the
object. Oracle does not store the exact privilege that was used to get access to T. We only know
that procedure P is dependent on T. We do not know if the reason we were allowed to see T was due
to:
q A grant given to the definer of the procedure (grant select on T to user)
q A grant to public on T (grant select on T to public)
q The user having the SELECT ANY TABLE privilege
The reason it is interesting to note what is not stored is that a REVOKE of any of the above will
cause the procedure P to become invalid. If all three privileges were in place when the procedure
was compiled, a revoke of ANY of them will invalidate the procedure - forcing it to be recompiled
before it is executed again. Since all three privileges were in place when we created the procedure
- it will compile successfully (until we revoke all three that is). This recompilation will happen
automatically the next time that the procedure is executed.
Now that the procedure is compiled into the database and the dependencies are all setup, we can
execute the procedure and be assured that it knows what T is and that T is accessible. If something
happens to either the table T or to the set of base privileges available to the definer of this
procedure that might affect our ability to access T -- our procedure will become invalid and will
need to be recompiled.
This leads into why ROLES are not enabled during the compilation and execution of a stored
procedure in Definer rights mode. Oracle is not storing exactly WHY you are allowed to access T -
only that you are. Any change to your privileges that might cause access to T to go away will cause
the procedure to become invalid and necessitate its recompilation. Without roles - that means only
'REVOKE SELECT ANY TABLE' or 'REVOKE SELECT ON T' from the Definer account or from PUBLIC. With
roles - it greatly expands the number of times we would invalidate this procedure. If some role
that was granted to some role that was granted to this user was modified, this procedure might go
invalid, even if we did not rely on that privilege from that role. ROLES are designed to be very
fluid when compared to GRANTS given to users as far as privilege sets go. For a minute, let's say
that roles did give us privileges in stored objects. Now, most any time anything was revoked from
ANY ROLE we had, or any role any role we have has (and so on -- roles can and are granted to roles)
-- many of our objects would become invalid. Think about that, REVOKE some privilege from a ROLE
and suddenly your entire database must be recompiled! Consider the impact of revoking some system
privilege from a ROLE, it would be like doing that to PUBLIC is now, don't do it, just think about
it (if you do revoke some powerful system privilege from PUBLIC, do it on a test database). If
PUBLIC had been granted SELECT ANY TABLE, revoking that privilege would cause virtually every
procedure in the database to go invalid. If procedures relied on roles, virtually every procedure
in the database would constantly become invalid due to small changes in permissions. Since one of
the major benefits of procedures is the 'compile once, run many' model - this would be disastrous
for performance.
Also consider that roles may be
q Non-default: If I have a non-default role and I enable it and I compile a procedure that
relies on those privileges, when I log out I no longer have that role -- should my procedure become
invalid -- why? Why not? I could easily argue both sides.
q Password Protected: if someone changes the password on a ROLE, should everything that might
need that role be recompiled? I might be granted that role but not knowing the new password - I
can no longer enable it. Should the privileges still be available? Why or Why not? Again, arguing
either side of this is easy. There are cases for and against each.
The bottom line with respect to roles in procedures with Definer rights are:
q You have thousands or tens of thousands of end users. They don't create stored objects (they
should not). We need roles to manage these people. Roles are designed for these people (end users).
q You have far fewer application schema's (things that hold stored objects). For these we want
to be explicit as to exactly what privileges we need and why. In security terms this is called the
concept of 'least privileges', you want to specifically say what privilege you need and why you
need it. If you inherit lots of privileges from roles you cannot do that effectively. We can manage
to be explicit since the number of development schemas is SMALL (but the number of end users is
large)...
q Having the direct relationship between the definer and the procedure makes for a much more
efficient database. We recompile objects only when we need to, not when we might need to. It is a
large efficiency enhancement.
</quote> -
SQL Devloper working fine but not SQL Plus
Hi,
I am facing a problem that I can connect to oracle server via SQL Developer but cannot connect to the same using SQL*Plus.
ORA-12154: TNS:could not resolve service name
I checked many forums and followed each advices but in vein. To make sure that I have got only one instance of tnsnames.ora file, I removed oracle completely from my system and did the fresh installation of the same.Again, SQL Developer worked but not SQL*Plus.
Also, I updated dummy value in the tnsnames.ora file to check if SQLDeveloper is pointing to correct ora file, it failed means that its pointing to correct one only.
Also, this is not the problem with single machine rather my colleague is also facing the same problem while connecting to the same oracle. It suggest me that its rather problem with server side then client one but what do you people think the actual problem can be.
Kindly advice
I am using oracle 10.2 and OS window server 2003 standard edition.
Cheers,
D
Edited by: user9022426 on 20-Jan-2010 14:25The problem is client side.
The error message means that you're not getting
Are you using a TNS connection for SQL Developer?
If so, this error suggests that SQL Developer and SQL*Plus are not going through the same ORACLE_HOME and/or TNSNAMES.ORA.
For example, do you have the environment variable TNS_ADMIN set?
If you have metalink access, then there is a troubleshooting guide for ORA-12154 in Metalink note 114085.1 -
Abnormal, Same query get data in sql but not working on Fron-end
Dear,
Version :Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
We have created packed in oracle database befor two months ago & was working fine, but since morning select statment in package is not working while running via application which mentioned below and raise not data found but surprising thing is that same query is getting data when we execut on sql plus return one record.
i don't know either it's abnormal behaviour or sth else becuase the same query run without changing any singl column in where_clause work in sql but not getting data while submition request through oracle application and raising not data found.
--thankse
Edited by: oracle0282 on Dec 29, 2011 2:20 AMActully when i run this query in sql it return one record on the same parameter, while when we exeucte this select in pl/sql on the same parameter oracle raise no data found error.
so i got confused the same query with same parameter retur record in sql but when we call it fron-end through packege raise 'no data found error'.
hope you understand now.
--thanks -
DB Link - works via SQL but not via packages
I have a database link on user ODB on database A, to database B. The DB Link seems fine for SQLs that i do, but doesn't compile in my package code. Please tell me why it works for "regular sqls" but not inside a package.
Example: while connected as ODB user on database A, if I do this query:
SELECT "TRAXDOC_DETAIL"."FILE_NAME",
"TRAXDOC_DETAIL"."FILE_TYPE",
FROM "TRAXDOC_DETAIL"@TRAXDOC_LINK
WHERE "TRAXDOC_DETAIL"."TRAXDOC_ROW_ID" = 100031 AND
"TRAXDOC_DETAIL"."TRAXDOC_LINE"= 2
It works fine. But the same query inside a package that is owned by user ODB on database A will not compile, stating the table/view does not exist.
The database link is owned by use ODB on database A, connects directly to the owner of the tables in question on database B.
Any suggestions welcome... this is an urgent issue, because it also worked fine on my customer's test environment, but not on their Production that they just upgraded. I need to know what to look for as to what could be wrong.Thanks so much for your response - Prefixing the call to the table within the package, with the schema owner does indeed solve the problem. Since this is a Production issue, i have implemented this fix in my customer's database.
However, I would still like this issue permanently resolved. The next time we send out updated package code, this will happen again (unless we then fix it again). I'd still like info from anyone on what exactly must be done to allow the call within the package to work without specifically pre-fixing the table's schema owner. It shouldn't be needed... The DB link is connecting via the same schema on database B that owns the table in question.
pre-fixing the schema owner is something we don't do in our sql statements, and this has worked fine for many of our cusomer's environments. We're only seeing this issue on one environment. -
Executing a procedure - Works on Isql Plus but not SQL Developer??
Hi folks.
I am playing around with some design and structure stuff, mostly just passing values around procedures. I have one procedure (procedure1) which takes a sysdate and then passes it to another procedure (procedure2) which takes the parameter and does a dbms_output.put_line.
Both objects are valid, and compile correctly. I use
exec procedure1;
in iSql Plus and it works perfectly. It prints the dates out and all.
However if I use the exact same command in SQL Developer it gives me error "ORA-00900: invalid SQL statement"
I don't understand why this happens?? The code executes perfectly in one but not the other...Remember that SQL*Plus commands don't work in the worksheet. So, this would fail
exec my_procIn the worksheet you have to declare an anonymous block....
begin
my_proc;
end;
/If you right-click on the procedure in the Navigator and select Run then SQL*Dev will throw up a harness for you. Very handy if you want to get DBMS_OUTPUT, set variables, etc.
Cheers, APC
http://radiofreetooting.blogspot.com -
Connect by prior working in sql but not in forms 10g hierarchical tree
Hello Friends,
I have the following connect by prior example which is working in sql command prompt but not in Forms 10g hierarchical tree item type. Can you please let me know why ?
configuration: Forms 10g patchset 10.1.2.0.2 and oracle 11g database on windows 7
SQL> SELECT 1 InitialState,
2 level Depth,
3 labeller NodeLabel,
4 NULL NodeIcon,
5 to_char(reportno) NodeValue
6 FROM reports where formname = 'billinin.fmx' or reportno > 9999
7 start with reportno > 9999
8 CONNECT BY PRIOR reportno = labelno
9 /
INITIALSTATE DEPTH NODELABEL N NODEVALUE
1 1 FIRST 10000
1 2 report1 UD Label 1
1 2 report2 UD Label 2
1 2 report3 UD Label 3
1 1 SECOND 10001
1 1 THIRD 10002
If I write this command in forms hierarchical tree, then it is working, why not the above code ?
SQL> SELECT 1 InitialState,
2 level Depth,
3 labeller NodeLabel,
4 NULL NodeIcon,
5 to_char(reportno) NodeValue
6 FROM reports
7 start with reportno > 9999
8 CONNECT BY PRIOR reportno = labelnoThanks Room,
This command worked ! I will put the sample working code here. It will help you to filter the records in a tree in sql command prompt as well as in forms hierarchical tree 10g.
SELECT 1 InitialState,
level Depth,
labeller NodeLabel,
NULL NodeIcon,
to_char(reportno) NodeValue
FROM reports
start with reportno > 9999
CONNECT BY PRIOR reportno = labelno
AND FORMNAME = :reports.testitem -
ORA-01891 - Query works in SQL+ but not in JDev
JDev 9.0.4 / DB 8i...
I run a query in SQL+ and it returns results, I run it in JDev Worksheet and I get "ORA-01891: Datetime/Interval internal error".
The query is a select from a view based on a synonym that links to a table in another DB (database link). I have boiled it down to it's "simplest" form for testing and it looks like:
select * from some_table;
I can also run this query in 9.0.5.2 worksheet.Funny you should mention that. The reason I found this error is because one of my VOs wasn't working, so I tried running the query in the worksheet. Didn't work there either but I was getting this different error (posted above). Anways, turns out the viewobject had the wrong attribute listed so I fixed that but the worksheet doesn't work.
I don't think it's the attribute because the worksheet isn't directly connected to the VO so it shouldn't be aware of it. Additionally, only the VOs that are based on the view/synonym/link are affected.
Thanks for the suggestion though! -
Can do via SQL but not via PL/SQL
is it possible that a simple; 'create global temporary table..' SQL can run, yet same code being called from an 'execute immediate' within a PL/SQL block throw an; ORA-01031: insufficient privileges exception...(same user)
is it a role/privilege issue or do I need to de a better job debugging?short version, each user will pass unique values to the proc that via dynamic sql will build these tables based on that iterative select criteria, to be used only during their current working session.
so it's not the 'same' table in structure each time
would not having 'TEMP grantable' be the issue?
trying to find a way to communicate this to the DBA -
DECODE works in SQL but not in a CURSOR
I have simplified my problem to "DUAL":
While in a SQL session :
select decode(
(select 1 from dual)
,(select 1 from dual)
,1
,0)
from dual;
Expected result: 1;
Actual result: 1;
Place this code in a PL/SQL block :
declare
X number;
begin
SELECT decode(
(select 1 from dual)
,(select 1 from dual)
,1
,0)
INTO X;
FROM dual;
end;
Expected Result: X=1;
Actual Result: ORA-06550 & PLS-00103 "Encountered the symbol SELECT".
My Question:
Why can't I place a select within a decode while in a PL/SQL block? I have also tried this in an Explicit cursor.This is another of those cases when the PL/SQL engine does not support a feature/syntax of the SQL engine. To do this in PL/SQL, execute it as dynamic SQL (which uses the SQL engine):
declare
X number;
begin
execute immediate
'SELECT decode((select 1 from dual),' ||
'(select 1 from dual),1,0) ' ||
' FROM dual' into x;
dbms_output.put_line( x );
end; -
ORA-01858 error in Application but not in sqlpluss
Hi.
I have this query that runs nicely in sqlpluss and the SQL Commands that came with Expressedition 10g, but when I put it in a report region it produce:
report error:
ORA-01858: a non-numeric character was found where a numeric was expected
query:
SELECT temae.temae, NVL(antall,0) Antall
FROM temae LEFT OUTER JOIN (SELECT temae, count(temae) as antall
FROM okeiko
WHERE person = :P3_PERSON and dag >= to_date(DECODE(SIGN(to_char(current_date,'mm')-5),
-1, to_date('01-NOV-'||to_char(current_date,'yy'))-365,
0, to_date('01-MAY-'||to_char(current_date,'yy')),
1, DECODE(SIGN(to_char(current_date,'mm')-10),
-1,to_date('01-MAY-'||to_char(current_date,'yy')),
0,to_date('01-MAY-'||to_char(current_date,'yy')),
1,to_date('01-NOV-'||to_char(current_date,'yy')))),'dd-mon-yy')
GROUP BY temae) p
ON temae.id = p.temae
where antall > 0
ORDER BY NVL(antall,0) DESC, temae.type, temae.temae
Before I added the decode part for the date it looked like this, and worked nice in the application:
SELECT temae.temae, NVL(antall,0) Antall
FROM temae LEFT OUTER JOIN (SELECT temae, count(temae) as antall
FROM okeiko
WHERE person = :P3_PERSON and dag > to_date('30-apr-06','dd-mon-yy')
GROUP BY temae) p
ON temae.id = p.temae
where antall > 0
ORDER BY NVL(antall,0) DESC, temae.type, temae.temae
This is the data structure
SQL> describe temae
Name Null? Type
ID NOT NULL NUMBER
TEMAE VARCHAR2(20)
TYPE NUMBER
Then it worked nicely in the application to.
SQL> describe okeiko;
Name Null? Type
ID NOT NULL NUMBER
PERSON NOT NULL NUMBER
TEMAE NOT NULL NUMBER
SENSEI NUMBER
REMARK VARCHAR2(4000)
DAG NOT NULL DATE
Can anyone se why application is complaining?
BTW report region also complains to_date('01-may-06','dd-mon-yy') does not have a valid month.Marius,
I am not sure but try this:
SELECT temae.temae, NVL (antall, 0) antall
FROM temae LEFT OUTER JOIN (SELECT temae, COUNT (temae) AS antall
FROM okeiko
WHERE person = :p3_person
AND dag >=
TO_DATE
(DECODE
(SIGN
( TO_CHAR
(CURRENT_DATE,
'mm'
- 5
-1, TO_DATE
( '01-NOV-'
|| TO_CHAR
(CURRENT_DATE,
'yy'
- 365,
0, TO_DATE
( '01-MAY-'
|| TO_CHAR
(CURRENT_DATE,
'yy'
1, DECODE
(SIGN
( TO_CHAR
(CURRENT_DATE,
'mm'
- 10
-1, TO_DATE
( '01-MAY-'
|| TO_CHAR
(CURRENT_DATE,
'yy'
0, TO_DATE
( '01-MAY-'
|| TO_CHAR
(CURRENT_DATE,
'yy'
1, TO_DATE
( '01-NOV-'
|| TO_CHAR
(CURRENT_DATE,
'yy'
GROUP BY temae) p ON temae.ID = p.temae
WHERE antall > 0
ORDER BY NVL (antall, 0) DESC, temae.TYPE, temae.temaeI took out the formating of your to_date function.
Denes Kubicek -
Db link error in PL/SQL but not in SQL
oracle 10.2.0.4
solaris 10
I have a simple procedure (anonymous block) that uses a db link to update a table in another db (on same host)
The procedure fails with the following error:
ORA-02019: connection description for remote database not found
I can insert records using the same db_link using the exact same line pasted from the stored proc (same line that raises the ORA-02019).
insert into table_x@my_db_link (select * from local_table_y);
x rows inserted
I use the same sql*plus session to run both the stored proc and sql command;
SQL> conn my_user/my_pwd
connected
SQL> @my_proc.sql
ORA-02019: connection description for remote database not found
SQL> insert into table_x@my_db_link (select * from local_table_y);
x rows inserted
QUESTION:
Why does the db_link fail in the procedure and not the sql command line call?
P.S.
I converted the procedure to a store proc and it also fails with the same call.Perhaps if the Database link is non-public?There is a bug, #3240720, which applies when the owner of the db link is not the user who's executing the query.
There are several bugs which demonstrate this sort of behaviour. For instance ORA-2019 can be hurled if the local PL/SQL is running against a remote Dataguard standby database (although I would hope we wouldn't be running an INSERT in that scenario).
Cheers, APC
blog: http://radiofreetooting.blogspot.com -
Able to connect via Oracle SQL Developer, but not sql plus
Using Oracle 10.2.0.
I can connect using the TNS connection type in SQL Developer, but cannot do so in SQL PLUS. SQL Plus gives me the error -- could not resolve the connect identifier.
When I do tnsping USPO_ADHOC, I get:
C:\oracle\product\10.2.0\client_1\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION =
TNS-12533: TNS:illegal ADDRESS parameters
So here is my tnsnames.ora file:
INTL_ADHOC =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.239.162.108)(PORT = 1521))
(CONNECT_DATA =
(SID = intl1)
USSYN_ADHOC =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.239.162.109)(PORT = 1521))
(CONNECT_DATA =
(SID = USSYN)
USPO_ADHOC =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.239.162.107)(PORT = 1521))
(CONNECT_DATA =
(SID = uspo)
Any assistance gratefully appreciated. Thanks.I actually did not have that environmental variable, so I added it, but nothing changed.
I would note that if I do tnsping foo, I get: failed to resolve name.
If I do tnsping USPO_ADHOC, I get: illegal address parameter.
In both cases, the output correctly identified the path to my sqlnet.ora file, which is in the same directory as my tnsnames.
So I would conclude from that, that the system was already able to find my tnsnames file.
Anyway, here's my sqlnet.ora:
SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
Thanks again for any ideas! -
Why are Java SASLFactories missing when called via PL/SQL but not from JRE?
Hi
This may be quite a technical point about SASL and JCE Providers etc OR it may just be a question about how Oracle PL/SQL interfaces with Java.
The background is that I am trying to get a Java opensource library to run in Oracle DB - this is for specialized communication from Database to other servers.
The library uses a SASL mechanism to authenticate with the server and this (appears) to rely on JCE Providers installed and provided by the JRE.
I have some Java code working which uses the library - this runs OK in NetBeans/Windows environment and also using Linux/Oracle JRE directly such as:
+# $ORACLE_HOME/jdk/bin/java -classpath "./MyMain.jar:./OtherSupport.jar" package.TestClient+
However it refuses to work (throws a NullPointerException) when called from PL/SQL.
+FUNCTION send_a_message (iHost IN VARCHAR2,+
iPort IN NUMBER,
+iLogin IN VARCHAR2,+
+iPasswd IN VARCHAR2,+
iRecipient IN VARCHAR2,
iMessage IN VARCHAR2) RETURN NUMBER
AS LANGUAGE JAVA
NAME package.TestClient.sendATextMessage(java.lang.String, int, java.lang.String, java.lang.String, java.lang.String, java.lang.String) return int';
In the Java code this is:
public static int sendATextMessage(String iHost,
int iPort,
String iLogin,
String iPasswd
String iRecipient,
String iMessage)
I've tracked the issue down to there being no SaslClientFactories (via Sasl.getSaslClientFactories()) showing when called from PL/SQL whereas 3 are available when run from within Java directly. This via:
Enumeration<SaslClientFactory> facts = Sasl.getSaslClientFactories();
System.out.println("Found Sasl Factories [" & (facts != null) & "] size[" & Collections.list(facts).size() & "]");
So, is there some aspect of Java initialisation that I'm missing when calling from PL/SQL (which means SASL factories aren't getting loaded into JRE) or is there something different in SASL setup?
Any pointers appreciated.
Thanks
DaveOk, after a bit of reading and general hacking about I have got this working.
What I hadn't initially understood/remembered is that for a Stored Procedure the JVM installed on file system with Oracle isn't actually used - java code is loaded into the database and hence a different set of base functions are available. The following is a good explanation of this http://docs.oracle.com/cd/B14117_01/java.101/b12021/appover.htm#BGBIBDAJ
So "out of the box" the Oracle Database appears to come loaded with only two of the Sun security providers i.e. no com.sum.security.SASL
>
OBJECT_NAME OBJECT_TYPE STATUS TIMESTAMP
com/sun/security/auth/NTSid JAVA CLASS VALID 2013-02-14:14:08:57
com/sun/security/jgss/GSSUtil JAVA CLASS VALID 2013-02-14:14:08:57
>
This is from:
>
SELECT
object_name,
object_type,
status,
timestamp
FROM
user_objects
WHERE
(object_name NOT LIKE 'SYS_%' AND
object_name NOT LIKE 'CREATE$%' AND
object_name NOT LIKE 'JAVA$%' AND
object_name NOT LIKE 'LOADLOB%') AND
object_type LIKE 'JAVA %' AND
object_name LIKE 'com/sun/security%'
ORDER BY
object_type,
object_name;
>
My solution (which may well be a work-around) is the following:
1) Downloaded JDK Source and extracted "com.sun.security.sasl" java code to my project
2) Added following code to my Stored Procedure ()
>
Enumeration<SaslClientFactory> saslFacts = Sasl.getSaslClientFactories();
if (!saslFacts.hasMoreElements()) {
System.out.println("Sasl Provider not pre-loaded");
int added = Security.addProvider(new com.sun.security.sasl.Provider());
if (added == -1) {
System.out.println("Sasl Provider could not be loaded");
System.exit(added);
else {
System.out.println("Sasl Provider added");
>
3) Built my JAR file with the sasl package embedded (note: could only find Java 6 code, so had to comment out some GSS lines - but wasn't intending to use these)
4) Loaded JAR to oracle via "loadjava".
5) Add permissions (only found this out after a couple of failed runs)
>
call dbms_java.grant_permission('XMPP', 'SYS:java.security.SecurityPermission', 'putProviderProperty.SunSASL', '' );
call dbms_java.grant_permission('XMPP', 'SYS:java.security.SecurityPermission', 'insertProvider.SunSASL', '' );
>
6) Run gives the following:
>
Sasl Provider not pre-loaded
Sasl Provider added
...etc...
>
It works!. I confess I'm not sure of the implications of this for multiple calls/performance and if it will need to be added for each stored procedure call - may post back.
For completeness I should point out that after my load the Security providers look like this:
>
OBJECT_NAME OBJECT_TYPE STATUS TIMESTAMP
com/sun/security/auth/NTSid JAVA CLASS INVALID 2013-02-15:09:11:36
com/sun/security/jgss/GSSUtil JAVA CLASS INVALID 2013-02-15:09:11:37
com/sun/security/sasl/Provider JAVA CLASS VALID 2013-02-15:10:03:21
>
i.e. the original couple are "INVALID" !
Dave
Edited by: 946763 on Feb 26, 2013 2:35 AM -
Query working in sql but not if forrms!!!!
I transferred my column apprnum from tblrefstaff to paymast using
SQL>update paymast set paymast.apprnum=(select tblrefstaff.apprnum from tblrefstaff where tblrefstaff.empno=paymast.empno and rownum=1);
5072 rows updated
Now i query for the records in paymast
SQL> select empno from paymast where apprnum='338';
EMPNO
2217
SQL> select apprnum from paymast where empno='2217';
APPRNUM
338
Now in forms when i write this under POST-QUERY
begin
select apprnum
into :paymast.apprnum
from paymast
where empno = :paymast.empno;
exception when no_data_found then null;
end;
no data is retrieved in to the item apprum
its only retrieved when the name of table is that of the previous one like this
begin
select apprnum
into :paymast.apprnum
from tblrefstaff
where empno = :paymast.empno;
exception when no_data_found then null;
end;
2nd CASE: after transferring apprnum to paymast all the items are now under paymast so i just removed the code under POST-QERY and the set the datbase item to yes and column name to APPRNUM but still no use
It only fetches records in apprnum using
select apprnum
into :paymast.apprnum
from tblrefstaff
where empno = :paymast.empno;
exception when no_data_found then null;
end;
how should solve this.?
Edited by: Suhail Faraaz on Nov 10, 2009 2:10 AMi think you forgot to commit; after executing update stmt..
It will work in SQL becoz, you wrote the Query immediately after the select stmt.
But Forms is in another session, it cannot access the data until you commit the SQL session.
Regards
Dora
Edited by: Dora on Nov 10, 2009 2:26 PM
Maybe you are looking for
-
How to allow domain users to customize page Size in Adobe PDF printer.
Hi all, I am not able to customize page size in Adobe PDF printer when I logged in with Domain user login. But I am able to Customize PDF printer in admin Login. I need a solution to allow Domain users to customize page size for Adobe PDF printer. Lo
-
My iPod touch has no sound from music and videos help please
My iPod touch has no sound at all, help please guys.
-
16:9 Problems; help!
I've just recently started using FCE HD 3.5.1, and it great, but I've run into one problem. I can't get my widescreen format to export properly. It turns out in 4:3 without being letterboxed. Now, in my first project I noticed the canvas showed the l
-
IPhoto library inflates from photos which were rotated in the camera!!!
Hi, that is awful! I wondered why my iPhoto library is so big. I use the library only for slideshows and creating albums, *NOT for editing*. I found it out!!! I have tested it with a folder of 100 photos (approx. 1.5 MB each). One version of the fold
-
How do I reset my password when I get this prompt: "The SMTP server "smtp.me.com" rejected the password for user"