PLS-00394 error
Hi
i have create a procedure to retrieve data and when i compile i receive an error with this
"PLS-00394- wrong number of values in the INTO list of a FETCH statement"
here is the code
vLine VARCHAR2(4000);
CURSOR CurseurCRC
IS
SELECT
O.OPPORTUNITY_ID
, R.RA_CMPGN_NAME
, I.BO_ID_CUST
, R.START_DATE
, O.EST_CLOSE_DT
, O.ROW_ADDED_DTTM
, O.ROW_LASTMANT_DTTM
, CASE WHEN O.ROW_LASTMANT_OPRID IS NULL THEN ' '
WHEN LENGTH(O.ROW_LASTMANT_OPRID)=6 THEN UPPER(SUBSTR(O.ROW_LASTMANT_OPRID,0,5))
ELSE UPPER(O.ROW_LASTMANT_OPRID)
END
, O.OPPORTUNITY_STATUS
, MAX(I.ROW_ADDED_DTTM)
, MAX(I.INTERACT_STATUS) keep (DENSE_RANK LAST ORDER BY I.ROW_ADDED_DTTM)
, TO_CHAR(O.ROW_ADDED_DTTM,'YYYY')
FROM
SYSADM.PS_RSF_OPPORTUNITY O
, SYSADM.PS_RI_INTERACTION I
, SYSADM.PS_RA_CAMPAIGN R
, SYSADM.PS_RI_STATUS_TBL S
WHERE
O.RA_CAMPAIGN_ID = R.RA_CAMPAIGN_ID
AND R.RA_CAMPAIGN_ID = I.RA_CAMPAIGN_ID
AND S.RB_MCF_STATUS = I.INTERACT_STATUS
AND O.BO_ID_CUST=I.BO_ID_CUST
AND O.RA_CAMPAIGN_ID NOT LIKE (' ')
AND O.ROW_ADDED_DTTM > TO_DATE(vLASTRUN, 'YYYYMMDD')
AND O.ROW_ADDED_DTTM < TO_DATE(vCURRENTRUN, 'YYYYMMDD')
AND O.OPPORTUNITY_ID IN (
SELECT DISTINCT OPPORTUNITY_ID
FROM SYSADM.PS_RSF_OPPORTUNITY OPP, SYSADM.PS_BGL_CALL_LST CLST
WHERE OPP.BO_ID_CUST = CLST.BO_ID_CUST
AND OPP.ROW_ADDED_DTTM = CLST.ROW_ADDED_DTTM
AND OPP.RA_CAMPAIGN_ID = CLST.RA_CAMPAIGN_ID
AND CLST.ROW_ADDED_DTTM > TO_DATE(vLASTRUN, 'YYYYMMDD')
AND CLST.ROW_ADDED_DTTM < TO_DATE(vCURRENTRUN, 'YYYYMMDD')
group by
O.OPPORTUNITY_ID
, R.RA_CMPGN_NAME
, I.BO_ID_CUST
, R.START_DATE
, O.EST_CLOSE_DT
, O.ROW_ADDED_DTTM
, O.ROW_LASTMANT_DTTM
, O.ROW_LASTMANT_OPRID
, O.OPPORTUNITY_STATUS
, TO_CHAR(O.ROW_ADDED_DTTM,'YYYY');
OPEN CurseurCRC;
LOOP
FETCH CurseurCRC INTO vLine;
EXIT WHEN CurseurCRC%NOTFOUND;
BEGIN
sys.utl_file.put_line(vFileExport,vLine);
COMMIT;
EXCEPTION
WHEN OTHERS THEN
vCrcErrCount:=vCrcErrCount+1;
ROLLBACK;
END;
vCrcCount:=vCrcCount+1;
END LOOP;
CLOSE CurseurCRC;
thanks for your help
Edited by: user534160 on Sep 8, 2011 11:35 PM
Edited by: user534160 on Sep 8, 2011 11:35 PM
Your cursor query select clause has apprximate 12 columns selected and you are using only one variable to fetch them.. this is why you are getting this error.
As a fix,
either use same number of variables to fetch value of each column selected in cursor query ,
or join all the columns using string concatenation operator to make them one string as shown in below example:
DECLARE
vLine VARCHAR2(4000);
CURSOR C
IS
SELECT
TO_CHAR(NUMBER_ID) || ' ' ||
STRCOLUM_1 || ' ' ||
STRCOLUM_2
FROM TABLE_NAME ;
BEGIN
/*your script is reused in this example*/
OPEN C;
LOOP
FETCH C INTO vLine;
EXIT WHEN C%NOTFOUND;
BEGIN
sys.utl_file.put_line(vFileExport,vLine);
COMMIT;
EXCEPTION
WHEN OTHERS THEN
vCrcErrCount:=vCrcErrCount+1;
ROLLBACK;
END;
vCrcCount:=vCrcCount+1;
END LOOP;
CLOSE C;
END;Regards,
Dipali
Similar Messages
-
PLS-00394 Error message when deploying a mapping
Hi all,
Using Warehouse Builder 10.1.0.4.0 I created a mapping to add one row to a dimension. This dimension contains three columns. In my mapping I created two constants, each mapped to one column. There is also one sequence, the nextval is mapped to the third column. The data is merged to the target dimension.
When I generate the intermediate result I see the desired merge statement. But when I try to deploy the mapping, the package is invalid because of a "PLS-00394: wrong number of values in the INTO list of a FETCH statement".
The SQL causing the error is a fetch from a cursor, selecting the two constants and the nextval of the sequence. However, the INTO clause of the fetch only contains a variable for the nextval of the sequence, not for the two constants.
Can anyone tell me what I am doing wrong here?
Thanks in advance.
PaulI'm also running SOA Suite 11g ( on 64bit RH 5.4 )
Just looking at my SOAServer's command line where the policy is referenced
-Dweblogic.Name=SOAServer1 -Djava.security.policy=/orclapps/oracle/middleware/wlserver_10.3/server/lib/weblogic.policy
The policy file on my server is 9426 bytes, and it does reference some FMW elements within - do you see the same in yours?
// For Oracle JRF to load OPSS Policy provider
grant codeBase "file:${oracle.home}/modules/oracle.jps_${jrf.version}/*" {
permission java.security.AllPermission;
//grant to alternative location as well for some FMW install
grant codeBase "file:${common.components.home}/modules/oracle.jps_${jrf.version}/*" {
permission java.security.AllPermission;
// For Oracle JRF to load Oracle Wallet
grant codeBase "file:${oracle.home}/modules/oracle.pki_${jrf.version}/*" {
permission java.security.AllPermission;
//grant to alternative location as well for some FMW install
grant codeBase "file:${common.components.home}/modules/oracle.pki_${jrf.version}/*" {
permission java.security.AllPermission;
}; -
PLS-00394: wrong number of values
Hi,
I have this
SET SERVEROUT ON
DECLARE
v_line varchar2(100);
Cursor C_TBS is
Select A.tablespace_name,
A.total_size "Taille totale Ko",
B.Free_space "Space disponible Ko",
((A.total_size-B.Free_space)*100/A.total_size) "% Occupied Espace "
From
(select tablespace_name, sum(BYTES)/1024 total_size
from dba_data_files
group by tablespace_name) A ,
(select tablespace_name, sum(BYTES)/1024 Free_space
from dba_free_space
group by tablespace_name) B
where a.tablespace_name = b.tablespace_name
AND
((A.total_size-B.Free_space)*100/A.total_size) > 80;
BEGIN
DBMS_OUTPUT.ENABLE(10000);
Open C_TBS;
Loop
Fetch C_TBS into v_line;
DBMS_OUTPUT.PUT_LINE('TABLESPACE8NAME is : '||v_line);
EXIT WHEN c_TBS%NOTFOUND;
END LOOP;
END;
With this error :
Fetch C_TBS into v_line;
ERROR at line 23:
ORA-06550: line 23, column 4:
PLS-00394: wrong number of values in the INTO list of a FETCH statement
How do I define v_line variable to avoid PLS-00394 error ?
Many thanks.Hi!
When you have a cursor retrieving more than one column you need to define a record to fetch the row like:
v_line C_TBS%rowtype;
but in your dbms_output you have to use
DBMS_OUTPUT.PUT_LINE('TABLESPACE8NAME is : '||v_line.tablespace_name);
because you have to refer to the individual column in the record.
Regards,
Petra -
Oracle 9i
I get the following error when I run the below stored procedure.
PLS-00394: wrong number of values in the INTO list of FETCH statement.
CREATE OR REPLACE procedure TEST_PROC
is
cnt number := 1;
type my_record is record
a varchar2(20),
b number(10),
c varchar2(50),
d varchar2(10),
e number(2),
l char(2) :='ll',
m varchar2(2) :='mm',
n varchar2(2) :='nn',
s varchar2(2) :='ss'
type tab_my_rec is table of my_record;
tab_rec tab_my_rec;
cursor cur is
select a,b,c,d,e from table2;
begin
open cur;
loop
fetch cur bulk collect into tab_rec limit 100;
forall t in 1.. tab_rec.count
insert into (select a,b,c,d,e,l,m,n....s from table1) values tab_rec(t);
-- Commit every 100 records
cnt := cnt+1;
if mod(cnt, 100) = 0 THEN
COMMIT;
end if;
EXIT WHEN tab_rec.COUNT = 0;
end loop;
commit;
close cur;
end;
If I specify a default value in the select clause then it works
cursor cur
is
select a,b,c,d,e,'ll','mm',.,.,.,.,'ss' from table2;
Question:
1) I need to insert default values to the last columns(column 7 .....column 10) of a table1. Should i specify it in the cursor or can i do only by defining it at the record level? I do not want to define it in the select statement.
Should the number of columns selected in the SELECT query match the number of variables used in the fetch statement?
2) I am using records to group related data items from table2 & load it into table1 with some additional constant fields. Using RECORDS an ideal approach?
Thanks in advance.Thanks for the reply.
Yes you are right I do have a workaround. But it goes back to my original question were i didn't want to define the constant values in the cursor declaration section but wanted to specify it while inserting the values. I don't think its possible to do it directly in oracle 9i or 10g becuase of the restriction stated above.
This works
forall t in 1.. tab_rec.count
insert into (select a,b,c,d,e,l,m,n....s from table1) values tab_rec(t);
This doesn't
forall t in 1.. tab_rec.count
insert into (select a,b,c,d,e,l,m,n....s from table1) values (tab_rec(t).a,tab_rec(t).b,tab_rec(t).c,tab_rec(t).d,tab_rec(t).e,'ll','mm','nn',....,'ss');
Can not reference individual attributes of records with FORALL in (oracle 9i or 10g).
I think the only solution is to define the constant values in the cursor select statement & in the record declartion to hold these values and insert them all. Like this
forall t in 1.. tab_rec.count
insert into (select a,b,c,d,e,l,m,n....s from table1) values tab_rec(t);
Committing once at the end of all the inserts might not works as I have 1 million records to insert.
Solomon is right my code for commit is not efficient. If I have 1 million records to commit then is it good to commit for every 1000 or 10000 records? How do I code it more efficiently?
Thanks in advance. Appreciate your input. -
PLS-00907 Error but referenced package compiled
Hi I am experiencing some problems with Database Link.
In DEV Environment,
I have two database, DB A and DB B.
In DB A I have package name SUPPORT_PKG and inside it I have a function named HISTORY_UPDATE.
Package is compiled correctly in DB A and working fine.
I created a procedure CALL_HIST_UPD in DB B to execute SUPPORT.PKG.HISTORY_UPDATE@A through DB LINK.
and it gave me PLS-00907 error.
UAT environment has the same setup of user and package as DEV.
then I tried to copy the CALL_HIST_UPD to DB B in UAT and it can be compiled sucessfully in UAT.so I do the following
Back to Dev again
I tried to figure what's going on until I decided to replace the header specification SUPPORT.PKG.HISTORY_UPDATE
with the declaration part from the body and recompiled the whole package again, and this time I can compile the procedure in DB B.
I am curious and check the header in UAT and found that UAT Headers is the same exactly with the DEV Headers
before I replaced it with the new one by copying from the body. I am curious why the DEV environment give the PLS-00907 error at the first time, even at that time package in A are compiled nicely.
Let me know if the question is not clear.
thanks for your helpTry this -
CREATE OR REPLACE PACKAGE data_mgmt AUTHID CURRENT_USER
IS
FUNCTION hy_name (in_dt DATE, in_option_txt VARCHAR2)
RETURN VARCHAR2;
END data_mgmt;
CREATE OR REPLACE PACKAGE BODY data_mgmt
IS
FUNCTION hy_name (in_dt DATE, in_option_txt VARCHAR2)
RETURN VARCHAR2
IS
return_txt VARCHAR2 (25);
BEGIN
RETURN return_txt;
END hy_name;
END data_mgmt;
/ -
Getting pls-00428 error.
Hi all,
I'm trying to fix some invalid objects in our 11g database and i'm getting a pls-00428 error. Not sure where the issue is originating at (keep in mind, my IT team and I are not thoroughly experienced with 11g, so I apologize if this sounds a little too newbie-ish)
Here's the plsql:
create or replace
FUNCTION detail_cogs (
sSKU varchar2
--,dtFrom date := sysdate
return number
is
nRetval number;
begin
select *
--SUM(cost * ieqty) into nRetval
from (
select
ie.qty ieqty
,ie.part
,ic.validdate
,ic.cost
,LAG(validdate) OVER (partition by ic.part order by validdate desc) prev_entry_time
from
oracle2_partexplosion_mv ie
,oracle2_itemcogs_mv ic
where
ie.sku = sSKU
and ic.part = ie.part
and ic.validdate <= sysdate
order by part, validdate desc
where
prev_entry_time is null;
return nRetval;
exception
when others then
return null;
end;Welcome to the forum.
Reading the documentation will save you:
PLS-00428: an INTO clause is expected in this SELECT statement
Cause: The INTO clause of a SELECT INTO statement was omitted. For example, the code might look like SELECT deptno, dname, loc FROM dept WHERE ... instead of SELECT deptno, dname, loc INTO dept_rec FROM dept WHERE ... In PL/SQL, only a subquery is written without an INTO clause.
http://download.oracle.com/docs/cd/E11882_01/server.112/e10880/pcmus.htm#sthref17855
http://www.oracle.com/pls/db112/search?word=select+into&partno=e10472
Doc home: http://www.oracle.com/pls/db112/homepage
And please change or remove this part from your code anyway, since it's nothing but a bug:
exception
when others then
return null;11g compiler warned you already about that, I may hope... -
PLS-00428 Error when creating a new trigger
Hi,
I'm encountering the PLS-00428 error when I run the script below.
CREATE OR REPLACE TRIGGER TIBCOUSER.po_response_trigger
BEFORE INSERT ON po_response FOR EACH ROW
BEGIN
IF:NEW.ariba_processsequence is null then
SELECT pttransid AS pttransid, 'Product Test Pass 1' AS pttransname, aribaorderid AS aribaorderid, '0' AS errorcode, '' AS MESSAGE, SYSDATE AS ariba_insertdate
FROM po_request
WHERE adb_l_delivery_status = 'N';
UPDATE po_request
SET adb_l_delivery_status = 'C'
WHERE adb_l_delivery_status = 'N';
END IF;
END;
Can someone point out what is missing or what is wrong with the script? Any help would be much appreciated.
Regards,
JiggerHi Jigger,
I was able to create the trigger using the script below.That's nice, you got the trigger created. Below is your trigger, I have added some comments.
create or replace trigger tibcouser.po_response_trigger
before insert or update
on po_response
for each row
declare
-- 1. These variables should really be anchored to po_response
-- 2. They should be named differently than columns in po_response
-- 3. It seems that you don't need them (See 7.)
pttransid integer := null;
pttransname varchar2(255) := null;
aribaorderid varchar2(255) := null;
errorcode integer := null;
message varchar2(255) := null;
ariba_insertdate date := null;
adb_l_delivery_status char(1) := null;
begin
-- 4. This is never true, since adb_l_delivery_status is null, here
-- So, I guess your trigger never does anything, so in a sense it works
if (adb_l_delivery_status = 'N')
then
-- 5. This select will raise too_many_rows, when there is more than one record in po_response.
-- 6. It seems you will have a problem with mutating table
-- 7. The select doesn't do anything, you never use any of the values selected
-- 8. The select is confusing, since variables are named equally to columns
-- 9. You select constants, why not just assign them right away
select pttransid
,pttransname
,aribaorderid
,'0'
,sysdate
into pttransid
,pttransname
,aribaorderid
,errorcode
,message
,ariba_insertdate
from po_response;
-- 10. This update will update ALL records in po_request, probably not what you want.
update po_request
set adb_l_delivery_status = 'C';
end if;
-- 11. Good practise dictates end po_response_trigger;
end;
/In general, when you think your post has been answered, then kindly mark it as such.
Regards
Peter -
PLS-00201 error calling function in package member
Hello,
I'm trying to call a function defined in a PL/SQL package, but receiving a PLS-00201 error.Sorry, a finger-controller error caused me to submit before I was ready. I'm having the module replaced today. :)
After rethinking my decision to post here, I decided not to. I've never received a helpful answer, probably because the issues are not simple... Too bad. -
How to fix the PLS-00123 error?
I construct about the oracle spatial sql as follow:
declare
ord sdo_ordinate_array := sdo_ordinate_array();
begin
begin for i IN 1 ..5624 LOOP
ord extend;
end LOOP;
ord(1) := number1;
ord(2) := number2;
ord(3) := number3;
ord(4) := number4;
insert into table(shape,....) values(SDO_GEOMETRY(2002,NULL,NULL,SDO_ELEM_INFO_ARRAY(1,2,1),ord));
END;
Because the count of geometry node is very long. I got the PLS-00123 error when I execute the state? somebody help me fix the problem?????
Message was edited by:
user646459It seems more on PL/SQL error to me. Have you posted your question in PL/SQL forum?
Ming Man -
Cyclic PLS-00538 and PLS-00539 errors?
I've defined a supertype, t_cliente, and derived two subtypes, t_cliente_pers and t_cliente_soc. The first one has 6 member functions and the latter ones override only two of them.
Every time I launch the script for creation I get PLS-00538 and PLS-00539 errors, but I'm not able to find out why.
The explanation for PLS-00538 is: subprogram or cursor "string" is declared in an object type specification and must be defined in the object type body.
For PLS-00539 is: subprogram "string" is declared in an object type body and must be defined in the object type specification.
It's a cycle! And after all I defined these 2 functions in type specification and type body.
I'm using 10g XE. Here's the code:
create TYPE t_indirizzo AS OBJECT (
via VARCHAR(45),
numero NUMBER(4),
cap INTEGER(5),
citta VARCHAR(30),
provincia VARCHAR(30),
regione VARCHAR(30),
MEMBER FUNCTION indirizzoCompleto RETURN VARCHAR
create TYPE t_telefono AS OBJECT (
num_tel NUMBER(15)
create TYPE t_telefono_array IS VARRAY(3) OF t_telefono
create TYPE t_anagrafica AS OBJECT (
nome VARCHAR(45),
cognome VARCHAR(45),
sesso CHAR(1),
cod_fiscale VARCHAR(16),
data_nascita DATE
create TYPE t_ragioneSociale AS OBJECT (
nome_soc VARCHAR(45),
data_cost DATE,
part_iva NUMBER(11)
create TYPE t_persona AS OBJECT (
dati_anagrafici t_anagrafica,
indirizzo t_indirizzo,
email VARCHAR(45),
telefono t_telefono_array
create TYPE t_societa AS OBJECT (
ragione_sociale t_ragioneSociale,
indirizzo t_indirizzo,
email VARCHAR(45),
telefono t_telefono_array,
persona_rif REF t_persona
create TYPE t_cliente AS OBJECT (
cod_cliente NUMBER(8),
MEMBER FUNCTION incFatti RETURN NUMBER,
MEMBER FUNCTION incSubiti RETURN NUMBER,
MEMBER FUNCTION incFattiPeriodo RETURN NUMBER, /* this is the first function that gives me problems */
MEMBER FUNCTION incSubitiPeriodo RETURN NUMBER, /* this is the second one */
MEMBER FUNCTION nomeCliente RETURN VARCHAR,
MEMBER FUNCTION tipoCliente RETURN VARCHAR
) NOT FINAL
create or replace
TYPE BODY t_cliente AS
MEMBER FUNCTION incFatti RETURN NUMBER
IS incidenti NUMBER;
BEGIN
SELECT count(i. cod_incidente) INTO incidenti
FROM incidente i, mezzo m
WHERE SELF.cod_cliente = m.proprietario.cod_cliente AND m.num_targa = i.mezzo. num_targa AND i. responsabilita = 'c';
RETURN (incidenti);
END;
MEMBER FUNCTION incSubiti RETURN NUMBER
IS incidenti NUMBER;
BEGIN
SELECT count(i. cod_incidente) INTO incidenti /* here's the first PLS-00538 error */
FROM incidente i, mezzo m /* here's the second PLS-00538 error */
WHERE SELF.cod_cliente = m.proprietario.cod_cliente AND m.num_targa = i.mezzo. num_targa AND i. responsabilita = 's';
RETURN (incidenti);
END;
MEMBER FUNCTION incFattiPeriodo(da DATE, a DATE) RETURN NUMBER /* here's the first PLS-00539 error */
IS incidenti NUMBER;
BEGIN
SELECT count(i. cod_incidente) INTO incidenti
FROM incidente i , mezzo m
WHERE SELF. cod_cliente = m.proprietario.cod_cliente AND m. num_targa = i.mezzo. num_targa AND i. responsabilita = 'c' AND (i.data_inc BETWEEN da and a);
RETURN (incidenti);
END;
MEMBER FUNCTION incSubitiPeriodo(da DATE, a DATE) RETURN NUMBER /* here's the second PLS-00539 error */
IS incidenti NUMBER;
BEGIN
SELECT count(i. cod_incidente) INTO incidenti
FROM incidente i , mezzo m
WHERE SELF. cod_cliente = m.proprietario.cod_cliente AND m. num_targa = i.mezzo. num_targa AND i. responsabilita = 's' AND (i.data_inc BETWEEN da and a);
RETURN (incidenti);
END;
MEMBER FUNCTION nomeCliente RETURN VARCHAR
IS
BEGIN
RETURN TO_CHAR(cod_cliente);
END;
MEMBER FUNCTION tipoCliente RETURN VARCHAR
IS
BEGIN
RETURN ('u');
END;
END;
create TYPE t_cliente_pers UNDER t_cliente (
persona REF t_persona,
OVERRIDING MEMBER FUNCTION nomeCliente RETURN VARCHAR,
OVERRIDING MEMBER FUNCTION tipoCliente RETURN VARCHAR
) NOT FINAL
create or replace
TYPE BODY t_cliente_pers AS
OVERRIDING MEMBER FUNCTION nomeCliente RETURN VARCHAR
IS nc VARCHAR(90);
BEGIN
SELECT concat(DEREF(SELF.persona).dati_anagrafici.nome, concat(' ',DEREF(SELF.persona).dati_anagrafici.cognome)) INTO nc
FROM DUAL;
RETURN (nc);
END;
OVERRIDING MEMBER FUNCTION tipoCliente RETURN VARCHAR
IS
BEGIN
RETURN ('p');
END;
END;
create TYPE t_cliente_soc UNDER t_cliente (
societa t_societa,
OVERRIDING MEMBER FUNCTION nomeCliente RETURN VARCHAR,
OVERRIDING MEMBER FUNCTION tipoCliente RETURN VARCHAR
) NOT FINAL
create or replace
TYPE BODY t_cliente_soc AS
OVERRIDING MEMBER FUNCTION nomeCliente RETURN VARCHAR
IS
BEGIN
RETURN (societa.ragione_sociale.nome_soc);
END;
OVERRIDING MEMBER FUNCTION tipoCliente RETURN VARCHAR
IS
BEGIN
RETURN ('s');
END;
END;
/The declarations of functions incFattiPeriodo and incSubitiPeriodo differ between type specification and type body (the ones in the type body have formal parameters).
-
The following anonymous block works fine
begin
null;
end;
/but if I add a space between "end" and ";", like this
begin
null;
end ;
/I get ORA-06550 and "PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following ..." errors.
I'm running version 1.5.4, Build MAIN-5940, on Windows XP.racist!
No, really, the two should behave in the same manner, so if the syntax is correct (which is), both should work. As F9 doesn't, it's a bug.
Regards,
K. -
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.
-
Help on ORA-06550 & PLS-00363 Error while running a procedure from a packag
Greeting All,
I ran the following procedure from a package on a command line in sqlplus:
SQL> exec QUALITY_ASSURANCE.COPY_SW_RESOURCES(2009,2010,9508);Where '2009' is the old fiscal year, '2010' is the new fiscal year and '9508' is the error code passed from the calling program. But, I received the following error messages:
ERROR at line 1:
ORA-06550: line 1, column 53:
PLS-00363: expression '9508' cannot be used as an assignment target
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
Any thoughts, suggestions and/or advice to resolve these errors.
Thanks in advance.Orchid wrote:
Justin,
Thanks for your response and information. Yes, Theoa was correct the 3rd parameter is an OUT variable, and it is a numeric field. The procedure was called by a form as follows:
QUALITY_ASSURANCE.COPY_SW_RESOURCES(:BLK_CONTROL.FROMFY,:BLK_CONTROL.TOFY,V_ERR);But the form does not work so I am trying to isolate the problem by running the procedure by itself in sqlplus to make sure there is no problem with the procedure.
Yesterday, I was able to run the procedure in Toad for Oracle to a successful completion by providing the 3 parameters: (2009, 2010, null). Just wonder why I cannot run the same procedure with the same parameters on a command line in sqlplus as follows:
exec QUALITY_ASSURANCE.COPY_SW_RESOURCES(2009,2010,null);So, if I understand your suggestion correctly, in order to run the procedure with the 3 parameter successfully in sqlplus,
I have to declare the 3rd parameter in PL/SQL. That is to create a PL/SQL file as suggested and run the file, correct? CORRECT! -
ORA-06550/PLS-00201 error while configuring data source
Hi,
My development platform is Visual Studio 2005, ODAC11g Release 1 (11.1.0.6.20), and Oracle 10g Release 2 database.
I tried to setup a sqlDatasource in my web page using drag and drop features
When I configure the sqlDatasource to use a stored procedure inside a package,
I notice that odp.net uses #0# as separator (instead of .) between package name and procedure name in Configure Data Source dialog box. Then when I clcik the Test Query button, I got following error.
There was an error executing the query. Please check the syntax of the command and if present, the types and values of the parameters and ensure they are correct.
ORA-06550: line 1, column 7:
PLS-00201: identifier 'PK_LOOKUP_TABLE#0#P_LIST' must be declared
ORA-06550: line 1, column 7
PL/SQL: Statement ignored
It looks like odp.net cannot locate PK_LOOKUP_TABLE#0#P_LIST.
Is there any workaround ?
Below is the stored procedure code. It compiles and runs without problem.
PACKAGE BODY pk_lookup_table
AS
/* Get a list of lookup table name */
PROCEDURE P_LIST (
O_CURSOR OUT sys_refcursor )
IS
l_cur sys_refcursor;
BEGIN -- executable part starts here
OPEN l_cur FOR
SELECT table_name
FROM all_tab_comments u
WHERE u.comments LIKE '%Lookup Table%'
ORDER BY 1;
o_cursor := l_cur;
END P_LIST;
END "PK_LOOKUP_TABLE";
On the sqlDataSource property sheet, if I click the Select Query property, the Command and Parameter Editor will open, then I can change the select command name to PK_LOOKUP_TABLE.P_LIST. Then if I run the application, I get another error.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Oracle.DataAccess.Client.OracleException: ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'P_LIST'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
Seems that it can locate the procedure.
In the Command and Parameter Editor dialog, I can add output parameter, but data type is restricted. There is no REF CURSOR datatype in the dropdown list.
How can I add output parameter with REF CURSOR type via IDE ?
Thanks for the time looking into this issue.
MansionHi
Even I faced this problem while connecting to RMAN . But I feel your problem is different .
My issue was like this
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00554: initialization of internal recovery manager package failed
RMAN-04005: error from target database:
ORA-06550: line 1, column 7:
PLS-00201: identifier 'DBMS_BACKUP_RESTORE.SET_CHARSET' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
RMAN-04015: error setting target database character set to WE8MSWIN1252
Solution :
execute catproc.sql;
Maybe you are looking for
-
Hi I just started learning Essbase, Apologies if my question is not straight forward. How to set consolidation operators using rules file instead of doing through member properties. Thanks in advance
-
How dictation work in OS X ML?
I have my dictation set up in System Preferences. How do I use it? Are there only certain programs that allow this (such as Pages. Numbers) or can I use this even on line, such blogging, chats on Facebook? I also bought a Dragon Dictate for Mac, wi
-
I'm doing some simple socket programming but I'm having trouble getting my sockets to close. I tell them to close but they don't seem to be recognized as closed. Here is where I get create my socket: {code Socket connectionSocket = myWelcomeSocket.ac
-
DatabaseMetaData getColumns :- type_name returns 'int identity' (SQLServer)
Hi all, I am using the JDBC DatabaseMetaData API, getColumns() method. The back end is SQLServer 2005. Now according to how the API is specified, I am using index 6(I think)(type_name) to retrieve the data type name from the resultset for each column
-
How to compile the AIR app to android emulator
How to compile the AIR application to run on emulator ? May be use the 'adb' command line ?