PL/SQL Explicit Cursors,Error(3,15): PLS-00103
I creat procedure as following:
PROCEDURE Proj_Using_Most_People_ByGender (TheGender Employee.Sex%Type)
IS
ProjIdWorks_On.Pno%TYPE;
ProjCnt number;
CURSOR Get_People_Involved(Gender IN Employee.Sex%Type)
IS
select w.Pno, count(*) as TotalPeople
from Works_On w, Employee e
where e.Sex = Gender
and e.Ssn = w.Essn
group by w.Pno
order by TotalPeople desc;
BEGIN
open Get_People_Involved(TheGender);
for i in 1..3 loop
fetch Get_People_Involved into ProjId, ProjCnt;
exit when Get_People_Involved%NOTFOUND;
dbms_output.put_line (' Project: ' || to_char(ProjId) ||
' Personnel: ' || to_char(ProjCnt) );
end loop;
close Get_People_Involved;
EXCEPTION
when others then
dbms_output.PUT_LINE ( 'Problems' );
END;
error is:
Error(3,15): 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 The symbol "<an identifier>" was substituted for "." to continue.
Anybody can help me? Thanks a lot!
I didn't see a problem - except you should have
CREATE OR REPLACE PROCEDURE ... and not just PROCEDURE ...
SQL> create or replace PROCEDURE explitpro (TheGender Employee.Sex%Type) IS
2 ProjId Works_On.Pno%TYPE;
3 ProjCnt number;
4 CURSOR Get_People_Involved(Gender IN Employee.Sex%Type) IS
5 select w.Pno, count(*) as TotalPeople
6 from Works_On w, Employee e
7 where e.Sex = Gender
8 and e.Ssn = w.Essn
9 group by w.Pno
10 order by TotalPeople desc;
11 BEGIN
12 open Get_People_Involved(TheGender);
13 for i in 1..3 loop
14 fetch Get_People_Involved into ProjId, ProjCnt;
15 exit when Get_People_Involved%NOTFOUND;
16 dbms_output.put_line (' Project: ' || to_char(ProjId) ||
17 ' Personnel: ' || to_char(ProjCnt) );
18 end loop;
19 close Get_People_Involved;
20 EXCEPTION
21 when others then
22 dbms_output.PUT_LINE ( 'Problems' );
23 END;
24 /
Procedure created.
SQL> EXECUTE EXPLITPRO('F')
PL/SQL procedure successfully completed.
Similar Messages
-
How can I correct this error: Error(24,7): PLS-00103:
I have the following Trigger
create or replace
TRIGGER "CODE_BARRAS"
before insert or update of CODIGO_BARRAS on PAGOS FOR EACH ROW
begin
IF INSERTING THEN
IF LENGTH(:NEW.CODIGO_BARRAS) = 66 THEN
:NEW.EAN := SUBSTR(:NEW.CODIGO_BARRAS, 4,13);
:NEW.CODIGO_CUENTA := SUBSTR(:NEW.CODIGO_BARRAS, 21,22);
:NEW.NRO_DOCUMENTO := 0;
:NEW.VALOR_PAGO := SUBSTR(:NEW.CODIGO_BARRAS, 47,10);
:NEW.FECHA_PAGO := TO_CHAR(SYSDATE,'YYYYMMDD');
:NEW.NUM_LOTE := NUM_LOTE();
ELSIF LENGTH(:NEW.CODIGO_BARRAS) = 62 THEN
:NEW.EAN := SUBSTR(:NEW.CODIGO_BARRAS, 4,13);
:NEW.CODIGO_CUENTA := SUBSTR(:NEW.CODIGO_BARRAS, 21,9);
:NEW.NRO_DOCUMENTO := SUBSTR(:NEW.CODIGO_BARRAS, 30,9);
:NEW.VALOR_PAGO := SUBSTR(:NEW.CODIGO_BARRAS, 43,10);
:NEW.FECHA_PAGO := TO_CHAR(SYSDATE,'YYYYMMDD');
:NEW.NUM_LOTE := NUM_LOTE();
END IF;
END IF;
END IF;
EXCEPTION
when no_data_found then
DBMS_OUTPUT.PUT_LINE(' NO HAY INFORMACION, CODIGO ERRADO');
end;
Which generates the following error me
Error(24,7): PLS-00103: Se ha encontrado el símbolo "IF" cuando se esperaba uno de los siguientes: ; <an identifier> <a double-quoted delimited-identifier>
how do I correct the tigger?_
I am grateful for your help..._Hi Rey-user6318244!
You may delete the last END IF; to correct your trigger
create or replace
TRIGGER "CODE_BARRAS"
before insert or update of CODIGO_BARRAS on PAGOS FOR EACH ROW
begin
IF INSERTING THEN
IF LENGTH(:NEW.CODIGO_BARRAS) = 66 THEN
:NEW.EAN := SUBSTR(:NEW.CODIGO_BARRAS, 4,13);
:NEW.CODIGO_CUENTA := SUBSTR(:NEW.CODIGO_BARRAS, 21,22);
:NEW.NRO_DOCUMENTO := 0;
:NEW.VALOR_PAGO := SUBSTR(:NEW.CODIGO_BARRAS, 47,10);
:NEW.FECHA_PAGO := TO_CHAR(SYSDATE,'YYYYMMDD');
:NEW.NUM_LOTE := NUM_LOTE();
ELSIF LENGTH(:NEW.CODIGO_BARRAS) = 62 THEN
:NEW.EAN := SUBSTR(:NEW.CODIGO_BARRAS, 4,13);
:NEW.CODIGO_CUENTA := SUBSTR(:NEW.CODIGO_BARRAS, 21,9);
:NEW.NRO_DOCUMENTO := SUBSTR(:NEW.CODIGO_BARRAS, 30,9);
:NEW.VALOR_PAGO := SUBSTR(:NEW.CODIGO_BARRAS, 43,10);
:NEW.FECHA_PAGO := TO_CHAR(SYSDATE,'YYYYMMDD');
:NEW.NUM_LOTE := NUM_LOTE();
END IF;
END IF;
EXCEPTION
when no_data_found then
DBMS_OUTPUT.PUT_LINE(' NO HAY INFORMACION, CODIGO ERRADO');
end;yours sincerely
Florian W.
P.S. Please enclose your code into to get formated output. Thanks a lot!
Edited by: Florian W. on 23.02.2009 16:02 -
Error ORA-06550, PLS-00103 in procedure launched by php page
Hi,
I have written a php page that calls a pl/sql procedure. When I launch the procedure (through the php) I receive this error
Warning: ociexecute(): OCIStmtExecute: ORA-06550: line 1, column 101: PLS-00103: Encountered the symbol "" when expecting one of the following: ( - + case mod new not null others <an identifier> <a double-quoted delimited-identifier> <a bind variable> avg count current exists max min prior sql stddev sum variance execute forall merge time timestamp interval date <a string literal with character set specification> <a number> <a single-quoted SQL string> pipe <an alternatively-quoted string literal with character set specifi in /web/findb/php/fin/SPR/nuoveEmissioni/nuoveEmissioni.class.php on line 918
bool(false) The php code that calls the procedure is the following:
$query = " declare retU number; begin ";
$query .= " retU := pkg_schedapr.UPDATE_SPR_STATUS( :isinU, :utente, :emissione_f,
:azione_f, :fondo_f, :emittenteU_f, :rischioU_f, :varU_f,
:formulaU_f, :profiloU_f); ";
$query .= ":retU_val := retU; ";
$query .= "end;";
$stmtUpdate = ociparse ($this->conn,$query);
if (!$stmtUpdate) die (var_dump(OCIError()));
ociBindByName($stmtUpdate, ":isinU", $isin_t, 12);
ociBindByName($stmtUpdate, ":utente", $userName, 20);
ociBindByName($stmtUpdate, ":emissione_f", $mod_bond, 1);
ociBindByName($stmtUpdate, ":azione_f", $mod_azione, 1);
ociBindByName($stmtUpdate, ":fondo_f", $mod_fondo, 1);
ociBindByName($stmtUpdate, ":emittenteU_f", $mod_emittente, 1);
ociBindByName($stmtUpdate, ":rischioU_f", $mod_rischio, 1);
ociBindByName($stmtUpdate, ":varU_f", $mod_var, 1);
ociBindByName($stmtUpdate, ":formulaU_f", $mod_formula, 1);
ociBindByName($stmtUpdate, ":profiloU_f", $mod_profilo, 1);
ociBindByName($stmtUpdate, ":retU_val", $retU_val, 1);
$err=OCIExecute($stmtUpdate);
if (!$err) die (var_dump(OCIError()));
ocifreestatement($stmtUpdate); The pl/sql procedure is the following:
function UPDATE_SPR_STATUS(isin_p in varchar2, utente in varchar2, mercato in varchar2,
emissione_p in number, azione_p in number, fondo_p in number, emittente_p in number,
rischio_p in number, var_p in number, formula_p in number, mercato_p in number,
profilo_p in number) return number
is
control number;
modificato number;
SQL_QUERY VARCHAR2(4000);
TYPE MOD_SUM IS REF CURSOR;
SUMM MOD_SUM;
TYPE MOD_SUM_ROW
IS RECORD(
EMISSIONE VARCHAR2(1),
AZIONE VARCHAR2(1),
FONDO VARCHAR2(1),
EMITTENTE VARCHAR2(1),
RISCHIO VARCHAR2(1),
VAR VARCHAR2(1),
FORMULA VARCHAR2(1),
PROFILO VARCHAR2(1)
MODIFICHE MOD_SUM_ROW;
EMS VARCHAR2(1);
AZI VARCHAR2(1);
FON VARCHAR2(1);
EMT VARCHAR2(1);
RSK VARCHAR2(1);
VAR VARCHAR2(1);
FRM VARCHAR2(1);
PRF VARCHAR2(1);
MKT VARCHAR(1);
begin
modificato := emissione_p + azione_p + fondo_p + emittente_p + rischio_p
+ var_p + formula_p + mercato_p + profilo_p;
select count(*)
into control
from spr_web_nuove_emissioni a
where a.ISIN=isin_p
AND A.END_DATE IS NULL;
if control > 0
then
update spr_web_nuove_emissioni a
set a.END_DATE=sysdate
where a.ISIN=isin_p
AND A.END_DATE IS NULL;
SQL_QUERY := 'SELECT A.EMISSIONE, A.AZIONE, A.FONDO, A.EMITTENTE,
A.RISCHIO, A.VAR, A.FORMULA,
A.PROFILO
FROM SPR_WEB_NUOVE_EMISSIONI A
WHERE A.ISIN='''||isin_p||' AND A.END_DATE=TRUNC(SYSDATE)';
OPEN SUMM FOR SQL_QUERY;
LOOP
FETCH SUMM INTO MODIFICHE;
EXIT WHEN SUMM%NOTFOUND;
if emissione_p < 1 THEN
EMS := MODIFICHE.EMISSIONE;
ELSE
EMS := 'Y';
end if;
if azione_p < 1 THEN
AZI := MODIFICHE.AZIONE;
ELSE
AZI := 'Y';
end if;
if fondo_p < 1 THEN
FON := MODIFICHE.FONDO;
ELSE
FON := 'Y';
end if;
if emittente_p < 1 THEN
EMT := MODIFICHE.EMITTENTE;
ELSE
EMT := 'Y';
end if;
if rischio_p < 1 THEN
RSK := MODIFICHE.RISCHIO;
ELSE
RSK := 'Y';
end if;
if var_p < 1 THEN
VAR := MODIFICHE.VAR;
ELSE
VAR := 'Y';
end if;
if formula_p < 1 THEN
FRM := MODIFICHE.FORMULA;
ELSE
FRM := 'Y';
end if;
if profilo_p < 1 THEN
PRF := MODIFICHE.PROFILO;
ELSE
PRF := 'Y';
end if;
END LOOP;
CLOSE SUMM;
ELSE
if emissione_p < 1 THEN
EMS := 'N';
ELSE
EMS := 'Y';
end if;
if azione_p < 1 THEN
AZI := 'N';
ELSE
AZI := 'Y';
end if;
if fondo_p < 1 THEN
FON := 'N';
ELSE
FON := 'Y';
end if;
if emittente_p < 1 THEN
EMT := 'N';
ELSE
EMT := 'Y';
end if;
if rischio_p < 1 THEN
RSK := 'N';
ELSE
RSK := 'Y';
end if;
if var_p < 1 THEN
VAR := 'N';
ELSE
VAR := 'Y';
end if;
if formula_p < 1 THEN
FRM := 'N';
ELSE
FRM := 'Y';
end if;
if profilo_p < 1 THEN
PRF := 'N';
ELSE
PRF := 'Y';
end if;
end if;
insert into spr_web_nuove_emissioni
values (isin_p, sysdate, utente, EMS, AZI, FON, EMT,
RSK, VAR, FRM, PRF,
SYSDATE, NULL);
begin
update spr_status a
set a.VALIDATED='Y'
where a.ISIN=isin_p
AND A.MARKET=mercato;
if modificato > 0
then
update spr_status a
set a.USER_CHANGE='Y', a.USER_LAST_MODIFIED=sysdate
where a.ISIN=isin_p and a.MARKET=mercato;
end if;
exception
when others then
dbms_output.put_line('ERROR in <PKG_SCHEDAPR.UPDATE_SPR_STATUS> Aggiornamento stato ' ||SQLCODE||'-'||SQLERRM);
return 1;
end;
commit;
return 0;
end UPDATE_SPR_STATUS;I do not succed to understand the error I receive, why? Where is the error?
Can someone help me?
Thanks, bye bye.Hi,
I have changed the php code in this way:
$query = " declare retU number; begin ";
$query .= " retU := pkg_schedapr.UPDATE_SPR_STATUS(:isinU, :utente, :emissione_f, ";
$query .= ":azione_f, :fondo_f, :emittenteU_f, :rischioU_f, :varU_f, ";
$query .= ":formulaU_f, :profiloU_f); ";
$query .= ":retU_val := retU; ";
$query .= "end;";
$stmtUpdate = ociparse ($this->conn,$query);
if (!$stmtUpdate) die (var_dump(OCIError()));
ociBindByName($stmtUpdate, ":isinU", $isin_t, 12);
ociBindByName($stmtUpdate, ":utente", $userName, 20);
ociBindByName($stmtUpdate, ":emissione_f", $mod_bond, 1);
ociBindByName($stmtUpdate, ":azione_f", $mod_azione, 1);
ociBindByName($stmtUpdate, ":fondo_f", $mod_fondo, 1);
ociBindByName($stmtUpdate, ":emittenteU_f", $mod_emittente, 1);
ociBindByName($stmtUpdate, ":rischioU_f", $mod_rischio, 1);
ociBindByName($stmtUpdate, ":varU_f", $mod_var, 1);
ociBindByName($stmtUpdate, ":formulaU_f", $mod_formula, 1);
ociBindByName($stmtUpdate, ":profiloU_f", $mod_profilo, 1);
ociBindByName($stmtUpdate, ":retU_val", $retU_val, 1);
echo "$isin_t--";echo "$userName--"; echo"$mod_bond--";
echo "$mod_azione--";echo "$mod_fondo--"; echo"$mod_emittente--";
echo "$mod_rischio--";echo "$mod_var--"; echo"$mod_formula--";
echo "$mod_profilo--";echo "$retU_val";
echo "$query";
$err=OCIExecute($stmtUpdate);
if (!$err) die (var_dump(OCIError()));
ocifreestatement($stmtUpdate); and now I receive this error:
Warning: ociexecute(): OCIStmtExecute: ORA-01756: quoted string not properly terminated ORA-06512: at "FIN.PKG_SCHEDAPR", line 6420 ORA-06512: at line 1 in /web/findb/php/fin/SPR/nuoveEmissioni/nuoveEmissioni.class.php on line 918
bool(false) But I do not understand the cause of the error.
How can I solve?
Thanks, bye bye. -
Hi All,
I am currently working a "package header" and "package body".
I have created a user defined data type ( record type ) in pl/sql pacakge header.
And I am trying to use it from pl/sql body, especially
I am using this type as parameter type for a procedure.
Because of this I am getting below error at the time
of compilation.
LINE/COL ERROR
2/3 PLS-00103: Encountered the symbol "CREATE" when expecting one of
the following:
begin end function package pragma procedure subtype type use
<an identifier> <a double-quoted delimited-identifier> form
current cursor
The symbol "CREATE" was ignored.
Can any one guide me on this...
Thanks in advance.
Regards,
Srini
, from body
I was tryingI was able to get rid of the problem by creating header
and body of the package with two different names.
Example: ph and pb
But for my curiosity , just like to know,
Both "Package Header" and "Package Body" must be defined
with two different names ?
Is there any other way to get rid of this exception ?
Thanks in advance.
Cheers,
Srini -
Cursor Error in trigger - Statement Ignored/identifier must be declared PLS
I have been asked to implement a trigger and believe I have the code complete but am getting a final error on the compile. I have been running in circles for a day trying to resolve my issue. I have no PL/SQL knowlege so have been pulling from a book and google. I have three Cursors defined and the third compiles fine, the first two give the below error though I can't see a significant difference between the three. I can't help but think it is something stupid I am not seeing but I am at a loss.
If I comment out the reference to the cursor it will compile with the cursor definition but as soon as I add the Open statement the errors below appear.
Any help would be greatly appreciated as my head is getting sore.
Thanks
Mike
Error(30,13): PL/SQL: Statement ignored
Error(30,20): PLS-00201: identifier 'CURSORGETFROMDISTMAKRERS' must be declared
Error(51,13): PL/SQL: Statement ignored
Error(51,20): PLS-00201: identifier 'CURSORGETTODISTMAKRERS' must be declared
-- Table I am writing to
create table IMSV7.CTRANSWODISTMARK (
WORKORDERKEY INTEGER,
DISTMARKFROM NUMBER (9,4),
DISTMARKFROMATTRIBUTE VARCHAR (10),
DISTMARKTO NUMBER (9,4),
DISTMARKTOATTRIBUTE VARCHAR (10)
-- Excerpt from the HISTORY table I am placing the trigger against
COMPKEY NUMBER (9,0)
DISTFROMFT FLOAT
DISTTOFT FLOAT
HISTKEY NUMBER (9,0)
-- Trigger code
CREATE OR REPLACE TRIGGER MaintainCTRANSWODISTMARK
AFTER INSERT or UPDATE of DISTFROMFT, DISTTOFT ON IMSV7.HISTORY
REFERENCING NEW as NewWO
FOR EACH ROW
BEGIN
DECLARE
-- Declare cursors
CURSOR CursorGetFromDistMarkers (WOCompKey IN NUMBER, WODistFromFT IN FLOAT) IS
SELECT ATTRCODE, DISTFROMFT, MARKERFROM from RWATTRDF DF, RWATTR A
where WOCompkey = A.COMPKEY AND DF.ATTRKEY = A.ATTRKEY and DF.ATTRTYPE = 'DISTMARK'
and WODistFromFT >= DISTFROMFT and WODistFromFT <= DISTTOFT
order by A.EFFDATE DESC, DISTFROMFT DESC;
FromDistanceMarker CursorGetFromDistMarkers%ROWTYPE;
CURSOR CursorGetToDistMarkers (WOCompKey IN NUMBER, WODistToFT IN FLOAT) IS
SELECT ATTRCODE, DISTFROMFT, MARKERFROM from RWATTRDF DF, RWATTR A
where WOCompkey = A.COMPKEY AND DF.ATTRKEY = A.ATTRKEY and DF.ATTRTYPE = 'DISTMARK'
and WODistToFT >= DISTFROMFT and WODistToFT <= DISTTOFT
order by A.EFFDATE DESC, DISTFROMFT DESC;
ToDistanceMarker CursorGetToDistMarkers%ROWTYPE;
CURSOR CursorGetCTRANSWODistMark (WOHistKey IN NUMBER) IS
SELECT WORKORDERKEY from CTRANSWODISTMARK
where WORKORDERKEY = WOHistKey;
CTRANSWODistMark CursorGetCTRANSWODistMark%ROWTYPE;
varDistmarkFrom NUMBER;
varDistmarkFromAttribute VARCHAR2(10);
varDistmarkTo NUMBER;
varDistmarkToAttribute VARCHAR2(10);
BEGIN
-- Process From measurement
IF NOT CursorGetFromDistMakrers%ISOPEN
THEN
OPEN CursorGetFromDistMarkers(:NewWO.COMPKEY, :NewWO.DISTFROMFT);
END IF;
FETCH CursorGetFromDistMarkers INTO FromDistanceMarker;
IF CursorGetFromDistMarkers%NOTFOUND
THEN
-- No distance markers found, use MILES
varDistmarkFrom := :NewWO.DISTFROMFT / 5280;
varDistmarkFromAttribute := 'MILES';
ELSE
-- Found a distance marker, convert to its units and use those
-- Distance is the Marker start distance plus the offset from that start of the marker
varDistmarkFrom := FromDistanceMarker.MARKERFROM + :NewWO.DISTFROMFT - FromDistanceMarker.DISTFROMFT;
varDistmarkFromAttribute := FromDistanceMarker.ATTRCODE;
END IF;
CLOSE CursorGetFromDistMarkers;
-- Process To measurement
IF NOT CursorGetToDistMakrers%ISOPEN
THEN
OPEN CursorGetToDistMarkers(:NewWO.COMPKEY, :NewWO.DISTTOFT);
END IF;
FETCH CursorGetToDistMarkers INTO ToDistanceMarker;
IF CursorGetToDistMarkers%NOTFOUND
THEN
-- No distance markers found, use MILES
varDistmarkTo := :NewWO.DISTTOFT / 5280;
varDistmarkToAttribute := 'MILES';
ELSE
-- Found a distance marker, convert to its units and use those
-- Distance is the Marker start distance plus the offset from that start of the marker
varDistmarkTo := ToDistanceMarker.MARKERFROM + :NewWO.DISTTOFT - ToDistanceMarker.DISTFROMFT;
varDistmarkToAttribute := ToDistanceMarker.ATTRCODE;
END IF;
CLOSE CursorGetToDistMarkers;
-- Check for existing record to know if we should add or update
IF NOT CursorGetCTRANSWODistMark%ISOPEN
THEN
OPEN CursorGetCTRANSWODistMark(:NewWO.HISTKEY);
END IF;
FETCH CursorGetCTRANSWODistMark INTO CTRANSWODistMark;
IF CursorGetCTRANSWODistMark%NOTFOUND
THEN
-- Record does not exist, add one
Insert into CTRANSWODISTMARK (WORKORDERKEY, DISTMARKFROM, DISTMARKFROMATTRIBUTE, DISTMARKTO, DISTMARKTOATTRIBUTE)
values (:NewWO.HISTKEY, varDistmarkFrom, varDistmarkFromAttribute, varDistmarkTo, varDistmarkToAttribute);
ELSE
-- Existing record, update it
Update CTRANSWODISTMARK set DISTMARKFROM = varDistmarkFrom, DISTMARKFROMATTRIBUTE = varDistmarkFromAttribute,
DISTMARKTO = varDistmarkTo, DISTMARKTOATTRIBUTE = varDistmarkToAttribute
Where WORKORDERKEY = :NewWO.HISTKEY;
END IF;
END;
END;
run;
show errors trigger MaintainCTRANSWODISTMARK;the cursor is mispelled
IF NOT CursorGetFromDistMakrers%ISOPENchange it to:
IF NOT CursorGetFromDistMarkers%ISOPEN -
can you please tell me what am i missing. i am getting below error.
Error(8,12): PLS-00103: Encountered the symbol "C_SEL" when expecting one of the following: := . ( @ % ;
CREATE OR REPLACE PACKAGE BODY "XXDL_PN_LOAD_EMP_ASSIGN_PKG"
AS
FUNCTION insert_pn_emp_space_assign
RETURN NUMBER
IS
BEGIN
CURSOR c_sel IS --NO RECORDS FOUND
SELECT room_id ,
room_scheduler,
benches,
lab_type,
room_num,
floor_id ,
DEPARTMENT_NAME ,
room_eff_from_date ,
room_eff_to_date ,
org_id ,
pi_id ,
dept_pct ,
pi_pct ,
FUNCTIONAL_USE_PCT ,
RESEARCH_EXPLANATION ,
SUB_DEPT ,
FUNCTIONAL_USE_CODE ,
FUNCTIONAL_USE_DESCRIPTION ,
COUNT(1)
FROM XXDL.XXDL_CD_FACILITY k
WHERE pi_id NOT LIKE 'FMS%'
--and floor_id ='00'
--and pi_id='04309605'
AND room_eff_to_date IS NULL
-- and room_id ='07-590-02-2134'
AND room_id NOT IN
(SELECT location_code
FROM PN_SPACE_ASSIGN_EMP_V
WHERE emp_space_assign_id IS NOT NULL
AND EXISTS
( SELECT DISTINCT location_code
FROM pn_locations_all
WHERE room_id=location_code
--and nvl(to_date(room_eff_to_date,'Mon/dd/RRRR'),active_end_date)=active_end_date
GROUP BY room_id ,
DEPARTMENT_NAME ,
room_scheduler,
benches,
lab_type,
room_num,
floor_id ,
room_eff_from_date ,
room_eff_to_date ,
org_id ,
pi_id ,
dept_pct ,
pi_pct ,
FUNCTIONAL_USE_PCT ,
RESEARCH_EXPLANATION ,
SUB_DEPT ,
FUNCTIONAL_USE_CODE ,
FUNCTIONAL_USE_DESCRIPTION
HAVING COUNT(1)=1 ;
CURSOR c_conc( p_room_id VARCHAR2 ,p_dept_name VARCHAR2 ,p_piid VARCHAR2 ,p_eff_date VARCHAR2 )
IS
SELECT FUNCTIONAL_USE_PCT ATTRIBUTE5 ,
RESEARCH_EXPLANATION ATTRIBUTE6 ,
SUB_DEPT ATTRIBUTE7 ,
dept_pct ATTRIBUTE1 ,
pi_pct ATTRIBUTE2 ,
FUNCTIONAL_USE_CODE ATTRIBUTE3 ,
FUNCTIONAL_USE_DESCRIPTION ATTRIBUTE4
FROM XXDL.XXDL_CD_FACILITY
WHERE room_id =p_room_id
AND department_name =p_dept_name
AND pi_id =p_piid
AND 1 =2------not used
AND room_eff_to_date IS NULL
--and to_date(room_eff_to_date,'Mon/dd/RRRR')=to_date(p_eff_date,'Mon/dd/RRRR')
l_person_id NUMBER;
l_location_id NUMBER;
l_parent_loc_id NUMBER;
l_attribute5 VARCHAR2(500);
l_attribute6 VARCHAR2(500);
l_attribute7 VARCHAR2(500);
l_attribute1 VARCHAR2(500);
l_attribute2 VARCHAR2(500);
l_attribute3 VARCHAR2(500);
l_attribute4 VARCHAR2(500);
BEGIN
mo_global.set_policy_context('S',84);
FOR c2 IN c_sel
LOOP
l_parent_loc_id:= NULL;
BEGIN
SELECT location_id
INTO l_parent_loc_id -- NO RECORDS RETURNED FROM CURSOR
FROM pn_locations_all
WHERE location_alias = c2.floor_id
AND location_type_lookup_code ='FLOOR';
EXCEPTION
WHEN OTHERS THEN
l_parent_loc_id:= NULL;
END;
l_location_id:= NULL;
BEGIN
SELECT location_id
INTO l_location_id
FROM pn_locations_all
WHERE location_code = c2.room_id
AND parent_location_id =l_parent_loc_id;
EXCEPTION
WHEN OTHERS THEN
l_location_id:= NULL;
END;
l_attribute3:=NULL;
l_attribute4:=NULL;
l_attribute5:=NULL;
l_attribute6:=NULL;
l_attribute7:=NULL;
FOR c3 IN c_conc(c2.room_id,c2.department_name,c2.pi_id,c2.room_eff_to_date)
LOOP
IF l_attribute5 IS NULL THEN
l_attribute5 :=c3.attribute3||'.'||c3.attribute5;
ELSE
IF c3.attribute5 IS NOT NULL THEN
l_attribute5 :=l_attribute5||','||c3.attribute3||'.'||c3.attribute5;
END IF;
END IF;
IF l_attribute6 IS NULL THEN
IF c3.attribute6 IS NOT NULL THEN
l_attribute6 :=c3.attribute3||'.'||c3.attribute6;
END IF;
ELSE
IF c3.attribute6 IS NOT NULL THEN
l_attribute6 :=l_attribute6||','||c3.attribute3||'.'||c3.attribute6;
END IF;
END IF;
IF l_attribute7 IS NULL THEN
IF c3.attribute7 IS NOT NULL THEN
l_attribute7 :=c3.attribute3||'.'||c3.attribute7;
END IF;
ELSE
IF c3.attribute7 IS NOT NULL THEN
l_attribute7 :=l_attribute7||','||c3.attribute3||'.'||c3.attribute7;
END IF;
END IF;
--functional code
IF l_attribute3 IS NULL THEN
l_attribute3 :=c3.attribute3;
ELSE
IF c3.attribute3 IS NOT NULL THEN
l_attribute3 :=l_attribute3||','||c3.attribute3;
END IF;
END IF;
--functional desc
IF l_attribute4 IS NULL THEN
l_attribute4 :=c3.attribute4;
ELSE
IF c3.attribute4 IS NOT NULL THEN
l_attribute4 :=l_attribute4||','||c3.attribute4;
END IF;
END IF;
END LOOP;
l_person_id:=NULL;
BEGIN
SELECT person_id
INTO l_person_id
FROM per_all_people_f
WHERE employee_number=c2.pi_id
AND sysdate BETWEEN effective_start_date AND effective_end_date ;
EXCEPTION
WHEN OTHERS THEN
l_person_id:=NULL;
END;
insert into PN_EMP_SPACE_ASSIGN_ITF
BATCH_NAME
,ENTRY_TYPE
,EMP_SPACE_ASSIGN_ID
,LOCATION_ID
,EMPLOYEE_ID
,COST_CENTER_CODE
,ALLOCATED_AREA
,LAST_UPDATE_DATE
,LAST_UPDATE_LOGIN
,CREATED_BY
,CREATION_DATE
,LAST_UPDATED_BY
,ATTRIBUTE_CATEGORY
,ATTRIBUTE1
,ATTRIBUTE2
,ATTRIBUTE3
,ATTRIBUTE4
,ATTRIBUTE5
,ATTRIBUTE6
,ATTRIBUTE7
,ATTRIBUTE8
,ATTRIBUTE9
,ATTRIBUTE10
,ATTRIBUTE11
,ATTRIBUTE12
,ATTRIBUTE13
,ATTRIBUTE14
,ATTRIBUTE15
,TRANSFERRED_TO_CAD
,TRANSFERRED_TO_PN
,ERROR_MESSAGE
,SOURCE
,REQUEST_ID
,PROGRAM_APPLICATION_ID
,PROGRAM_ID
,PROGRAM_UPDATE_DATE
,EMP_ASSIGN_START_DATE
,EMP_ASSIGN_END_DATE
,UTILIZED_AREA
,CHANGE_DATE
,CHANGE_MODE
,PROJECT_ID
,TASK_ID
values--custom table columns
'07-590_floor_bulk_spc' --BATCH_NAME
,'A' --ENTRY_TYPE
,PN_SPACE_ASSIGN_EMP_S.nextval --EMP_SPACE_ASSIGN_ID
,l_location_id --LOCATION_ID
,l_person_id --EMPLOYEE_ID
,1028389 --COST_CENTER_CODE
,0 --ALLOCATED_AREA
,sysdate --LAST_UPDATE_DATE
,157092 --LAST_UPDATE_LOGIN
,157092 --CREATED_BY
,sysdate --CREATION_DATE
,157092 --LAST_UPDATED_BY
,null --ATTRIBUTE_CATEGORY
,c2.dept_pct --ATTRIBUTE1
,c2.pi_pct --ATTRIBUTE2
,C2.FUNCTIONAL_USE_CODE --ATTRIBUTE3
,C2.FUNCTIONAL_USE_DESCRIPTION --ATTRIBUTE4
,C2.FUNCTIONAL_USE_PCT --ATTRIBUTE5
,C2.RESEARCH_EXPLANATION --ATTRIBUTE6
,C2.SUB_DEPT --ATTRIBUTE7
,null --ATTRIBUTE8
,null --ATTRIBUTE9
,null --ATTRIBUTE10
,c2.ORG_Id||'-'||c2.DEPARTMENT_NAME --ATTRIBUTE11
,null --ATTRIBUTE12
,null --ATTRIBUTE13
,null --ATTRIBUTE14
,null --ATTRIBUTE15
,null --TRANSFERRED_TO_CAD
,null --TRANSFERRED_TO_PN
,null --ERROR_MESSAGE
,'TST' --SOURCE
,null --REQUEST_ID
,null --PROGRAM_APPLICATION_ID
,null --PROGRAM_ID
,null --PROGRAM_UPDATE_DATE
,to_date(c2.room_eff_from_date,'mon/dd/RRRR') --EMP_ASSIGN_START_DATE
,to_date(c2.room_eff_to_date,'mon/dd/RRRR') --EMP_ASSIGN_END_DATE
,null --UTILIZED_AREA
,null --CHANGE_DATE
,null --CHANGE_MODE
,null --PROJECT_ID
,null --TASK_ID --07-590-02-ELEV02
END LOOP;
RETURN 1;
EXCEPTION
WHEN OTHERS THEN
FND_FILE.PUT_LINE(FND_FILE.LOG,'Error while insert_pn_emp_space_assign - '||sqlerrm);
RETURN 0;
END;
WHEN OTHERS THEN
FND_FILE.PUT_LINE(FND_FILE.LOG,'Error while insert_pn_emp_space_assign - '||sqlerrm);
RETURN 0;
END insert_pn_emp_space_assign;
END XXDL_PN_LOAD_EMP_ASSIGN_PKG;893185 wrote:
can you please tell me what am i missing. i am getting below error.
Error(8,12): PLS-00103: Encountered the symbol "C_SEL" when expecting one of the following: := . ( @ % ;
CREATE OR REPLACE PACKAGE BODY "XXDL_PN_LOAD_EMP_ASSIGN_PKG"
AS
FUNCTION insert_pn_emp_space_assign
RETURN NUMBER
IS
BEGINremove "BEGIN" from line above -
PLS-00103 Error While Creating Procedure
I am attempting to create the following procedure following the guidelines in Metalink Doc ID #118040.1 and I keep receiving the following error at Line #22:
Error(22,65): PLS-00103: Encountered the symbol ":" when expecting one of the following: := . ( % ; The symbol ":= was inserted before ":" to continue.
Here is my procedure code:
PROCEDURE sw_load_image( position IN NUMBER, filename VARCHAR2) AS
f_lob BFILE;
b_lob BLOB;
image_name VARCHAR2(30);
mime_type VARCHAR2(30);
dot_pos NUMBER;
BEGIN
-- Find the position of the dot ('.') located in the filename
dot_pos := INSTR(filename, '.');
-- Get the filename without extension and use it as image name
image_name := SUBSTR(filename,1,dot_pos-1);
-- Build the mime type. Retrieve the file extension and add it to 'image/'
mime_type := 'image/'||SUBSTR( filename, dot_pos+1, length(filename) );
INSERT INTO sw_images values(position, image_name, mime_type, empty_blob() ) RETURN img_data INTO b_lob;
f_lob := BFILENAME('IMG2LOAD', filename);
dbms_lob.fileopen(f_lob, dbms_lob.file_readonly);
dbms_lob.loadfromfile(b_lob, f_lob, dbms_lob.getlength(f_lob) ):
dbms_lob.fileclose(f_lob);
COMMIT;
END;
Line #22 is the line that starts 'dbms_lob.loadfromfile'. I am not seeing where I have made a mistake. Does anyone else see where I've made a mistake?
This procedure is being created on a 9i database running on W2K server and W2K client.
Thanks,
JasonThanks! As many times as I looked at that I can't believe I didn't see that. Thanks again.
-
PLS-00103: Encountered the symbol "SELECT" when expecting one of the follow
Can any one tell me why I an getting compile error in Trigger with the following code (see below for the error message). Error is indicated in the IF statement Select clause.
Code:
-- AUdit Code Begin
-- Note: Ony for those tables having 'AUDIT' UDP
-- Value set to 'T'
IF (Select Count(*) From DBConfiguration
Where ConfigurationCode = 'AUDIT' AND
ConfigurationValue = 'T') > 0 THEN
WHEN (:new.WORKREQUESTSTATUS <> :old.WORKREQUESTSTATUS)
Begin
Insert INTO ADAMChangeAudit (ADAMChangeAuditKey,AuditTable,AuditRecordKey,AuditColumnName,AuditOldValue,AuditNewValue,AuditUser)
VALUES(ADAMChangeAuditKey.NextValue,'WORKREQUEST',:new.WORKREQUESTKEY,'WORKREQUESTSTATUS',
:old.WORKREQUESTSTATUS,:new.WORKREQUESTSTATUS,:new.UserId)
End;
WHEN (:new.WORKREQUESTSOURCE <> :old.WORKREQUESTSOURCE)
Begin
Insert INTO ADAMChangeAudit (ADAMChangeAuditKey,AuditTable,AuditRecordKey,AuditColumnName,AuditOldValue,AuditNewValue,AuditUser)
VALUES(ADAMChangeAuditKey.NextValue,'WORKREQUEST',:new.WORKREQUESTKEY,'WORKREQUESTSOURCE',
:old.WORKREQUESTSOURCE,:new.WORKREQUESTSOURCE,:new.UserId)
End;
WHEN (:new.WORKREQUESTSOURCEID <> :old.WORKREQUESTSOURCEID)
Begin
Insert INTO ADAMChangeAudit (ADAMChangeAuditKey,AuditTable,AuditRecordKey,AuditColumnName,AuditOldValue,AuditNewValue,AuditUser)
VALUES(ADAMChangeAuditKey.NextValue,'WORKREQUEST',:new.WORKREQUESTKEY,'WORKREQUESTSOURCEID',
:old.WORKREQUESTSOURCEID,:new.WORKREQUESTSOURCEID,:new.UserId)
End;
WHEN (:new.WORKREQUESTDESC <> :old.WORKREQUESTDESC)
Begin
Insert INTO ADAMChangeAudit (ADAMChangeAuditKey,AuditTable,AuditRecordKey,AuditColumnName,AuditOldValue,AuditNewValue,AuditUser)
VALUES(ADAMChangeAuditKey.NextValue,'WORKREQUEST',:new.WORKREQUESTKEY,'WORKREQUESTDESC',
:old.WORKREQUESTDESC,:new.WORKREQUESTDESC,:new.UserId)
End;
WHEN (:new.WORKREQUESTDATE <> :old.WORKREQUESTDATE)
Begin
Insert INTO ADAMChangeAudit (ADAMChangeAuditKey,AuditTable,AuditRecordKey,AuditColumnName,AuditOldValue,AuditNewValue,AuditUser)
VALUES(ADAMChangeAuditKey.NextValue,'WORKREQUEST',:new.WORKREQUESTKEY,'WORKREQUESTDATE',
CAST(:old.WORKREQUESTDATE AS varchar2(256)),CAST(:new.WORKREQUESTDATE AS varchar2(256)),:new.UserId)
End;
WHEN (:new.WORKREQUESTOWNER <> :old.WORKREQUESTOWNER)
Begin
Insert INTO ADAMChangeAudit (ADAMChangeAuditKey,AuditTable,AuditRecordKey,AuditColumnName,AuditOldValue,AuditNewValue,AuditUser)
VALUES(ADAMChangeAuditKey.NextValue,'WORKREQUEST',:new.WORKREQUESTKEY,'WORKREQUESTOWNER',
:old.WORKREQUESTOWNER,:new.WORKREQUESTOWNER,:new.UserId)
End;
WHEN (:new.WORKREQUESTAPPCODE <> :old.WORKREQUESTAPPCODE)
Begin
Insert INTO ADAMChangeAudit (ADAMChangeAuditKey,AuditTable,AuditRecordKey,AuditColumnName,AuditOldValue,AuditNewValue,AuditUser)
VALUES(ADAMChangeAuditKey.NextValue,'WORKREQUEST',:new.WORKREQUESTKEY,'WORKREQUESTAPPCODE',
:old.WORKREQUESTAPPCODE,:new.WORKREQUESTAPPCODE,:new.UserId)
End;
WHEN (:new.WORKREQUESTAPPROVER <> :old.WORKREQUESTAPPROVER)
Begin
Insert INTO ADAMChangeAudit (ADAMChangeAuditKey,AuditTable,AuditRecordKey,AuditColumnName,AuditOldValue,AuditNewValue,AuditUser)
VALUES(ADAMChangeAuditKey.NextValue,'WORKREQUEST',:new.WORKREQUESTKEY,'WORKREQUESTAPPROVER',
:old.WORKREQUESTAPPROVER,:new.WORKREQUESTAPPROVER,:new.UserId)
End;
WHEN (:new.WORKREQUESTAPPDATE <> :old.WORKREQUESTAPPDATE)
Begin
Insert INTO ADAMChangeAudit (ADAMChangeAuditKey,AuditTable,AuditRecordKey,AuditColumnName,AuditOldValue,AuditNewValue,AuditUser)
VALUES(ADAMChangeAuditKey.NextValue,'WORKREQUEST',:new.WORKREQUESTKEY,'WORKREQUESTAPPDATE',
CAST(:old.WORKREQUESTAPPDATE AS varchar2(256)),CAST(:new.WORKREQUESTAPPDATE AS varchar2(256)),:new.UserId)
End;
WHEN (:new.WORKREQUESTCOMMENT <> :old.WORKREQUESTCOMMENT)
Begin
Insert INTO ADAMChangeAudit (ADAMChangeAuditKey,AuditTable,AuditRecordKey,AuditColumnName,AuditOldValue,AuditNewValue,AuditUser)
VALUES(ADAMChangeAuditKey.NextValue,'WORKREQUEST',:new.WORKREQUESTKEY,'WORKREQUESTCOMMENT',
:old.WORKREQUESTCOMMENT,:new.WORKREQUESTCOMMENT,:new.UserId)
End;
WHEN (:new.CLOSEDATE <> :old.CLOSEDATE)
Begin
Insert INTO ADAMChangeAudit (ADAMChangeAuditKey,AuditTable,AuditRecordKey,AuditColumnName,AuditOldValue,AuditNewValue,AuditUser)
VALUES(ADAMChangeAuditKey.NextValue,'WORKREQUEST',:new.WORKREQUESTKEY,'CLOSEDATE',
CAST(:old.CLOSEDATE AS varchar2(256)),CAST(:new.CLOSEDATE AS varchar2(256)),:new.UserId)
End;
WHEN (:new.ANALYTEKEY <> :old.ANALYTEKEY)
Begin
Insert INTO ADAMChangeAudit (ADAMChangeAuditKey,AuditTable,AuditRecordKey,AuditColumnName,AuditOldValue,AuditNewValue,AuditUser)
VALUES(ADAMChangeAuditKey.NextValue,'WORKREQUEST',:new.WORKREQUESTKEY,'ANALYTEKEY',
CAST(:old.ANALYTEKEY AS varchar2(256)),CAST(:new.ANALYTEKEY AS varchar2(256)),:new.UserId)
End;
WHEN (:new.SUBPURPOSEKEY <> :old.SUBPURPOSEKEY)
Begin
Insert INTO ADAMChangeAudit (ADAMChangeAuditKey,AuditTable,AuditRecordKey,AuditColumnName,AuditOldValue,AuditNewValue,AuditUser)
VALUES(ADAMChangeAuditKey.NextValue,'WORKREQUEST',:new.WORKREQUESTKEY,'SUBPURPOSEKEY',
CAST(:old.SUBPURPOSEKEY AS varchar2(256)),CAST(:new.SUBPURPOSEKEY AS varchar2(256)),:new.UserId)
End;
WHEN (:new.PURPOSEKEY <> :old.PURPOSEKEY)
Begin
Insert INTO ADAMChangeAudit (ADAMChangeAuditKey,AuditTable,AuditRecordKey,AuditColumnName,AuditOldValue,AuditNewValue,AuditUser)
VALUES(ADAMChangeAuditKey.NextValue,'WORKREQUEST',:new.WORKREQUESTKEY,'PURPOSEKEY',
CAST(:old.PURPOSEKEY AS varchar2(256)),CAST(:new.PURPOSEKEY AS varchar2(256)),:new.UserId)
End;
End if;
-- Audit End
Error:
95/5 PLS-00103: Encountered the symbol "SELECT" when expecting one of the following:
( - + case mod new not null others <an identifier>
<a double-quoted delimited-identifier> <a bind variable> avg
count current exists max min prior sql stddev sum variance
execute forall merge time timestamp interval date
<a string literal with character set specification>
<a number> <a single-quoted SQL string> pipe
<an alternatively-quoted string literal with character set specification>
<an alternativ
97/39 PLS-00103: Encountered the symbol ")" when expecting one of the following:
* & - + ; / at for mod remainder rem <an exponent (**)> and
or group having intersect minus order start union where
connect || multisetHere is the code:
-- AUdit Code Begin
-- Note: Ony for those tables having 'AUDIT' UDP
-- Value set to 'T'
IF (Select Count(DBConfigurationValue) From DBConfiguration
Where DBConfigurationCode = 'AUDIT' AND
DBConfigurationValue = 'T') > 0 THEN
WHEN (:new.WORKREQUESTSTATUS <> :old.WORKREQUESTSTATUS)
Begin
Insert INTO ADAMChangeAudit (ADAMChangeAuditKey,AuditTable,AuditRecordKey,AuditColumnName,AuditOldValue,AuditNewValue,AuditUser)
VALUES(ADAMChangeAuditKey.NextValue,'WORKREQUEST',:new.WORKREQUESTKEY,'WORKREQUESTSTATUS',
:old.WORKREQUESTSTATUS,:new.WORKREQUESTSTATUS,:new.UserId)
End;
WHEN (:new.WORKREQUESTSOURCE <> :old.WORKREQUESTSOURCE)
Begin
Insert INTO ADAMChangeAudit (ADAMChangeAuditKey,AuditTable,AuditRecordKey,AuditColumnName,AuditOldValue,AuditNewValue,AuditUser)
VALUES(ADAMChangeAuditKey.NextValue,'WORKREQUEST',:new.WORKREQUESTKEY,'WORKREQUESTSOURCE',
:old.WORKREQUESTSOURCE,:new.WORKREQUESTSOURCE,:new.UserId)
End;
WHEN (:new.WORKREQUESTSOURCEID <> :old.WORKREQUESTSOURCEID)
Begin
Insert INTO ADAMChangeAudit (ADAMChangeAuditKey,AuditTable,AuditRecordKey,AuditColumnName,AuditOldValue,AuditNewValue,AuditUser)
VALUES(ADAMChangeAuditKey.NextValue,'WORKREQUEST',:new.WORKREQUESTKEY,'WORKREQUESTSOURCEID',
:old.WORKREQUESTSOURCEID,:new.WORKREQUESTSOURCEID,:new.UserId)
End;
WHEN (:new.WORKREQUESTDESC <> :old.WORKREQUESTDESC)
Begin
Insert INTO ADAMChangeAudit (ADAMChangeAuditKey,AuditTable,AuditRecordKey,AuditColumnName,AuditOldValue,AuditNewValue,AuditUser)
VALUES(ADAMChangeAuditKey.NextValue,'WORKREQUEST',:new.WORKREQUESTKEY,'WORKREQUESTDESC',
:old.WORKREQUESTDESC,:new.WORKREQUESTDESC,:new.UserId)
End;
WHEN (:new.WORKREQUESTDATE <> :old.WORKREQUESTDATE)
Begin
Insert INTO ADAMChangeAudit (ADAMChangeAuditKey,AuditTable,AuditRecordKey,AuditColumnName,AuditOldValue,AuditNewValue,AuditUser)
VALUES(ADAMChangeAuditKey.NextValue,'WORKREQUEST',:new.WORKREQUESTKEY,'WORKREQUESTDATE',
CAST(:old.WORKREQUESTDATE AS varchar2(256)),CAST(:new.WORKREQUESTDATE AS varchar2(256)),:new.UserId)
End;
WHEN (:new.WORKREQUESTOWNER <> :old.WORKREQUESTOWNER)
Begin
Insert INTO ADAMChangeAudit (ADAMChangeAuditKey,AuditTable,AuditRecordKey,AuditColumnName,AuditOldValue,AuditNewValue,AuditUser)
VALUES(ADAMChangeAuditKey.NextValue,'WORKREQUEST',:new.WORKREQUESTKEY,'WORKREQUESTOWNER',
:old.WORKREQUESTOWNER,:new.WORKREQUESTOWNER,:new.UserId)
End;
WHEN (:new.WORKREQUESTAPPCODE <> :old.WORKREQUESTAPPCODE)
Begin
Insert INTO ADAMChangeAudit (ADAMChangeAuditKey,AuditTable,AuditRecordKey,AuditColumnName,AuditOldValue,AuditNewValue,AuditUser)
VALUES(ADAMChangeAuditKey.NextValue,'WORKREQUEST',:new.WORKREQUESTKEY,'WORKREQUESTAPPCODE',
:old.WORKREQUESTAPPCODE,:new.WORKREQUESTAPPCODE,:new.UserId)
End;
WHEN (:new.WORKREQUESTAPPROVER <> :old.WORKREQUESTAPPROVER)
Begin
Insert INTO ADAMChangeAudit (ADAMChangeAuditKey,AuditTable,AuditRecordKey,AuditColumnName,AuditOldValue,AuditNewValue,AuditUser)
VALUES(ADAMChangeAuditKey.NextValue,'WORKREQUEST',:new.WORKREQUESTKEY,'WORKREQUESTAPPROVER',
:old.WORKREQUESTAPPROVER,:new.WORKREQUESTAPPROVER,:new.UserId)
End;
WHEN (:new.WORKREQUESTAPPDATE <> :old.WORKREQUESTAPPDATE)
Begin
Insert INTO ADAMChangeAudit (ADAMChangeAuditKey,AuditTable,AuditRecordKey,AuditColumnName,AuditOldValue,AuditNewValue,AuditUser)
VALUES(ADAMChangeAuditKey.NextValue,'WORKREQUEST',:new.WORKREQUESTKEY,'WORKREQUESTAPPDATE',
CAST(:old.WORKREQUESTAPPDATE AS varchar2(256)),CAST(:new.WORKREQUESTAPPDATE AS varchar2(256)),:new.UserId)
End;
WHEN (:new.WORKREQUESTCOMMENT <> :old.WORKREQUESTCOMMENT)
Begin
Insert INTO ADAMChangeAudit (ADAMChangeAuditKey,AuditTable,AuditRecordKey,AuditColumnName,AuditOldValue,AuditNewValue,AuditUser)
VALUES(ADAMChangeAuditKey.NextValue,'WORKREQUEST',:new.WORKREQUESTKEY,'WORKREQUESTCOMMENT',
:old.WORKREQUESTCOMMENT,:new.WORKREQUESTCOMMENT,:new.UserId)
End;
WHEN (:new.CLOSEDATE <> :old.CLOSEDATE)
Begin
Insert INTO ADAMChangeAudit (ADAMChangeAuditKey,AuditTable,AuditRecordKey,AuditColumnName,AuditOldValue,AuditNewValue,AuditUser)
VALUES(ADAMChangeAuditKey.NextValue,'WORKREQUEST',:new.WORKREQUESTKEY,'CLOSEDATE',
CAST(:old.CLOSEDATE AS varchar2(256)),CAST(:new.CLOSEDATE AS varchar2(256)),:new.UserId)
End;
WHEN (:new.ANALYTEKEY <> :old.ANALYTEKEY)
Begin
Insert INTO ADAMChangeAudit (ADAMChangeAuditKey,AuditTable,AuditRecordKey,AuditColumnName,AuditOldValue,AuditNewValue,AuditUser)
VALUES(ADAMChangeAuditKey.NextValue,'WORKREQUEST',:new.WORKREQUESTKEY,'ANALYTEKEY',
CAST(:old.ANALYTEKEY AS varchar2(256)),CAST(:new.ANALYTEKEY AS varchar2(256)),:new.UserId)
End;
WHEN (:new.SUBPURPOSEKEY <> :old.SUBPURPOSEKEY)
Begin
Insert INTO ADAMChangeAudit (ADAMChangeAuditKey,AuditTable,AuditRecordKey,AuditColumnName,AuditOldValue,AuditNewValue,AuditUser)
VALUES(ADAMChangeAuditKey.NextValue,'WORKREQUEST',:new.WORKREQUESTKEY,'SUBPURPOSEKEY',
CAST(:old.SUBPURPOSEKEY AS varchar2(256)),CAST(:new.SUBPURPOSEKEY AS varchar2(256)),:new.UserId)
End;
WHEN (:new.PURPOSEKEY <> :old.PURPOSEKEY)
Begin
Insert INTO ADAMChangeAudit (ADAMChangeAuditKey,AuditTable,AuditRecordKey,AuditColumnName,AuditOldValue,AuditNewValue,AuditUser)
VALUES(ADAMChangeAuditKey.NextValue,'WORKREQUEST',:new.WORKREQUESTKEY,'PURPOSEKEY',
CAST(:old.PURPOSEKEY AS varchar2(256)),CAST(:new.PURPOSEKEY AS varchar2(256)),:new.UserId)
End;
End if; -
PLS-00103 in Trigger compilation !
We had our Database in Oracle 8i 8.1.5 & we took an Export from
that database, our client has Purchased Oracle 8.1.7 standard
edition, we imported the exp.dmp in to the new database.
The specific problem is some of the Database Triggers are not
working the problem is with a specific select statement which
worked fine in 8.1.5,
The Error number is PLS-00103 or a Parser error wrt to string.
Error text says-- encountered ) when expecting one of the
following
from
Whats this problem? why a statement which worked in 8.1.5 did
not work in 8.1.7? Whats the Remedy?
Thanks in advance for giving solutions
MaheshHi mahesh,
Please recomplire ur trigger code. This is a general problem
while porting from any lower release of Oracle to 8.1.7 You will
encounter this even if U have build in procedural objects and U
are trying to port it . Collect the text from user_source table
giving the trigger name and recompile it.
anurag -
Error PLS-00103 in cursor in operation insert in a particioned table
Hi experts,
I 've just insert in a particioned table values with next cursor and give an error:
ERROR:
SQL> @/home/u0182638/mfp_sql/2_cursores.sql
insert into sales values
(reg.SAT_ID,reg.SAC_ID,reg.SCR_ID,reg.UCR_ID,reg.SAT_PARENTMOVID,reg.SAT_USE
RCATEGORYID,reg.SAT_DTPOSTED,reg.SAT_DTAVAIL,reg.SAT_NAME,reg.SAT_TRNAMT,reg
.SAT_CURRENCY,reg.SAT_ORIGIN,reg.SAT_COMMENT,reg.SAT_DTIMPORT,reg.IMF_ID,reg
.CLOB_ID,reg.SUBCLOB_ID,reg.HIDDEN );
ERROR at line 8:
ORA-06550: line 8, column 5:
PLS-00103: Encountered the symbol "INSERT" when expecting one of the
following:
. ( * @ % & - + / at loop mod remainder range rem ..
<an exponent (**)> || multiset
The symbol "loop" was substituted for "INSERT" to continue.
ORA-06550: line 15, column 9:
PLS-00103: Encountered the symbol "IF" when expecting one of the following:
; <an identifier> <a double-quoted delimited-identifier>
end if;
ERROR at line 15:
ORA-06550: line 15, column 9:
PLS-00103: Encountered the symbol "IF" when expecting one of the following:
; <an identifier> <a double-quoted delimited-identifier>
**CURSOR:**
set serveroutput on;
declare
limite number:= 200000;
contador number:= 0;
cursor c_SAVING_ACCOUNT_TRANS_P is
select
SAT_ID,SAC_ID,SCR_ID,UCR_ID,SAT_PARENTMOVID,SAT_USERCATEGORYID,SAT_DTPOSTED,
SAT_DTAVAIL,SAT_NAME,SAT_TRNAMT,SAT_CURRENCY,SAT_ORIGIN,SAT_COMMENT,SAT_DTIM
PORT,IMF_ID,CLOB_ID,SUBCLOB_ID,HIDDEN from
IBD_MFP.SAVING_ACCOUNT_TRANSACTIONS_P;
begin
for reg in c_SAVING_ACCOUNT_TRANS_P
insert into sales values
(reg.SAT_ID,reg.SAC_ID,reg.SCR_ID,reg.UCR_ID,reg.SAT_PARENTMOVID,reg.SAT_USE
RCATEGORYID,reg.SAT_DTPOSTED,reg.SAT_DTAVAIL,reg.SAT_NAME,reg.SAT_TRNAMT,reg
.SAT_CURRENCY,reg.SAT_ORIGIN,reg.SAT_COMMENT,reg.SAT_DTIMPORT,reg.IMF_ID,reg
.CLOB_ID,reg.SUBCLOB_ID,reg.HIDDEN );
contador:= contador +1;
if contador > limite then
begin
commit;
contador:= 0;
dbms_output.put_line('otros '|| limite ||' registros...');
end if;
end loop;
end;
TABLE:
CREATE TABLE IBD_MFP.SAVING_ACCOUNT_TRANSACTIONS_PART
SAT_ID NUMBER NOT NULL,
SAC_ID NUMBER NOT NULL,
SCR_ID NUMBER,
UCR_ID NUMBER,
SAT_PARENTMOVID NUMBER,
SAT_USERCATEGORYID NUMBER,
SAT_DTPOSTED DATE NOT NULL,
SAT_DTAVAIL DATE NOT NULL,
SAT_NAME VARCHAR2(512 BYTE) NOT NULL,
SAT_TRNAMT VARCHAR2(32 BYTE) NOT NULL,
SAT_CURRENCY VARCHAR2(3 BYTE) NOT NULL,
SAT_ORIGIN NUMBER(1) DEFAULT 0 NOT NULL,
SAT_COMMENT VARCHAR2(1000 BYTE),
SAT_DTIMPORT DATE,
IMF_ID NUMBER,
CLOB_ID NUMBER,
SUBCLOB_ID NUMBER,
HIDDEN NUMBER(1) DEFAULT 0
PCTUSED 0
PCTFREE 30
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 256MB
NEXT 256MB
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
BUFFER_POOL DEFAULT
PARTITION BY RANGE (SAT_DTPOSTED)
( PARTITION SAT_DTPOSTED_ENE00 VALUES LESS THAN (TO_DATE('01/02/2000', 'DD/MM/YYYY')) TABLESPACE TABLESPACE_NUEVO,
PARTITION SAT_DTPOSTED_FEB00 VALUES LESS THAN (TO_DATE('01/03/2000', 'DD/MM/YYYY')) TABLESPACE TABLESPACE_NUEVO,
NOLOGGING
NOCOMPRESS
NOCACHE
NOPARALLEL
MONITORING;you are missing an END;
in this part
if contador > limite then
begin
commit;
contador:= 0;
dbms_output.put_line('otros '|| limite ||' registros...');
end if; -
What is the real time use of implicit and explicit cursors in pl/sql
what is the real time use of implicit and explicit cursors in pl/sql.............please tell me
You can check the following link ->
http://www.smart-soft.co.uk/Oracle/oracle-plsql-tutorial-part5.htm
But, i've a question ->
Are you student?
Regards.
Satyaki De. -
SQL*Loader-925: Error while parsing a cursor (via ocisq)
Receiving the following error message when trying to use SQLLoader (on NT) >>>
SQL*Loader-925: Error while parsing a cursor
(via ocisq)
ORA-00942: table or view does not exist
Trying to use the application for the first time, logon using userid for which sqlplus operates, and the table does exist under the user schema, as owner.
ctl and dat file are correct. Log file gives me no further detail of the errors.
Are there any configuration settings or something required for this app?
ThanksThanks Warren. I was concentrating more on the first line of the error.
You are right. The issue was of insufficient privileges. The table did not have all the necessary grants provided. -
Hard coded SQL string doesn't run with error PLS-00103
I have created a package with 34 stored procedures [pre]to create some materialized view with hard coded SQL [pre]string (client required for this hard coding). The [pre]first part with 21 simple create statements has
[pre]worked fine. 2nd part with 11 complicated create [pre]statements, only first one has worked. all others [pre]have not worked.
[pre]
I used dbms_output.put_line (sql_string) to check the [pre]individual create statement, it has looked fine. I [pre]have run individual SP within package. I have got [pre]error message as ORA-06550: line 1, column 45:
[pre]PLS-00103: Encountered the symbol "end-of-file" when [pre]expecting one of the following: ; [pre]
<an identifier> <a double-quoted delimited-identifier> [pre]The symbol ";" was substituted for "end-of-file" to [pre]continue.
[pre]I have checked SQL string between 1st part and 2nd [pre]part. They are the same and all with ';' to end SQL [pre]string and END SP name in the end. Please help me to [pre]identify where the problems are. Thanks. Followings [pre]are some sample SQL string:
[pre]PROCEDURE sp_1st_string
[pre]IS
[pre]BEGIN
[pre] EXECUTE IMMEDIATE 'CREATE MATERIALIZED VIEW
[pre]mv_name1 TABLESPACE space_name PARALLEL ( DEGREE [pre]DEFAULT INSTANCES DEFAULT ) BUILD IMMEDIATE REFRESH [pre]COMPLETE ON DEMAND WITH PRIMARY KEY AS SELECT col1, [pre]col2,col3, col4, col5 FROM tableone A, table_two B [pre]WHERE A.id = B.id';
[pre]COMMIT;
[pre]END sp_1st_string;
[pre]PROCEDURE sp_2nd_string
[pre]IS
[pre]BEGIN
[pre] EXECUTE IMMEDIATE ' CREATE MATERIALIZED VIEW
[pre]mv_name2 TABLESPACE PDE_DATA PARALLEL ( DEGREE [pre]DEFAULT INSTANCES DEFAULT ) BUILD IMMEDIATE REFRESH [pre]COMPLETE ON DEMAND WITH PRIMARY KEY AS select col1 .. [pre]col10 from tableone a, tabletwo b, tablethree c, [pre]tablefour d, tablefive e, tablesix f where clause;
[pre]COMMIT;
[pre]END sp_2nd_string;
Message was edited by:
citicbj
Message was edited by:
citicbjstevencallan:
Thanks for your advice. I have been thinking the above problem may be [pre]caused by this. If I run 'Create MV statement' in SQL PLUS or Toad, single quote [pre]will work. But when I put hard coded SQL string in package and stored [pre]procedure, it will cause compiling error. After I took off single quote, SP will be [pre][pre]compiled successfully. When I run package.sp, it will cause the problem. [pre]Here is the sample code:[pre]
[pre]CREATE MATERIALIZED VIEW my_mv TABLESPACE space_name [pre][pre]PARALLEL (DEGREE DEFAULT INSTANCES DEFAULT) BUILD IMMEDIATE [pre]REFRESH COMPLETE ON DEMAND WITH PRIMARY KEY AS select A.ID , [pre]A.CNTL_NUM, C.XX_CODE, D.FIRST_NAME, D.MDL_NAME, [pre]D.LAST_NAME, H.XX_DESC, TO_DATE(TO_CHAR(C.CREAT_TS, [pre]'MM/DD/YYYY'),'MM/DD/YY'), F.STATE, CASE WHEN A.XX_CODE IS NOT NULL [pre]THEN X END, E.X_DESC from TABLE1 A, TABLE2 B, TABLE3 C, TABLE4 [pre]D, TABLE5 E, TABLE6 F, TABLE7 G, TABLE8 H
[pre]where D.X_SW = 'X' and B.X_SW = X' and G.X_SW = 'X' and B.CNTL_ID = [pre]A.CNTL_ID and B.CNTL_ID = D.CNTL_ID and B.X_ID = C.X_ID and B.X_ID = [pre]G.X_ID and B.X_ID = F.X_ID and G.X_CD = H.X_CD and B.X_CD = E.X_CD [pre]and E.X_CD = '25' and C.ENRLMT_ID NOT LIKE 'O%'; [pre]
[pre]When I hard coded this statement in package and sp, I have to take off single [pre]quote ' ' form 'MM/DD/YYYY', 'MM/DD/YY', X_SW ='X', X_CD = '25' AND NOT [pre]LIKE 'O%', Then I can compile whole package successfully. This is why I [pre]mentioned that 1st part 21 simple create statement work because they don't have [pre]these single quote in the statement. In 2nd part with 13 complicated create [pre]statements, some of them have no single quote in the statement. They will [pre]run. Some of them with single quote in statement. They will have the problem [pre]to run if I take off single for compiling. [pre]
[pre]Please give me some idea what is the reason. Thanks a lot. -
Unexpected "ORA-01001: invalid cursor" error
I have a Pro*C application that basically fetches from a cursor, does a bunch of work with that row, does a "delete from <table> where current of <cursor name>", then loops back, fetches, the next row, etc., and finally closes the cursor once all the rows have been processed.
One of our clients is getting an 'ORA-01001' error on the "DELETE FROM <table> WHERE CURRENT OF <cursor>" statement. This is long-standing, frequently executed code at 100+ clients and I've never had a problem with this statement before. The client is consistently getting this error on a particular row from this cursor, but other rows processed with the same cursor are processing successfully.
Unfortunately, I do not have direct access to the client's database, so I cannot debug directly, but I've placed print statements around the only place in my application's code that explicitly closes the cursor. A log generated on a run that threw the 1001 error confirmed that the cursor is NOT being explicitly closed by my application by an "EXEC SQL CLOSE <cursor>" statement.
Likewise, I put print statements around all the COMMITs and ROLLBACKs in my application, and none of these showed in the logs either.
My application does make a call to a client-customized PL/SQL function that they recently changed. However, I have a copy of the clients function and there are not any explicit COMMIT, ROLLBACK, ANALYZE, ALTER, DROP, REPLACE, TRUNCATE or CREATE statements that would implicitly commit and close the cursor.
Here are potential problems that I have ruled out:
-Oracle OPEN_CURSORS parameter - It appears that if this were the problem, the error would be an ORA-1000, not 1001. Please correct me if I am wrong here.
-Pro*C MAXOPENCURSORS parameter - I compiled a version with a MAXOPENCURSORS value that is higher than the client's OPEN_CURSORS setting. If this were the problem, the error should have switched to the ORA-1000 error when I increased the parameter. It remained as an ORA-1001.
Next steps:
-What could cause a cursor to close other than explicit COMMIT, ROLLBACK, ANALYZE, ALTER, DROP, REPLACE, TRUNCATE or CREATE statements?
-Is there anything I can run, such as a database trace, that will show me exactly when the cursor is being closed? I admittedly don't know a lot about DB traces.
-Anything else I should check? Any other information I should provide?
Thanks ahead of time for any help!Chandrakaanth Ramamurthy wrote:
Does the client customized PL/SQL block contain EXIT
Exit will end up issuing a commit and hence this could be an issue.Exit is not used in the customized function.
Chandrakaanth Ramamurthy wrote:
Also please check that commit and roll back are placed at the end of the loop.The only commit/rollback is after the loop is over is finished.
I actually just figured out the issue. Turns out the cursor just hadn't been opened due to a very unique data condition... facepalm You know what happens when you assume things, right? :)
Thanks for the help anyway! -
Oracle 11g ProC/C++ PCC-S-02346, PL/SQL found semantic errors
Hi
We use ProC/C++ since Oracle V7 and have precompile without problem with proc 7, 8, 9 10.
I have downloaded instant client 11g (base + sdk + precomp) and have errors PCC-S-02346 !
332 EXEC SQL EXECUTE
Error at line 333, column 4 in file cdsgbtol.cpp
333 BEGIN
333 ...1
333 PCC-S-02346, PL/SQL found semantic errors
Error at line 334, column 5 in file cdsgbtol.cpp
334 DSS_CINDOC_PKG.DSS_UTIL_SYSTAB(:P1,:Optype,:P2,:oRowCont,:res) ;
334 ....1
334 PLS-S-00000, Statement ignored
335 END ;
336 END-EXEC ;
Errors occurs with source that needs proc option sqlcheck=SEMANTICS.
Thanks for help
Jean-FrançoisHello,
I'm having the same problem !
Got unchanged .pc source code which worked fine with Oracle 9 and Oracle 10 pro*C precompilers,
I just installed Oracle 11gR1 Server on Win XP 32bits, and now I'm having this error :
C:\> proc.exe .\sources\t_bas_information_base sqlcheck=semantics native_types=YES userid=tpv/tpv@tpv
Pro*C/C++: Release 11.1.0.7.0 - Production on Ven. FÚvr. 4 11:34:44 2011
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Valeurs des options systÞme par dÚfaut extraites de : D:\oracle\ora11gR1\precomp\admin\pcscfg.cfg
Erreur Ó la ligne 93, colonne 54 dans le fichier .\sources\t_bas_information_base.pc
EXEC SQL DECLARE cur_T_BAS_INFORMATION_BASE CURSOR FOR
.....................................................1
PLS-S-00000, SQL Statement ignored
erreur sÚmantique Ó la ligne 93, colonne 54, fichier .\sources\t_bas_information_base.pc:
EXEC SQL DECLARE cur_T_BAS_INFORMATION_BASE CURSOR FOR
.....................................................1
PCC-S-02346, PL/SQL a trouvÚ des erreurs sÚmantiques
Anyone, an idea ?
Thank you.
Maybe you are looking for
-
How do I get the new photos albums from my imac to sync to my iphone?
Last week my iMac did the software update that replaced iPhoto on my iMac with the new Photos application. Since then, I have migrated all my iphoto library to the Photos library and have been able to further sort my photos in the albums area. I have
-
Network Utilization script throws error after re-executing
Hi everyone, I have a piece of code that finds the network util of a fileserver and if it is over 75% it stops executing the script. The script works the first time but after re-executing it, it throws an error. I've tried to null out all the variabl
-
Hi Any body can u tell me the purpous of casting and tell me the difference b/w narrowing and widening
-
I have created a protection group for file server and taking backup of a share on tape drive. under protection method--> I chose I want short-term protection using : tape retention range: 1 week frequency of backup: daily backup mode: full and increm
-
Hi I would like to know the purpose of condition tables?? How do we retrieve the data from these tables?? Thanks&Regards Rama