I am getting ORA-20993 [duplicate] - oracle

Had a PL/SQL application fail today on an Oracle 19 server with an error code of ORA-20547. Unfortunately, the code in question only dumps the ORA- code, it doesn't supply the SQLERRM value. (The evils that developers do live after them... :-). I've hunted online and haven't found any info on this error. Any info, hints, or references appreciated.

Error numbers from 20000 to 20999 are user-generated errors.
You will not find any documentation for them as you need to check the source code for your application.
From the Oracle documentation
Defining Your Own Error Messages: Procedure RAISE_APPLICATION_ERROR
The procedure RAISE_APPLICATION_ERROR lets you issue user-defined ORA- error messages from stored subprograms. That way, you can report errors to your application and avoid returning unhandled exceptions.
To call RAISE_APPLICATION_ERROR, use the syntax
raise_application_error(
error_number, message[, {TRUE | FALSE}]);
where error_number is a negative integer in the range -20000 .. -20999 and message is a character string up to 2048 bytes long. If the optional third parameter is TRUE, the error is placed on the stack of previous errors. If the parameter is FALSE (the default), the error replaces all previous errors. RAISE_APPLICATION_ERROR is part of package DBMS_STANDARD, and as with package STANDARD, you do not need to qualify references to it.

Related

ORA-20547 - can't find info on Oracle error - any references?

Had a PL/SQL application fail today on an Oracle 19 server with an error code of ORA-20547. Unfortunately, the code in question only dumps the ORA- code, it doesn't supply the SQLERRM value. (The evils that developers do live after them... :-). I've hunted online and haven't found any info on this error. Any info, hints, or references appreciated.
Error numbers from 20000 to 20999 are user-generated errors.
You will not find any documentation for them as you need to check the source code for your application.
From the Oracle documentation
Defining Your Own Error Messages: Procedure RAISE_APPLICATION_ERROR
The procedure RAISE_APPLICATION_ERROR lets you issue user-defined ORA- error messages from stored subprograms. That way, you can report errors to your application and avoid returning unhandled exceptions.
To call RAISE_APPLICATION_ERROR, use the syntax
raise_application_error(
error_number, message[, {TRUE | FALSE}]);
where error_number is a negative integer in the range -20000 .. -20999 and message is a character string up to 2048 bytes long. If the optional third parameter is TRUE, the error is placed on the stack of previous errors. If the parameter is FALSE (the default), the error replaces all previous errors. RAISE_APPLICATION_ERROR is part of package DBMS_STANDARD, and as with package STANDARD, you do not need to qualify references to it.

dbms_output.put_line in PLSQL Developer fails with ORA-06502 for strings longer than 32512 chars

This script fails in PLSQL Developer version 14.0.0.1961 (error ORA-06502: PL/SQL: numeric or value error: character string buffer too small):
declare
v varchar2(32767) := rpad('x',32513,'x');
begin
dbms_output.enable(null);
dbms_output.put_line(v);
end;
/
If 32513 is replaced by higher value, it fails too.
If 32513 is replaced by lower value, it works (i.e. prints text without failure).
In SQL*Plus and Toad it works for up to 32767 (this is expected).
In Intellij Idea it works for up to 32766, for 32767 it does not raise exception though prints nothing.
How can I explain such behaviour? The 32512 seems to be interesting constant (I found it in some APEX question, question about blobs and is also mentioned in JDBC tutorial but I miss any connection to described problem.)
Looks like a PL/SQL Developer bug.
In 2013, they said they'll fix it:
it's a bit of a low-level issue, so his may need to wait until version 11.0.
Which version do you use?

ORA-6502 Character string buffer too small error with Execute immediate statement

I get an Oracle error ORA-6502 Character string buffer too small in my code at the statement below
EXECUTE IMMEDIATE 'BEGIN :project_id :=
Activity_API.Get_Project_Id(:activity_seq); END;'
USING OUT project_id_, activity_seq_
project_id_ - this is a local variable in the function
activity_seq_ -- this is an IN parameter to the function.
I don't understand the cause of the error. Besides, the error is not consistently showing up.
Please help me know what am I missing out.
Thanks.
Generally this error means that you have a VARCHAR(N) variable somewhere in your code and you tried to assign VARCHAR(N+x) value to it. It may happens anywhere, say:
size of activity_seq_ is too big for function local variable
size of project_id_ is too small for function result
there is some oversized value used into the function itself
etc.
Sometimes it may happens because of multibyte character set used, say, if value is VARCHAR(N chars) while assignment target is VARCHAR(n bytes). Anyway, you should just debug it. Use PL/SQL Developer or any other tool which can trace stored procedures row by row, run your statement into the test window and see what happens, where and why.

What data type should WebClassError be passed as in vb6

I have the following function in my Dsr in vb6 ...
...
Private Sub WebClass_FatalErrorResponse(SendDefault As Boolean)
myGenericFatalErrorResponse Error
End Sub
private sub myGenericFatalErrorResponse(byval oError as WebClassError)
...
end sub
Gives Error :-
myGenericFatalErrorResponse Error fails due to type mismatch .
So my Question is what should Error be passed as in myGenericFatalErrorResponse, I am currently just passing "as variant" but feel like "as WebClassError" should have worked.
It should be err.raise.
Remember if a COM Object raises an error it must do it right. Return 8004nnnn errors for vb errors and 8007nnnn for Window's errors. You can translate error numbers but always leave source alone.
Other modules rely on you raising an error.
From VBScript's help (same as VB6's help but less clicks to get to on my computer)
Generates a run-time error.
object.Raise(number, source, description, helpfile, helpcontext)
Arguments
object
Always the Err object.
number
A Long integer subtype that identifies the nature of the error. VBScript errors (both VBScript-defined and user-defined errors) are in the range 0–65535.
source
A string expression naming the object or application that originally generated the error. When setting this property for an Automation object, use the form project.class. If nothing is specified, the programmatic ID of the current VBScript project is used.
description
A string expression describing the error. If unspecified, the value in number is examined. If it can be mapped to a VBScript run-time error code, a string provided by VBScript is used as description. If there is no VBScript error corresponding to number, a generic error message is used.
helpfile
The fully qualified path to the Help file in which help on this error can be found. If unspecified, VBScript uses the fully qualified drive, path, and file name of the VBScript Help file.
helpcontext
The context ID identifying a topic within helpfile that provides help for the error. If omitted, the VBScript Help file context ID for the error corresponding to the number property is used, if it exists.
Remarks
All the arguments are optional except number. If you use Raise, however, without specifying some arguments, and the property settings of the Err object contain values that have not been cleared, those values become the values for your error.
When setting the number property to your own error code in an Automation object, you add your error code number to the constant vbObjectError. For example, to generate the error number 1050, assign vbObjectError + 1050 to the number property.
The following example illustrates use of the Raise method.
On Error Resume Next
Err.Raise 6 ' Raise an overflow error.
MsgBox ("Error # " & CStr(Err.Number) & " " & Err.Description)
Err.Clear ' Clear the error.

How to find the error causing ora-06575?

Recently I had to write an oracle function, and the error ora-06575 popped up awfully a lot.
Usually it was because of missing colon from assignment, such as: z = 5 (vs. z := 5)
Or a missed ';' at the end of a statement.
Anyway, I was able to create the function, but it failed during execution with that error, and gave no hint as to where the problem was (except that it was in the function).
I wrote same function in MSSQL and Sybase, and both of those actually tried to point me to the place of any errors. So I figure I'm doing something wrong in Oracle - it can't just tell me 'there's an error'.
In oracle I have a statement like this:
CREATE OR REPLACE
FUNCTION...
I'm compiling the function from SQL developer by selecting the function, and pressing F9.
When I select a statement which executes the function, and press F9, I get the ora-06575 error.
If I press F5 to compile the function, it tells me:
ORA-24344: success with compilation error
Compiled.
So I found this website: http://www.dba-oracle.com/t_ora_24344_success_with_compilation_error.htm
But I can't seem to run 'show errors'. When I run it, I get no output that I can see.
Can that only work from sqlplus? I'm using SQL developer, I'd prefer to stick to SQL developer.
Is there something I'm missing? I want it to tell me where the error is.
SHOW ERRORS is a sql*plus command
You can also query the USER_ERRORS view
SELECT line, position, text
FROM user_errors
WHERE name = '<<your_object_name>>'
SHOW ERRORS works in SQL*Developer too (at least in the versions I've used recently, certainly 3.1). You mentioned in a comment that you're connected as SYS, so I really hope you're creating your function explicitly in another schema - I'd avoid this anyway just in case you forget one day, and modifying any of the pre-built schemas (SYS, SYSTEM etc.) is a bad idea. If so you need to prefix the errored object with the schema too:
create or replace function my_schema.x return number is
begin
return sysdate;
end;
/
show errors my_schema.x
When run as a script (F5) this says:
FUNCTION X compiled
Warning: execution completed with warning
3/8 PLS-00382: expression is of wrong type
3/1 PL/SQL: Statement ignored
The first two lines of the output come from the function compilation, the last two from show errors. You can also run the two statements separately with F9 to see the same results.
But I'm not sure how you're getting the ORA-24344, so maybe you're on an earlier version; and it's possible that won't work. A.B.Cade's solution will work whatever your client though.

Resources