oracle plsql error while compiling package spec - oracle

create or replace
PACKAGE test_pkg
IS
PROCEDURE abc_requests (p_xys IN NUMBER);
end test_pkg;
Hello my procedure name is abc_requests with just one parameter.
Below is my error message, please help.
Error message:
Error(4,11): PLS-00103: Encountered the symbol " "
when expecting one of the following:
<an identifier>
<a double-quoted delimited-identifier>
current delete exists prior

You have used non-breaking spaces in your statement, instead of plain spaces. If you copy and paste the code from the page as it is displayed above it will work. If you edit the question and copy the original code it will not.
You can use the dump() function (or a decent text editor) to see what the code actually contains:
select dump('PROCEDURE abc_requests (p_xys IN NUMBER);',16) from dual;
DUMP('PROCEDURE ABC_REQUESTS(P_XYS IN NUMBER);',16)
--------------------------------------------------------------------------------------------------------------------------------------------------
Typ=96 Len=44: 50,52,4f,43,45,44,55,52,45,c2,a0,61,62,63,5f,72,65,71,75,65,73,74,73,20,28,70,5f,78,79,73,c2,a0,49,4e,c2,a0,4e,55,4d,42,45,52,29,3b
^^^^^ ^^^^^ ^^^^^
I've highlighted the two problem characters, which are the multibye non-break space (in UTF-8).
Retype your code, or copy and paste from the question, or just change the non-breaking spaces to normal ones.

Related

Using Variable- Oracle

In the above code, I am giving schemaname as input and using that input it should connect to the database. But In this case the value i entered is not taken by the schemaname. This is how the out put and the error is:
declare schemaname varchar2(20);
exec :schemaname := XYZ;
BEGIN
end;
Error report -
ORA-06550: line 2, column 6:
PLS-00103: Encountered the symbol "" when expecting one of the following:
constant exception <an identifier>
<a double-quoted delimited-identifier> table long double ref
char time timestamp interval date binary national character
nchar
ORA-06550: line 4, column 1:
PLS-00103: Encountered the symbol "CONNECT" when expecting one of the following:
Could any one suggest how to make it work using spool
the code between declare and end is PL/SQL. Commands like CONNECT or SPOOL are SQL*Plus commands. You cannot use SQL*Plus commands in a PL/SQL block.
In your case you don't need PL/SQL at all:
Create a script with following content
connect &1
spool C:\ABC
#c:\ABC
spool off;
and run it
#your_script_name
BTW: there is no reason to run script c:\ABC while you are spooling into it. What exactly do you want to achieve?
exec[ute] is SQL*Plus and SQL Developer (and maybe other clients) shorthand for an anonymous block. It is a client command, it is not part of PL/SQL. You are trying to use it inside a PL/SQL declare section, where it is not valid or recognised.
If you want a client bind variable you need the var[iable] command:
var schemaname varchar2(20);
exec :schemaname := '&1';
BEGIN
...
Notice the single quotes around &1, as it's being assigned to a string variable.
But you can't connect inside a PL/SQL block either, and you can't use a bind variable for the connection.
connect :schemaname
will prompt for a password (even if you defined it's value as user/passwd) and try to connect as a user lieterally called :schemaname.
You can use a substituion variable, but you don't really need to define a new one; as you seem to be passing the credentials in, you can do:
connect &1
(without surrounding quotes)

PLS-00103: Encountered the symbol " " when expecting one of the following

For some reason this wont work. I have got it down to the most basic operation to try and troubleshoot.
BEGIN
FOR rec IN (
select REGISTRATION_UID from DIM_REGISTRATION_SET
) 
   LOOP
dbms_output.put_line('Testing 123');
  END LOOP; 
end;
/
My error is as below:
Error starting at line 1 in command:
BEGIN
FOR rec IN (
select REGISTRATION_UID from DIM_REGISTRATION_SET
) 
   LOOP
dbms_output.put_line('Testing 123');
  END LOOP; 
end;
Error report:
ORA-06550: line 4, column 6:
PLS-00103: Encountered the symbol " " when expecting one of the following:
loop
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
You seem to have an unexpected character in your code. If you copy and paste the rendered output from this question then it runs fine. If you copy the question source code (from the edit dialogue) then it gets that error.
Dumping the code (again copied from the source, not the rendering) shows:
select dump('(
select REGISTRATION_UID from DIM_REGISTRATION_SET
) ', 16)
from dual; 
DUMP('(SELECTREGISTRATION_UIDFROMDIM_REGISTRATION_SET) ',16)
--------------------------------------------------------------------------------
Typ=96 Len=73: 28,a,20,20,20,20,20,20,20,20,20,20,73,65,6c,65,63,74,20,52,45,47,
49,53,54,52,41,54,49,4f,4e,5f,55,49,44,20,66,72,6f,6d,20,44,49,4d,5f,52,45,47,49
,53,54,52,41,54,49,4f,4e,5f,53,45,54,a,20,20,20,20,20,20,20,20,29,c2,a0
So the space after the closing parenthesis isn't actually a space, it's Unicode character c2a0, which is a non-breaking space.
The error message shows that too, if you dump that:
select dump ('Encountered the symbol " "', 16) from dual;
DUMP('ENCOUNTEREDTHESYMBOL" "',16)
--------------------------------------------------------------------------------
Typ=96 Len=27: 45,6e,63,6f,75,6e,74,65,72,65,64,20,74,68,65,20,73,79,6d,62,6f,6c
,20,22,c2,a0,22
I would guess you copied that code from somewhere (Word?) and it picked up that character, and it hasn't been translated to a normal space. Just replace it with a space, or remove it as it's redundant whitespace anyway.
Actually, there are several others; two at the start of the LOOP line (followed by two normal spaces), and two immediately before END LOOP; (preceded by two normal spaces), and one after that statement; so those all need to be replaced too. (I'd be tempted to retype the whole thing, but that might not be practical for your full code).

SqlPlus, tablespace parameter, and escaping the dot character

I have a Sqlplus script that I need to execute as part of a process chain, and its purpose is to get rid of two user-defined objects:
myscript.sql
def tablespaceName=&1
drop type &tablespaceName.my_user_tab;
commit;
drop type &tablespaceName\.my_user_type;
commit;
/
Execution: Sqlplus myDbUser/myDbPassword#myDbSID #myscript.sql TESTTABLESPACE
The Sqlplus engine is somehow losing the dot character that separates the tablespace from the object name:
old 1: drop type &tablespaceName.my_user_tab
new 1: drop type TESTTABLESPACEmy_user_tab
drop type TESTTABLESPACEmy_user_tab
*
ERROR at line 1:
ORA-04043: object TESTTABLESPACEMY_USER_TAB does not exist
How do I get Sqlplus to honor the dot and stop removing it from the script?
First of all, you don't need commit/rollback for DDLs.
And to escape the dots. Just use double dots.
drop type &tablespaceName..my_user_tab;
From Doc
If you wish to append characters immediately after a substitution
variable, use a period to separate the variable from the character.

How to get a utf code from symbol in linux

I'm struggling with a special symbol in a text file on linux. I actually successfully pasted it between the following letters "a‏a" (my cursor in Geany stops but no character is displayed).
I'd like to know what's the easiest way to get its utf8 code (in the form U+0000). I'm using ubuntu and geany and I tried hexdump on a file containing it but I'm obviously missing something.
You could open the file with vim, put the text cursor over the character, then type 'ga' (without quotes) and it will display the character code in decimal, hex and octal in the status line.

ORA-06550 and PLS-00103

HI,
I am using UNIX OS and working on oracle. I am getting the error message below
E ORA-06550: line 1, column 8:
PLS-00103: Encountered the symbol "" when expecting one of the following:
begin function package pragma procedure subtype type use
<an identifier> <a double-quoted delimited-identifier> form
current cursor
The symbol "" was ignored.
ORA-06550: line 2, column 27:
PLS-00103: Encountered the symbol "" when expecting one of the following:
begin function package pragma procedure subtype type use
<an identifier> <a double-quoted delimited-identifier>
On googling, I found
"The problem appears to be with Windows CRLF characters on line breaks. Oracle does not treat this as white space, instead it sees it as an empty string. In order to get round this problem, convert the CRLF characters to LF characters and Oracle should be happy."
Anyone have any idea about why it is happening in UNIX/ksh shell?
As #JOTN said, the dos2unix command is your friend here. Should be invoked something like
dos2unix the_file_you_want_converted > another_file_to_hold_the_unix_version
Share and enjoy.

Resources