Why I got error PLS-00103 for this procedure?
Hey, guys:I have a question about the syntax of the exception, I want to record the number of rows from the tables, but if there is no such thing as a table, my program must be able to continue the loop.
create or replace procedure check_rows as
cursor t1 is select table_name from all_csv
where table_built='Y'
and table_name is not null;
match_count1 INTEGER;
begin
for n in t1 loop
dbms_output.put_line(n.table_name);
EXECUTE IMMEDIATE 'SELECT COUNT(*) FROM ' || n.table_name INTO match_count1 ;
update all_csv
set total_rows=match_count1
where table_name=n.table_name;
exception when table_does_not_exist then null end;
end loop;
commit;
end;
I'm your only syntax error:PLS-00103: encountered the symbol "EXCEPTION" when expected
of the following:
begin case declare end exit for goto if loop mod null pragma
raise return select update while < ID >
< between double quote delimited identifiers of > < a variable binding > < <
Close current delete fetch locking insert open rollback
SAVEPOINT SQLExecute set pipe fusion commit forall
Could someone give me a hint?
Thank you very much!
Sam
EXCEPTION clause should be at the end of the BEGIN block. It cannot start in the middle of the lock begin body:
create or replace
procedure check_rows
as
cursor t1
is
select table_name
from all_csv
where table_built='Y'
and table_name is not null;
match_count1 INTEGER;
begin
for n in t1 loop
begin
dbms_output.put_line(n.table_name);
EXECUTE IMMEDIATE 'SELECT COUNT(*) FROM ' || n.table_name INTO match_count1;
update all_csv
set total_rows = match_count1
where table_name = n.table_name;
exception
when table_does_not_exist then null;
end;
end loop;
commit;
end;
/
And it is not a good idea to engage in the stored procedure. But the main question here is table_does_not_exist exception because it is not declared in your code. You must declare it and use PRAGMA EXCEPTION_INIT to connect with the desired error code.
SY.
Tags: Database
Similar Questions
-
has encountered an error "PLS-00103: encountered the symbol"CREATE"when expec".
Hi all
I am creating a procedure and try to use the temporary table...
Here is the code:
--------------------------------------------------------------------------------------------------------------------------------------------
PROCEDURE P_PARENT_TREE
(
topic_id_in in NUMBERS
topic_hierarchy_details_out ON SYS_REFCURSOR
) IS
temp_children_level topic_children.children_level%TYPE;
temp_children_id topic_children.children_id%TYPE;
temp_topic_id topic.topic_id%TYPE;
CURSOR c_child_level IS
SELECT children_level, children_id
OF topic_children
WHERE children_id = topic_id_in;
BEGIN
OPEN c_child_level.
EXTRACT c_child_level INTO temp_children_level, temp_topic_id;
CLOSE C_child_level;
Topic_child CREATE TEMPORARY TABLE IF NOT EXISTS
(t_topic_id, NUMBER, NUMBER, children_seq NUMBER of t_children_id);
WHILE temp_children_level > 0
LOOP
INSERT INTO topic_child (t_topic_id, t_children_id, children_seq)
values)
SELECT topic_id, children_id, children_level
OF topic_children
WHERE children_id = temp_topic_id);
temp_children_level: = temp_children_level - 1;
END LOOP;
OPEN FOR Topic_hierarchy_details_out
Select * from topic_child;
END P_PARENT_TREE;
END TOPIC_PKG;
--------------------------------------------------------------------------------------------------------------------------------------------
the error "PLS-00103: encountered the symbol"CREATE"when expec...
no idea why? or can be is there another way to write this queryCan you post some examples of data? And the expected results?
Looks like you can use a hierarchical query (START WITH... CONNECT BY), and that you do not have a Temp table (like I said before very rare in Oracle) -
Error PLS-00103 and the program has stopped responding
Hey all, I am currently practical with pl/sql, I am a beginner trying to pl/sql self-training, I use the HR schema that accompanies the express edition of oracle 10g for practice, here is my code:
-- -------------------------------------------------------------------------------------------
FUNCTION to CREATE or REPLACE checkIfSalaryExceedMin (currentJobID in NUMBER, currentProposedSalary number)
RETURN BOOLEAN IS
minSalary NUMBER: = 0;
Begin
Select j.min_salary FROM minSalary of JOB j where j.job_id = currentJobID;
RETURN currentProposedSalary > minSalary;
End checkIfSalaryExceedMin;
-- -------------------------------------------------------------------------------------------
-- -------------------------------------------------------------------------------------------
FUNCTION to CREATE or REPLACE checkForJobChange (currentEmpID in NUMBER, currentEmpStartDate IN DATE)
RETURN BOOLEAN IS
CURSOR emp_date_id_list1 IS (Select j1.start_date, e1.employee_id JOB_HISTORY j1 EMPLOYEES JOIN e1 ON j1.employee_id = e1.employee_id);
checkVal NUMBER: = 0;
Begin
For em1 IN LOOP emp_date_id_list1
IF (currentEmpID = em1.employee_id AND currentEmpStartDate! = em1.start_date) THEN
checkVal: = 1;
END IF;
END LOOP;
IF checkVal = 1 THEN
RETURN TRUE;
ELSIF checkVal = 0 THEN
RETURN FALSE;
END IF;
End checkForJobChange;
-- -------------------------------------------------------------------------------------------
-- ===================MAIN====================
Declare
CURSOR emp_date_id_list IS (Select j.start_date, e.employee_id, e.job_id, e.salary JOB_HISTORY e j EMPLOYEES JOIN ON j.employee_id = e.employee_id);
Begin
For em IN emp_date_id_list LOOP
IF (em.start_date < TO_DATE ('1990-01-01', 'YYYY-MM-DD')) THEN
IF (checkForJobChange (em.employee_id, em.start_date)) THEN
IF checkIfSalaryExceedMin (em.job_id, (e.salary + (e.salary*.20))) THEN
DBMS_OUTPUT. Put_line ('you can increase his salary');
END IF;
END IF;
END IF;
END LOOP;
End;
-- ================END==MAIN==================
What it does is check if the employee worked prior to January 1, 1990, if he had had a change of job and if it fulfills the two conditions, the program checks if its proposed new salary will be larger than his salary manager current, if not he can get a pay raise.
So my problem is I got an error PLS-00103 earlier, after some tweaking my program now is insensitive, what am I doing wrong? :(
Help, please. Thank you.checkIfSalaryExceedMin (currentJobID in NUMBER
Must be:
checkIfSalaryExceedMin (currentJobID in VARCHAR2
or:
checkIfSalaryExceedMin (currentJobID IN employees.job_id%type
Since then job_id is of data type VARCHAR2 and not a NUMBER.
Also
IF checkIfSalaryExceedMin (em.job_id, (e.salary + (e.salary*.20))) THEN
must be:
IF checkIfSalaryExceedMin (em.job_id, (em.salary + (em.salary*.20))) THEN
After some tweaking my program does not
I've been juggling as well and are unaware of any 'unresponsiveness':
SQL> declare 2 cursor emp_date_id_list 3 is 4 select j.start_date 5 , e.employee_id 6 , e.job_id 7 , e.salary 8 from job_history j 9 join employees e 10 on j.employee_id = e.employee_id; 11 begin 12 for em in emp_date_id_list 13 loop 14 if (em.start_date < to_date('1990-01-01', 'YYYY-MM-DD')) 15 then 16 if (checkforjobchange(em.employee_id, em.start_date)) 17 then 18 if checkifsalaryexceedmin(em.job_id, (e.salary + (e.salary * .20))) 19 then 20 dbms_output.put_line('You can raise his salary'); 21 end if; 22 end if; 23 end if; 24 end loop; 25 end; 26 / if checkifsalaryexceedmin(em.job_id, (e.salary + (e.salary * .20))) * ERROR at line 18: ORA-06550: line 18, column 47: PLS-00201: identifier 'E.SALARY' must be declared ORA-06550: line 18, column 9: PL/SQL: Statement ignored SQL> declare 2 cursor emp_date_id_list 3 is 4 select j.start_date 5 , e.employee_id 6 , e.job_id 7 , e.salary 8 from job_history j 9 join employees e 10 on j.employee_id = e.employee_id; 11 begin 12 for em in emp_date_id_list 13 loop 14 if (em.start_date < to_date('1990-01-01', 'YYYY-MM-DD')) 15 then 16 if (checkforjobchange(em.employee_id, em.start_date)) 17 then 18 if checkifsalaryexceedmin(em.job_id, (em.salary + (em.salary * .20))) 19 then 20 dbms_output.put_line('You can raise his salary'); 21 end if; 22 end if; 23 end if; 24 end loop; 25 end; 26 / declare * ERROR at line 1: ORA-06502: PL/SQL: numeric or value error: character to number conversion error ORA-06512: at line 18 SQL> create or replace function checkifsalaryexceedmin(currentjobid in employees.job_id%typ e 2 ,currentproposedsalary in number) 3 return boolean is 4 5 minsalary number := 0; 6 7 begin 8 9 select j.min_salary 10 into minsalary 11 from jobs j 12 where j.job_id = currentjobid; 13 14 return currentproposedsalary > minsalary; 15 16 end checkifsalaryexceedmin; 17 / Function created. SQL> declare 2 cursor emp_date_id_list 3 is 4 select j.start_date 5 , e.employee_id 6 , e.job_id 7 , e.salary 8 from job_history j 9 join employees e 10 on j.employee_id = e.employee_id; 11 begin 12 for em in emp_date_id_list 13 loop 14 if (em.start_date < to_date('1990-01-01', 'YYYY-MM-DD')) 15 then 16 if (checkforjobchange(em.employee_id, em.start_date)) 17 then 18 if checkifsalaryexceedmin(em.job_id, (em.salary + (em.salary * .20))) 19 then 20 dbms_output.put_line('You can raise his salary'); 21 end if; 22 end if; 23 end if; 24 end loop; 25 end; 26 / You can raise his salary You can raise his salary PL/SQL procedure successfully completed.
-
Get the error PLS-00103 while specifying the Type of package
Hey bud,
All by specifying a Type which is the table of a different type, in the same package, I get an error in my PL Sql Developer, saying:
Errors of compilation for the OASIS_TST PACKAGE. PK_OA
Error: PLS-00103: encountered the symbol "TABLE" when awaits one of the following values:
opaque object
Line: 61
Text: as a table of tp_report;
Here are the specs of my package where the respective Types are declared:
************************************************************************
create or replace package pk_oa
is
function (report)
as in pd_date)
return tp_tab in pipeline;
type tp_report
as an object
*(*
ID INT,
last_nm VARCHAR2 (50).
first_nm VARCHAR2 (50).
full_nm VARCHAR2 (50));
type tp_tab
as the table of tp_report;
end;
**************************************************************
Could you find where I'm wrong with this piece.
Thank you
HPYou must create types of objects outside packages:
SQL> create or replace type tp_report 2 as object( 3 id INT, 4 last_nm VARCHAR2(50), 5 first_nm VARCHAR2(50), 6 full_nm VARCHAR2(50)); 7 / Typ wurde erstellt. SQL> create or replace package pk_oa 2 is 3 4 type tp_tab 5 is table of tp_report; 6 7 function report ( 8 pd_date in date) 9 return tp_tab pipelined; 10 11 end; 12 / Package wurde erstellt.
URS
-
Hey guys,.
trying to create a trigger, but I'm getting the error pls-00103 I can't seem to find whats wrong
can someone help with this at all?
CREATE OR REPLACE the TRIGGER 'shop_closed_check '.
before insertion or update of current_status on the shop
Start
for each line
If: new.current_status! = ' 4 - CLOSED"and: old.current_status = '4' - CLOSED
RAISE_APPLICATION_ERROR ("NUM = >-20000, msg = > ' cannot reopen a closed call");
on the other
null;
end if;
end shop_closed_check;
Thanks in advance :)
Published by: Sally188 on December 7, 2009 06:45Try this - no need for quotes for the name of the trigger and for each line won't come before
If should have one thencreate or replace trigger shop_closed_check before insert or update of current_status on shop for each row begin if :old.current_status = '4 - CLOSED' then RAISE_APPLICATION_ERROR(NUM=>-20000, msg=>'cannot reopen a closed call'); else null; end if; end shop_closed_check;
-
Error [PLS-00103: encountered the symbol "CREATE"] using PACKAGE
Hi guys!
When I compile this package, I get this error:
PLS-00103: encountered the symbol "CREATE".
How can I solve this problem?
The compiled code is below:
CREATE OR REPLACE
PACKAGE CAMPO_PACK AS
TYPE T_CURSOR IS REF CURSOR;
PROCEDURE DeleteCode (OSDP NUMBER);
END CAMPO_PACK;
-body-
CREATE or REPLACE PACKAGE BODY CAMPO_PACK as
PROCEDURE DeleteCode(pCod NUMBER) AS
BEGIN
DELETE FROM campo
WHERE cod = OSDP;
END DeleteCode;
END CAMPO_PACK;
Thanks for the help,
Anderson
Published by: user8723300 on 08/13/2009 17:03
Published by: user8723300 on 08/13/2009 17:04I use Oracle SQL Developer
I know very well of this tool.
The packet header and body are two separate objects and must be compiled separately. I suspect that the package body is somehow have included in package header and Developer SQL tries to compile all of these at once. You must understand how to compile the header first, then the body. Your code compiles if I use sqlplus. I had to first create the table, so I have included a slash (/) after the packet header and the other after that body. The slash tells sql more to run the buffer (in this case, to compile the object).
SQL> create table campo (cod number); Table created. SQL> CREATE OR REPLACE 2 PACKAGE CAMPO_PACK AS 3 4 TYPE T_CURSOR IS REF CURSOR; 5 6 PROCEDURE DeleteCode(pCod NUMBER); 7 8 END CAMPO_PACK; 9 / Package created. SQL> CREATE OR REPLACE PACKAGE BODY CAMPO_PACK AS 2 3 PROCEDURE DeleteCode(pCod NUMBER) AS 4 BEGIN 5 DELETE FROM campo 6 WHERE cod = pcod; 7 END DeleteCode; 8 9 END CAMPO_PACK; 10 / Package body created.
If I remove the slash after the package header, sql more trying to compile all this at once, and I get the same error you get:
SQL> CREATE OR REPLACE 2 PACKAGE CAMPO_PACK AS 3 4 TYPE T_CURSOR IS REF CURSOR; 5 6 PROCEDURE DeleteCode(pCod NUMBER); 7 8 END CAMPO_PACK; 9 10 CREATE OR REPLACE PACKAGE BODY CAMPO_PACK AS 11 12 PROCEDURE DeleteCode(pCod NUMBER) AS 13 BEGIN 14 DELETE FROM campo 15 WHERE cod = pcod; 16 END DeleteCode; 17 18 END CAMPO_PACK; 19 / Warning: Package created with compilation errors. SQL> sho err Errors for PACKAGE CAMPO_PACK: LINE/COL ERROR -------- ----------------------------------------------------------------- 9/1 PLS-00103: Encountered the symbol "CREATE"
-
I got error creative cloud 43 this facility that can I do thanks
I got error creative cloud 43 this facility that can I do thanks
Please, try the following steps:
- Uninstall Adobe CC of the machine (Creative Cloud help |) Uninstall the creative Office Cloud app)
- Set the "Read and write" permissions on the files of Adobe for all users in the following locations:
- / Library/Application Support /.
- /Users/ [user name] / Library/Application Support /.
- Restart the computer.
- Install the application Adobe CC (Creative Cloud help |) Creative cloud for office)
-
Mac user. CS4 still active (not disabled) on my macbook pro DIED. Time Machine installed CS4 on my new macbook pro. Error message, "licensing for this product has stopped working".
How can I disable my old macbook DEAD pro CS4 and activate CS4 on my new mackbook pro?
Hi Christophe,
Please visit: https://helpx.adobe.com/x-productkb/policy-pricing/activate-deactivate-products.html
Contact technical support for assistance:
https://helpx.Adobe.com/in/contact.html?step=CCSN_adobe-ID-signing-in_stillNeedHelp
I hope this helps.
Concerning
Megha Rawat
-
I get this error message. "Error adobe license for this product has stopped working. You cannot use this product at this time. You must repair the problem by uninstalling and then reinstalling this product or contact your COMPUTER administrator or Adobe customer support for assistance. (148: 3) "How can I fix it? When I reinstalled the software, I get a message that I have an invalid serial number.
Hi John,.
Could you please the version of Acrobat you are using, and also work on the operating system?
To check the serial number of your product, you may return the following document.
Quickly find your serial number
If you are using windows you can see the following link for more information on the solution to the existing problem.
https://helpx.Adobe.com/Creative-Suite/KB/error-licensing-stopped-Windows.html
If you wish to contact Adobe support team, please visit the following link.
http://helpx.Adobe.com/x-productkb/global/Service1.html
Please click the blue button "Still need help" to connect with Adobe executives.
Let us know how it goes. In case you need more assistance write us back.
We would be happy to help you.
Concerning
Sukrit diallo
-
My work laptop crashed and I want to install PhotoShop CS4 on a working PC I get an error msg "License for this product has expiré.
-
I restarted my PC but not resolved. I am on Windows 7
-
Error PLS-00103 in simple code
Hello
I have the code simpleset play and get compile time error
Here's the code...PLS-00103: Encountered the symbol "CREATE" when expecting one of the following: ( begin case declare end exception exit for goto if loop mod null pragma raise return select update while with <an identifier> <a double-quoted delimited-identifier> <a bind variable> << continue close current delete fetch lock insert open rollback savepoint set sql execute commit forall merge pipe purge
Thank youcreate or replace PROCEDURE PRC_TBL_RPT16_LOAD_INIT ( po_return_code OUT VARCHAR2) IS v_exec_string VARCHAR2(4000); v_text_line whr_execution_log.text_line%TYPE; c_process_name CONSTANT whr_execution_log.process_name%TYPE := 'PRC_TBL_RPT16_LOAD_INIT'; BEGIN v_text_line := 'Start'; prc_whr_execution_log_entry(c_process_name,1,'INFO',v_text_line,NULL); COMMIT; DROP TABLE tbl_rpt16; CREATE TABLE tbl_rpt16 NOLOGGING AS SELECT A.postdateid, CAST(M.accountnumber AS VARCHAR2(25)) accountnumber, CAST(M.fname||' '||M.lname AS VARCHAR2(200)) mbr_name, COUNT(*) nbr_stays, SYSDATE date_created, CAST(c_process_name AS VARCHAR2(30)) created_by FROM accrual A, memberattribute ma, MEMBER M WHERE A.uiflag IS NOT NULL AND A.postdateid IS NOT NULL AND M.memberid = ma.memberid AND M.memberid = A.memberid GROUP BY A.postdateid, M.accountnumber, M.lname, M.fname; EXCEPTION WHEN OTHERS THEN v_text_line := 'OTHER error: '||SQLERRM; prc_whr_execution_log_entry(c_process_name,1,'ERROR',v_text_line,NULL); COMMIT; po_return_code := '99'; END; -- PROCEDURE prc_tbl_rpt15_load_init
SandyYou try to delete it and create a table (ie. do some DDL) in your procedure. This is not allowed. You will need to create your table in a script or use of execute immediate to do dynamic sql (which will allow you to do the DOF).
However, why would you let drop and then re-create the same table?
If the goal is to clear the data in the table, why not simply truncate the table (again, using the dynamic sql) and use an insert to repopulate it?
Better yet, what this table is used to? If this is to temporarily store data so it can be accessed via a sql statement, why not just go straight to the tables and skip this step entirely?
-
Hi all
I get this error:
- Error (55,45): PLS-00103: encountered the symbol 'COLLECT' during the waited in the following way:. (, limiting the symbol ".") has been inserted before 'COLLECT' to continue.
While trying to create this procedure as below:
If I run the query, I get the result, but in the procedure, I am trying to convert the OUT_REFCURSOR in a table, but this error.
PROCEDURE SP_GETVALIDATE)
IN_CASEID IN VARCHAR2,
IN_REQID IN VARCHAR2,
OUT_REFCURSOR ON SYS_REFCURSOR)
AS
IS OF TYPE RECORDTYPE
RECORD (COL1, COL2 VARCHAR2 VARCHAR2);
IS OF TYPE TABLETYPE
THE REFTABLETYPE TABLE
INDEX BY PLS_INTEGER;
BEGIN
OPEN for SELECT OUT_REFCURSOR c.RCRD_NO, c.STE_NO_TX DE T_LYR_STES c, p of LAND WHERE c.case_id = IN_CASEID AND p.L_NUMBER > 100;
LOOP
Look FOR the OUT_REFCURSOR BULK COLLECT outtable;
WHEN the outtable OUTPUT. COUNT = 0;
FOR indx IN 1... outtable. COUNTY
LOOP
dbms_output.put_line (outtable (indx). ) RCRD_NO);
END LOOP;
END LOOP;
CLOSE OUT_REFCURSOR;
END SP_GETVALIDATE;
I could be wrong here.
any help appreciated.
Thank you
Ken
SEARCH OUT_REFCURSOR BULK COLLECT INTO outtable;
You've had your BULK COLLECT and the wrong way around
-
Error PLS-00103 stored procedure: encountered the symbol «/»
HelloI'm trying this on Oracle 11 g on Centos 6.2 Express
Summer make mistakeERROR on line 1:
ORA-06550: line 1, column 7:
PLS-00103: encountered the symbol "/" when expecting one of the following values:
..
ERROR on line 1:
ORA-06550: line 1, column 7:
PLS-00103: encountered the symbol "/" when expecting one of the following values:For the following procedure, can someone help me?
CREATE OR REPLACE PROCEDURE bulkInsert()
AS
BEGIN
FOR x IN 1.100
LOOP
INSERT INTO arrested
(order_id, order_name, order_status)
VALUES
(x, 'Fish', 'Y');
END LOOP;
COMMIT;
END bulkInsert;
/concerning
Sameer44849b9b-03d8-4edd-bb18-e7f3e4fa4c6d wrote:
Creates a file named bulkoracleinput and I'm running to help run
/filename. If you want to run a SQL Script file in SQL more then you need to use the command @ and not the command EXECUTE.
Try like this
@
/filename. -
Try to run the procedure and get an error PLS-00103
I have a procedure defined with these parameters
create or replace PROCEDURE procAuth
(
EMAIL IN VARCHAR2,
PASSWORD IN VARCHAR2,
IP IN VARCHAR2,
UL NUMBER
)
Using this code
var x number
procAuth exec ('[email protected]', ' 555555 ', ' 1.1.1.1': x);
print x
gives me
Error at startup on line 2 of the command:
procAuth exec ('[email protected]', ' 555555 ', ' 1.1.1.1': x);
Error report:
ORA-06550: line 1, column 65:
PLS-00103: encountered the symbol "" when expecting one of the following values:
. ( ) , * @ % & | = + - <>/ at is mod not rank rem = >
.. < an exponent (*) > <>or! = or ~ = > = < = <>and or as
between |
The symbol ',' was replaced by ' ' to continue.
06550 00000 - "line %s, column % s:\n%s".
* Cause: Usually a PL/SQL compilation error.
* Action:
x
------
Thanks for any helpjerry8989 wrote:
I have a procedure defined with these parameterscreate or replace PROCEDURE procAuth
(
EMAIL IN VARCHAR2,
PASSWORD IN VARCHAR2,
IP IN VARCHAR2,
UL NUMBER
)Using this code
var x number
exec procAuth (' [email protected]', '555555',' 1.1.1.1': x);
print xgives me
Error at startup on line 2 of the command:
exec procAuth (' [email protected]', '555555',' 1.1.1.1': x);a comma is perhaps missing to the right of the right like apostrophe below?
procAuth exec ('[email protected]', ' 555555 ', ' 1.1.1.1',: x);
Maybe you are looking for
-
There is a long discussion on bugzilla (follow the link to https://blocklist.addons.mozilla.org/nl/firefox/blocked/p428 https://bugzilla.mozilla.org/show_bug.cgi?id=636633) on the blocking of the Java plugin. According to this (now closed to comments
-
Why can I not access "Tools"?
It is suggested that I go to "tools/options/...etc" but I have no icon 'tools' at the top of my page. Can you help me to restore the correct layout?
-
I opened Firefox accidentally then cancel pressed, thinking that it does not open Firefox if I did it, but it opens it in any case, but does not restore my last session (I needed) and now I can't find how to restore - help! This has happened Just onc
-
Satellite A300-1pw - WLan has stopped working
Hello I got the new laptop Satellite A300-1pw at Christmas.Connection Wi - Fi everything ok, but 30 days end of trial of macafee, wifi does not work and works with the cable connected to the router. Thanks for any help
-
700 - 147C envy: high connections USB3 &; Audio do not have
First the USB3 TOP connector failed & would be the only function as USB2 Audio failed. Since they are both of the same Assembly (relief, small stage, located on the upper part, in advance, of the PC). The switch is on top of this platform, while the