has encountered an error "PLS-00103: encountered the symbol"CREATE"when expec".
Hi allI 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 query
Can 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)
Tags: Database
Similar Questions
-
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"
-
Hello
Clearly, I'm doing a basic error.
It is my statement prepared;
Variable identifier;
EXEC SQL PREPARE sql_stmt OF ' SELECT order_name, order_status OF orders WHERE order_id <: id; »
I get the error on execution of the file using @/dir/file.sql
PLS-00103: encountered the symbol "PREPARE" when awaits an of the
Next:
What is the problem?
concerning
Sameer
Yes. You are right. A thorough SQL more guide and modified the SQL for this
Variable identification number
VARIABLE order_info REFCURSOR
Begin
: id: = 20000;
Open: order_info to SELECT order_name, order_status OF orders WHERE order_id<>
End;
It works fine when it is called from the @/file/file.sql command prompt
then I print command line order_info
Thank you
Sameer
-
PLS-00103: encountered the symbol 'NUMBER' when awaits a the follow
Hi, I have this error:-
OS: xp
Oracle 8i
SQL > Create or replace procedure Balance_chk is
mclient_no 2 number (5);
3 mbal_due number (10.2);
4 less_than_min_bal
number (3) add_amt 5.
min_bal 6 number (7.2);
7. start
8 add_amt: = 500;
9 min_bal: = 2000;
10 mClient_no: = & mClient_no;
11. Select bal_due in the Client_mast mbal_due where client_no = mClient_no;
12 if mbal_due > = Min_bal then
13 update client_mast set bal_due = (mbal_due + add_amt) where client_no is mclient_no;.
14 end if;
15 exception
16 when less_than_min_bal then
17 dbms_output.put_line (' balance ' | bal_due);
18 end;
19.
Enter the value for mclient_no: 10001
10 old: mClient_no: = & mClient_no;
new 10: mClient_no: = 10001;
CAUTION: Procedure created with compilation errors.
SQL > show error
Errors in PROCEDURE BALANCE_CHK:
LINE/COL ERROR
-------- -----------------------------------------------------------------
5/9 PLS-00103: encountered the symbol 'NUMBER' when waiting for an a
What follows:
:= . (@ %; not null default range character)
The symbol ': = ' was replaced by 'NUMBER' to continue.you are missing; at the end of the line 4
-
PLS-00103: encountered the symbol "create".
"I have a code below for which I get an error: 17/2 PLS-00103: encountered the symbol"create""
I copied the code of a manual and annot figure out why it doesn't work.
Plase help, thanks :)
============================
create or replace package course_pkg AS
type course_rec_typ IS RECORD
(name, student.first_name%TYPE,
student.last_name%type last_name,
course_no course.course_no%type,
Description course.description%type,
section_no section.section_no%type
);
type course_cur is ref cursor return course_rec_typ;
procedure get_course_list
(p_student_id NUMBER,
p_instructor_id NUMBER,
course_list_cv IN OUT course_cur);
end course_pkg;
create or replace package body course_pkg AS
procedure get_course_list
(p_student_id NUMBER,
p_instructor_id NUMBER,
course_list_cv IN OUT course_cur)
is
Start
If p_student_id is null and p_instructor_id
is null then
Open the course_list_cv for
Select 'Please choose a student -' first_name,
'combination instructor' last_name,.
Course_no NULL,
Description NULL,
Section_no NULL
Double;
elsif p_student_id is null then
Open the course_list_cv for
Select first_name s.first_name
s.last_name last_name,
c.course_no course_no,
description of the c.Description,
se.section_no section_no
instructor, I, s student, section se, courses, e-registration
where i.instructor_id = p_instructor_id
and i.instructor_id = se.instructor_id
and se.course_no = c.course_no
AND e.student_id = s.student_id
AND e.section_id = se.section_id
order of c.course_no, se.section_no;
elsif p_instructor_id is NULL then
Open the course_list_cv for
Select first_name i.first_name
i.last_name last_name,
c.course_no course_no,
description of the c.Description,
se.section_no section_no
Instructor, I, s student, section se, courses, e-registration
where s.student_id = p_student_id
AND e.instructor_id = se.instructor_id
and se.course_no = c.course_no
and e.student_id = s.student_id
and e.section_id = se.section_id
order of c.course_no, se.section_no;
END IF;
END get_course_list;
end course_pkg;
/In the code you posted, you have only 1 slash - at the end of the package body.
You must compile the spec and body separately.
They can be in the same script file if you wish, but there must be a slash after the spec code and once after the code of the organization.
-
pl/sql Funtion: PLS-00103: encountered the symbol "CREATE".
drop table ur2users;
drop table ur3users;
-Create a wrapper of sql for the jave Migrator class password
create or replace
function hi_world_sample (p_command IN VARCHAR2)
return VARCHAR2
IN THE JAVA LANGUAGE
NAME "java.lang.String HiWorld.MyMessage (java.lang.String) return;
-Create temporary ur2users table to insert users ur2
Create the table ur2users
(
user_id number (19.0),.
email varchar (250).
varchar (250)) password.
-Create temporary ur3users table to insert users ur3
Create the table ur3users
(
user_id number (19.0),.
email varchar (250).
varchar (250)) password.
When I query above is lance in developer sql on the database to Oracle 11 g Enterprise Edition Release 11.1.0.7.0 - Production, 64-bit following is displayed:
HI_WORLD_SAMPLE compiled FUNCTION
Errors: Newspaper the compiler check
-the compiler log-
I get the errorPLS-00103: encountered the symbol "CREATE".
When I run the service in the current state, only, it compiles without error.
what I am doing wrong?
Thank you.Try again with a slash "/" at the end of the CREATE FUNCTION statement:
create or replace function hi_world_sample (p_command IN VARCHAR2) return VARCHAR2 AS LANGUAGE JAVA NAME 'HiWorld.MyMessage(java.lang.String) return java.lang.String'; /
-
Encountered the symbol "LOOP" when waiting for him...
Hello, I run this code:
but I have:DECLARE CURSOR cur IS SELECT ID, SEQNR, TRPELID FROM ITAI11_MP2103 WHERE ROWNUM<10 ORDER BY ID, SEQNR; rec cur%ROWTYPE; prohibLink1 cur.TRPELID%TYPE; prohibLink2 cur.TRPELID%TYPE; prohibLink3 cur.TRPELID%TYPE; prohibLink4 cur.TRPELID%TYPE; prohibLink5 cur.TRPELID%TYPE; currMPID cur.ID%TYPE; currSeq1ID cur.TRPELID%TYPE; linkIDSeq2 PL_LINK$.LINK_ID%TYPE; BEGIN OPEN cur; LOOP FETCH cur INTO rec; EXIT WHEN cur%NOTFOUND; IF (rec.SEQNR = 1) THEN currMPID := rec.ID; currSeq1ID := rec.TRPELID; SELECT PL1, PL2, PL3, PL4, PL5 INTO prohibLink1, prohibLink2, prohibLink3, prohibLink4, prohibLink5 FROM PL_LINK$ WHERE ID = rec.TRPELID; ELSE IF (rec.SEQNR = 2) AND (currMPID = rec.ID) THEN SELECT LINK_ID INTO linkIDSeq2 FROM PL_LINK$ WHERE ID = rec.TRPELID; IF (prohibLink1 IS NULL) THEN UPDATE PL_LINK$ SET PL1 = linkIDSeq2 WHERE ID = currSeq1ID; DBMS_OUTPUT.PUT_LINE('Setting PL1 = '||linkIDSeq2||' for link with ID = '||currSeq1ID); ELSE IF (prohibLink2 IS NULL) THEN UPDATE PL_LINK$ SET PL2 = linkIDSeq2 WHERE ID = currSeq1ID; DBMS_OUTPUT.PUT_LINE('Setting PL2 = '||linkIDSeq2||' for link with ID = '||currSeq1ID); ELSE IF (prohibLink3 IS NULL) THEN UPDATE PL_LINK$ SET PL3 = linkIDSeq2 WHERE ID = currSeq1ID; DBMS_OUTPUT.PUT_LINE('Setting PL3 = '||linkIDSeq2||' for link with ID = '||currSeq1ID); ELSE IF (prohibLink4 IS NULL) THEN UPDATE PL_LINK$ SET PL4 = linkIDSeq2 WHERE ID = currSeq1ID; DBMS_OUTPUT.PUT_LINE('Setting PL4 = '||linkIDSeq2||' for link with ID = '||currSeq1ID); ELSE IF (prohibLink5 IS NULL) THEN UPDATE PL_LINK$ SET PL5 = linkIDSeq2 WHERE ID = currSeq1ID; DBMS_OUTPUT.PUT_LINE('Setting PL5 = '||linkIDSeq2||' for link with ID = '||currSeq1ID); END IF; END IF; END LOOP; CLOSE cur; END; /
*
ERROR on line 44:
ORA-06550: line 44, column 5:
PLS-00103: encountered the symbol "LOOP" when expecting one of the following conditions:
If
ORA-06550: line 46, column 4:
PLS-00103: encountered the symbol "end-of-file" when awaits an of the
Next:
not end up dominant static of final instantiable order pragma
manufacturer membership card
you know what mean?
Thank you very much.Try this:
DECLARE CURSOR cur IS SELECT ID, SEQNR, TRPELID FROM ITAI11_MP2103 WHERE ROWNUM<10 ORDER BY ID, SEQNR; rec cur%ROWTYPE; prohibLink1 ITAI11_MP2103.TRPELID%TYPE; -- referred a column type from a table instead of a cursor prohibLink2 ITAI11_MP2103.TRPELID%TYPE; -- referred a column type from a table instead of a cursor prohibLink3 ITAI11_MP2103.TRPELID%TYPE; -- referred a column type from a table instead of a cursor prohibLink4 ITAI11_MP2103.TRPELID%TYPE; prohibLink5 ITAI11_MP2103.TRPELID%TYPE; currMPID ITAI11_MP2103.ID%TYPE; currSeq1ID ITAI11_MP2103.TRPELID%TYPE; linkIDSeq2 PL_LINK$.LINK_ID%TYPE; BEGIN OPEN cur; LOOP FETCH cur INTO rec; EXIT WHEN cur%NOTFOUND; IF (rec.SEQNR = 1) THEN currMPID := rec.ID; currSeq1ID := rec.TRPELID; SELECT PL1, PL2, PL3, PL4, PL5 INTO prohibLink1, prohibLink2, prohibLink3, prohibLink4, prohibLink5 FROM PL_LINK$ WHERE ID = rec.TRPELID; ELSIF (rec.SEQNR = 2) AND (currMPID = rec.ID) THEN SELECT LINK_ID INTO linkIDSeq2 FROM PL_LINK$ WHERE ID = rec.TRPELID; IF (prohibLink1 IS NULL) THEN UPDATE PL_LINK$ SET PL1 = linkIDSeq2 WHERE ID = currSeq1ID; DBMS_OUTPUT.PUT_LINE('Setting PL1 = '||linkIDSeq2||' for link with ID = '||currSeq1ID); ELSIF (prohibLink2 IS NULL) THEN UPDATE PL_LINK$ SET PL2 = linkIDSeq2 WHERE ID = currSeq1ID; DBMS_OUTPUT.PUT_LINE('Setting PL2 = '||linkIDSeq2||' for link with ID = '||currSeq1ID); ELSIF (prohibLink3 IS NULL) THEN UPDATE PL_LINK$ SET PL3 = linkIDSeq2 WHERE ID = currSeq1ID; DBMS_OUTPUT.PUT_LINE('Setting PL3 = '||linkIDSeq2||' for link with ID = '||currSeq1ID); ELSIF (prohibLink4 IS NULL) THEN UPDATE PL_LINK$ SET PL4 = linkIDSeq2 WHERE ID = currSeq1ID; DBMS_OUTPUT.PUT_LINE('Setting PL4 = '||linkIDSeq2||' for link with ID = '||currSeq1ID); ELSIF (prohibLink5 IS NULL) THEN UPDATE PL_LINK$ SET PL5 = linkIDSeq2 WHERE ID = currSeq1ID; DBMS_OUTPUT.PUT_LINE('Setting PL5 = '||linkIDSeq2||' for link with ID = '||currSeq1ID); END IF; END IF; END LOOP; CLOSE cur; END; /
PS: Not tested
-
Hello
I get the following error when I try to compile the procedure. I call a package inside this simple procedure. Not sure where I do worng. Here is the error I get.
Error (34.2): PLS-00103: encountered the symbol "END"?
Here is my code
create or replace PROCEDURE BATCH_JOB_CAC_SP
(
vstatus OUT NUMBER)
AS
vloadserver global_name.global_name%TYPE: = get_dbservername;
vuseridmod CONSTANT VARCHAR2 (15): = 'SYSTEM '.
vloadname CONSTANT VARCHAR2 (30): = "BATCH_JOB_CAC_SP";
v_cnt_upd NUMBER: = 0;
vrunid NUMBER;
v_spoutput VARCHAR2 (150);
CURSOR job_cac
IS
SELECT NumCli, job_cac FROM batch_job_cac, batch_recid, jobnum;
BEGIN
I'm in job_cac LOOP
job_cac_pkg.job_cac_valid_sp (i.custnum, i.jobnum, v_spoutput);
CASE v_spoutput
WHEN "1" THEN DBMS_OUTPUT. Put_line ('update job ACC');
WHEN "2" THEN DBMS_OUTPUT. Put_line ('update job ACC');
WHEN '3' THEN DBMS_OUTPUT. Put_line ('can not update working ACC');
OF ANOTHER DBMS_OUTPUT. Put_line (v_spoutput);
END CASE;
END LOOP;
EXCEPTION
WHILE OTHERS THEN
IF job_cac % isopen THEN
CLOSE Job_cac;
END IF;
ROLLBACK;
vStatus: = 1;
LOG_ERROR_SP_NM (vLoadServer, vLoadName, SQLCODE, SQLERRM, vUserIdMod);
END;
END BATCH_JOB_CAC_SP;
Thanks for your help.
Hello
You have 2 statements END at the bottom of your code, but only 1 BEGIN statement earlier.
Losing one of these END States.
-
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.
-
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?
-
Hello
I am trying to create a function inside the packaging.
In the Package BODY I've defined the function, but in the definition of the package, it gives me syntax errors.
- Error (15,3): PLS-00103: encountered the symbol ";" when expecting one of the following values: back
- Error (39.1): PLS-00103: encountered the symbol "END" when waiting for one of the following values: start the function pragma procedure subtype type current cursor removal exist prior
What can I do wrong here.
Thank you
Ken
Inner package BODY:
/ * FUNCTION to form the query * /.
FUNCTION UDF_FORMQUERY)
IN_CASEID VARCHAR2,
IN_SRCLYR VARCHAR2,
IN_SRC_CONDN VARCHAR2
)
RETURN VARCHAR2
AS
varSQLQuery VARCHAR2 (10000);
BEGIN
varSQLQuery: = "test query";
RETURN varSQLQuery;
DBMS_OUTPUT. Put_line (varSQLQuery);
END UDF_FORMQUERY;
Definition of package inside:
create or replace PACKAGE BODY MY_SQUERY
AS
FUNCTION UDF_FORMQUERY)
IN_CASEID VARCHAR2,
IN_SRCLYR VARCHAR2,
VARCHAR2 IN_SRC_CONDN( )
RETURN VARCHAR2
AS varSQLQuery VARCHAR2 (10000);
END MY_SQUERY;
your package definition is incorrect, you have included the part of the declaration of the variables of the function in the package definition. It should be like
FUNCTION UDF_FORMQUERY)
IN_CASEID VARCHAR2,
IN_SRCLYR VARCHAR2,
IN_SRC_CONDN VARCHAR2)
RETURN VARCHAR2;
-
Getting error PLS-00103: encountered the symbol "MM".
SQL > create or replace procedure DIP. Insert_proc is
2 start
3 immediately execute "INSERT INTO DIP. RAKS (SELECT * FROM DIP.) RAKS WHERE CREATED BETWEEN to_char (TRUNC (ADD_MONTHS (SYSDATE-1), 'MM'), 'YYYYMMDD') AND to_char (TRUNC (LAST_DAY (ADD_MONTHS (SYSDATE-1))), 'YYYYMMDD')); "
4 run immediately "COMMITTED";
5 immediately execute "INSERT INTO DIP. RAKS (SELECT * FROM DIP.) RAKS WHERE CREATED BETWEEN to_char (TRUNC (ADD_MONTHS (SYSDATE-1), 'MM'), 'YYYYMMDD') AND to_char (TRUNC (LAST_DAY (ADD_MONTHS (SYSDATE-1))), 'YYYYMMDD')); "
6 immediate execution "COMMITTED";
7 end;
8.
CAUTION: Procedure created with compilation errors.
SQL >
SQL >
SQL > show error
DIP PROCEDURAL errors. INSERT_SIV_SELL_PROC:
LINE/COL ERROR
-------- -----------------------------------------------------------------
3/128 PLS-00103: encountered the symbol "MM" when awaits an of the
Next:
* & = - + ; <>/ is mod remains not return rem
return < an exponent (*) > <>or! = or ~ = > = < = <>and or
as like2 like4 likec between using | bulk of type multiset
Member submultiset
SQL >
any help appreciated.
CREATE OR REPLACE PROCEDURE DIP. Insert_proc IS
BEGIN
immediately execute "INSERT INTO DIP. RAKS (SELECT * FROM DIP.) RAKS WHERE CREATED BETWEEN to_char (TRUNC (ADD_MONTHS (SYSDATE-1), "MM"), "YYYYMMDD") AND to_char (TRUNC (LAST_DAY (ADD_MONTHS (SYSDATE-1))), "YYYYMMDD"))';
RUN IMMEDIATELY "COMMITTED";
immediately execute "INSERT INTO DIP. RAKS (SELECT * FROM DIP.) RAKS WHERE CREATED BETWEEN to_char (TRUNC (ADD_MONTHS (SYSDATE-1), "MM"), "YYYYMMDD") AND to_char (TRUNC (LAST_DAY (ADD_MONTHS (SYSDATE-1))), "YYYYMMDD"))';
run immediately "COMMITTED";
end;
/
Missing semicolon, I modified the last answer but you picked up before it was visible
-
PLS-00103: encountered the symbol "VARCHAR2".
Hi all
on 11.2.0.4 on Win 2008
Executing steps I get PLS-00103: encountered the symbol "VARCHAR2":
DECLARE
BEGIN
plsql_block VARCHAR2 (500);
plsql_block: = ' BEGIN create_dept (:,: b: c: d); END;';
END;
/
ORA-06550: line 3, column 13:
PLS-00103: encountered the symbol "VARCHAR2" when expecting one of the following conditions:
:= . ( @ % ;
The symbol ': = ' has been substituted for "VARCHAR2" continue.
Thank you for helping me see my error.
Hello
Variable declaration is declared between the two and start. Personally, I prefer the initialization of variables there.
DECLARE
plsql_block VARCHAR2 (40): = ' start create_dept (:,: b: c: d); end;';
BEGIN
...
You did not request this, but I'm telling you anyway
I also use declare start the buildings inside the code to make the code more manageable, compact and clear (because I have a short memory, I need to see everything in one small scope at a time). Then, the blocks are easy enough to separate function or procedure if necessary.
set serveroutput on declare x number := 0; procedure step(p1 number) is begin dbms_output.put_line('Step ' || p1); end; begin step(x); declare y number := x + 1; begin step(y); end; declare z number := x + 2; begin step(z); end; end; / anonymous block completed Step 0 Step 1 Step 2
-
PLS-00103: encountered the symbol "ALTER".
I receive he following error when I run this script
DECLARE
vcount NUMBER (1);
BEGIN
SELECT count (*) IN the all_col_comments vcount
WHERE owner = 'myUser' and Table_Name = 'table1' and column_name = 'col1 ';
IF vcount = 0 THEN
ALTER TABLE myUser.table1
ADD (col1 varchar2 (1) DEFAULT ' is NOT NULL);
END IF
END;
Error report:
ORA-06550: line 7, column 4:
PLS-00103: encountered the symbol "ALTER" when expecting one of the following conditions:
(begin case declare exit for goto if loop mod null pragma
raise return select update while < ID >
< between double quote delimited identifiers of > < a variable binding > < <
continue the narrow current delete fetch locking insert open rollback
savepoint sql set run commit forall fusion pipe purge
The symbol 'lock has been inserted before "ALTER" to continue.
ORA-06550: line 8, column 11:
PLS-00103: encountered the symbol "(" quand attend une deles de valeurs suivantes:) "
, in
ORA-06550: line 8, column 47:
PLS-00103: encountered the symbol "NULL" when expected in the following way:
as like2 like4 likec between Member submultiset
06550 00000 - "line %s, column % s:\n%s".
* Cause: Usually a PL/SQL compilation error.There is no need to pack the column names in the TOP, the names of the objects are stored by default at the top of case. Isn't that quoted strings must be upper case, but yes, your last block is basically my second block and will correctly find the column already exists when it is executed a second time. Your original, with tiny strings cited would never return a line fomr the query on the column, so would attempt to add the column each time.
SQL> select table_name, column_name 2 from all_tab_columns 3 where owner = 'ops$oracle' and 4 table_name = 'table1' and 5 column_name = 'col1'; no rows selected SQL> select table_name, column_name 2 from all_tab_columns 3 where owner = 'OPS$ORACLE' and 4 table_name = 'TABLE1' and 5 column_name = 'COL1'; TABLE_NAME COLUMN_NAME ------------------------------ ------------------------------ TABLE1 COL1
See the difference?
(I only did the drop table so that I can redo the pl/sql block from scratch to show that was) the first time he ran he added the column and b) for subsequent executions, he did not attempt to add the column because it exists, unlike your first display.
However, scripts that add columns to tables should, in general, not be something that is executed repeatedly. More often by adding a column to a table would be part of a process of controlled upgrade, and most of the time, the fact that a 'new' column already exists in the database before the upgrade seems to indicate a problem with the upgrade process, and probably not something to be ignored in silent mode.
John
-
PLS-00103: encountered the symbol "PROCÉDURE" when expected
Hi all
LINE/COL ERROR
-------- -----------------------------------------------------------------
13/5 PLS-00103: encountered the symbol "BEGIN" when expecting one of
What follows:
language
22/4 PLS-00103: encountered the symbol "PROCÉDURE" when expected
of the following:
not end up dominant static of final instantiable order pragma
manufacturer membership card
The symbol "static" was substituted for "PROCEDURE continue.
create or replace package xx_extract as procedure xxc_process; procedure xxc_get(in_id emp.empno%type, in_number emp.deptno%type); end ;
create or replace package xx_extract as cursor v_cursor is select empno,deptno from emp a,dept d where e.deptno=d.deptno; v_cursor_rec v_cursor%rowtype; v_in_number emp.empno%type; v_in_date emp.hiredate%type; procedure xxc_process is Begin xxc_get(v_cursor_rec.empno,v_cursor_rec.deptno); open v_cursor; loop fetch v_cursor into v_cursor_rec; exit when v_cursor%notfound; end loop; close v_cursor; end xxc_process; procedure xxc_get(in_id emp.empno%type, in_number emp.deptno%type) is begin select empno,hiredate into v_in_number,v_in_date from emp where empno=to_char(in_id) and deptno=to_char(in_number); EXCEPTION WHEN NO_DATA_FOUND THEN in_id := NULL; in_number := NULL; end xxc_get; end xx_extract;
994122 wrote:
The code below displays all values where I called the procedure before the stmt Open why? Can u please explain.
PROCEDURE xxc_process
IS
BEGIN
xxc_get (v_cursor_rec.empno, v_cursor_rec.deptno);
OPEN v_cursor;
because v_cursor_rec.empno and v_cursor_rec.deptno are empty at this time
994122 wrote:
But as suggested as Roger why we named as below? I need the output when I ran the package and I don't want to call (run) as below
Start
xx_extract.xxc_process ();
end;
the begin... end; box IS running the package, what you do with the create command are CREATION (storage) a package.
Maybe you are looking for
-
Hey guys I've already updated to Lollipop 5.0.1. Today, I received a. A6000-s_S030_151030 update. This update is approximately 1135 MBs in size. Please say it is updated android Marshmallow or anything else that I've rooted my device
-
Get errors in XP event log report
I learned how to get to Event Viewer. After a quick glance, I found below describes it issues: According the report of Event Viewer, there is an error with the following details: Source: Service Control Manager Catergory:; Type: Error; Event ID: 700
-
Windows 7 non-functional libraries.
I can't libraries in the window 7 Home Premium to do anything. If anyone can help. I ' t makes me crazy. On a level of computer competence 1-10, I'm on a 4. Thanks, Seamus
-
How to remove a user account from microsoft since the local account main administrator?
Basically started nitialy I entered my email incorrectly. Then I created a new profile with the correct e-mail and he agreed to become a microsoft account. Then I deleted the old start microsoft account via the browser, as it was useless, because I c
-
Captive Capture - LR 6.3 and Nikon D600
I use LR 6.3 on a MACBook Pro with El Capitan 10.11.3 and try captive to capture with a camera Nikon D600. The appliance firmware is up-to-date. The laptop is the capture of the camera as 'Photos' starts when I plug in the camera.Guy