Error in Trigger (PL/SQL: SQL Statement Ignored)
Here is the trigger:
CREATE OR REPLACE TRIGGER DRUGREPLACEMENT
AFTER INSERT ON PHARMACEUTICALS
REFERENCING NEW AS newDrugs
FOR EACH ROW
WHEN (newDrugs.drugname = newDrugs.genericname)
BEGIN
UPDATE prescription
SET pharmaceuticalid = newDrugs.drugID
WHERE pharmaceuticalid IN(SELECT pharmaceuticalid FROM prescription, pharmaceuticals WHERE drugid = pharmaceuticalid AND newDrugs.genericname = pharmaceutical.genericname);
END;
Error is:
Error(2,1): PL/SQL: SQL Statement ignored
Error(3,24): PL/SQL: ORA-00904: "NEWDRUGS"."DRUGID": invalid identifier
pharmaceuticalid is a number in my prescription table.
drugid is a number; genericname and drugname are both varchars in my pharmaceuticals table. Any idea why I am getting these errors? (I tried putting quotes around newdrugs.drugid but then it just said "newdrugs.drugid" is invalid. Thanks for your help
-Brian
One more thing. Your trigger is selecting from triggering table. So single row inserts will work, but multiple row inserts into PHARMACEUTICALS will fail with famous "table is mutating" error. There is no need to select from PHARMACEUTICALS. Change:
UPDATE ************
SET pharmaceuticalid = newDrugs.drugID
WHERE pharmaceuticalid IN(SELECT pharmaceuticalid FROM ************, pharmaceuticals WHERE drugid = pharmaceuticalid AND newDrugs.genericname = pharmaceutical.genericname);to
UPDATE ************
SET pharmaceuticalid = newDrugs.drugID
WHERE pharmaceuticalid IN (
SELECT pharmaceuticalid
FROM ************
WHERE drugid = :newDrugs.pharmaceuticalid
AND :newDrugs.genericname = pharmaceutical.genericname
);SY.
Similar Messages
-
Error: PL/SQL statement ignored
In the code below i am getting 3 errors:
a. PL/SQL statement ignored
b. PLS-00201
c. PL/SQL: ORA-00904 : invalid identifier
please help. thank you
=========================================
Package body:
=========================================
create or replace package BODY manage_students
as
procedure find_sname
(i_student_id IN student.student_id%TYPE,
o_first_name OUT student.first_name%TYPE,
o_last_name OUT student.last_name%TYPE)
IS
v_student_id student.student_id%TYPE;
BEGIN
select first_name, last_name
into o_first_name, o_last_name
from student
where student_id = i_student_id;
exception
when others
then
DBMS_OUTPUT.PUT_LINE('Error in finding student_id: '||v_student_id);
end find_sname;
function id_is_good
(i_student_id in student.student_id%TYPE)
return BOOLEAN
IS
v_id_cnt number;
begin
select count(*)
into v_in_cnt
from student
where student_id = i_student_id;
return 1 = v_id_cnt;
EXCEPTION
when others then
return FALSE;
end id_is_good;
END manage_students;
=========================
Package specification:
=========================
set serveroutput on
create or replace package manage_students
as
procedure find_sname
(i_student_id IN student.student_id%TYPE,
o_first_name OUT student.first_name%TYPE,
o_last_name OUT student.last_name%TYPE
function id_is_good
(i_student_id IN student.student_id%TYPE)
RETURN BOOLEAN;
END manage_students;
Edited by: [email protected] on Mar 19, 2009 6:03 AM
Edited by: [email protected] on Mar 19, 2009 6:03 AMCongrats, someonElse! ;-)
And about the when others: read about it on asktom why it's a bad practice, here's an example:
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1509245700346768268#1535781400346575552
I've spent myself way too much time on finding and fixing bugs caused by 'when others', so I always comment about it too ;-)
Edited by: hoek on Mar 19, 2009 2:14 PM
Edited by: hoek on Mar 19, 2009 2:18 PM -
Error message "SQL Statement ignored" while try to run an Funtion in APEX
Hello All,
In order to creating an application in APEX from CSV format i need to run below funtion.
CREATE OR REPLACE FUNCTION bcl_custom_auth (
p_username IN VARCHAR2,
p_password IN VARCHAR2)
RETURN BOOLEAN IS
BEGIN
FOR c1 IN (SELECT 1
FROM bcl_employees
WHERE UPPER(userid) = UPPER(p_username)
AND UPPER(last_name) = UPPER(p_password))
LOOP
RETURN TRUE;
END LOOP;
RETURN FALSE;
END;
but i am getting below error message:
Error at line 6: PL/SQL: SQL Statement ignored
4. RETURN BOOLEAN IS
5. BEGIN
6. FOR c1 IN (SELECT 1
7. FROM bcl_employees
8. WHERE UPPER(userid) = UPPER(p_username)
Could some body please check as i am new to PLSQL.
Thanks & regards,
Souvik Ghosh843873 wrote:
Hello Edstevens,
I did not understand your answer .Could you please elaborate.
Thanks & regards,
Souvik Ghosh
Edited by: 843873 on Jul 8, 2011 11:43 PMNotice that the message had been edited? I changed my mind from my original, shot-from-the-hip, mesage, and simply deleted the entire content. would have preferred to delete the entire message but can't. -
Error in Trigger ( PL/SQL: ORA-01744: inappropriate INTO)
Hi ,
I've written the trigger in the following format.. As the original trigger is around 700 lines, so just format is written here.. please co-operate..
CREATE OR REPLACE TRIGGER --
AFTER UPDATE OF COL1
ON TAB1
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
WHEN (NOT(OLD.COL1 IS NULL AND NEW.COL1=0))
DECLARE
rowToins PAK1.fdList;
i number;
BEGIN
IF :NEW.COL2='V' THEN
INSERT INTO DEST(
D_AT)
SELECT * FROM ( SELECT --
PAK2.FUN1('AD',TAB10.ID) AS D_AT
FROM ---
WHERE --- )
WHERE D_AT IS NOT NULL;
ELSEIF :NEW.COL2 ='H' THEN
SELECT * FROM ( SELECT --
PAK2.FUN1('AD',TAB9.ID) AS D_AT
BULK COLLECT INTO rowToins
FROM ---
WHERE --- )
WHERE D_AT IS NOT NULL;
i:=rowToins.FIRST;
WHILE i IS NOT NULL LOOP
--insert row 1
PAK1.fun2(rowToins(i).<col>,
i:=rowToins.NEXT(i);
END LOOP;
END IF;
END;
/The above code is giving the error..
PL/SQL: ORA-01744: inappropriate INTOSo how can i correct the code...
thanksThe line no..are
159/3 PL/SQL: SQL Statement ignored
213/16 PL/SQL: ORA-01744: inappropriate INTO
159 --> the first where condition in the example code
213 --> the select list column in the second if condition in example code
If i remove the
select * from (
PAK2.FUN1('AD',TAB9.ID) AS D_AT
WHERE D_AT IS NOT NULL;Then the trigger is created with no issues....
please let me know if i'm not clear
Edited by: josh1612 on Apr 27, 2009 3:42 AM -
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 -
ORA-00933: SQL command not properly ended: error in TRIGGER
Hi ,
I tried the following example trigger but unable to trace the error..
Could you please find it...
CREATE OR REPLACE TRIGGER trig1
AFTER INSERT OR UPDATE OR DELETE
OF RLID,RL
ON X_RLM_T
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
DECLARE
rlmId X_RLM_T.RLID%TYPE:=CASE WHEN INSERTING OR UPDATING THEN :NEW.RLID WHEN DELETING THEN :OLD.RLID ELSE NULL END;
rlm RX_RLM_T.RL%TYPE:=CASE WHEN INSERTING OR UPDATING THEN :NEW.RL WHEN DELETING THEN :OLD.RL ELSE NULL END;
var number:=0;
var1 number:=0;
BEGIN
var:=1;
var1:=1;
INSERT ALL
WHEN var=1 then
INTO LM_D(CL_ID,D_RLM,RM_NM,RDK_ORG)
VALUES(dclid,D_RLM,RM_NM,RDK_ORG)
WHEN var1=1 then
INTO LM_D(CL_ID,D_RLM,RM_NM,RDK_ORG)
VALUES(pclid,D_RLM,RM_NM,RDK_ORG)
SELECT X_RLM_DK_MAP_T.CL_ID AS dclid,
PM_OR_T_VP.ORG_TECH_ID AS pclid,
rlmId as D_RLM,
rlm as RM_NM,
RX_RLM_DK_MAP_T.ORG_TECH_ID as RDK_ORG
FROM RX_RLM_DK_MAP_T , PM_OR_T PMN_ORG_T_VP, PM_OR_T PMN_ORG_T_HP
PM_RA_MST
WHERE rlmId = RX_RLM_DK_MAP_T.RL_ID and
RX_RLM_DK_MAP_T.ORG_TECH_ID=PM_OR_T_HP.ORG_TECH_ID and
PM_OR_T_HP.ORG_ID=PM_RA_MST.HPMN_ID and
PM_RA_MST.VPMN_ID=PM_OR_T_VP.ORG_ID;
end;error:
11/2 PL/SQL: SQL Statement ignored
24/8 PL/SQL: ORA-00933: SQL command not properly ended
please help me in this...i GOT THE ERROR...
-
SQL Statement ignored performing List of Values query
Hi, New user just learning the basics. I have created a simple table PERSON with columns, ID, firstname, lastname, phone, city, State_ID
Then clicked create Lookup table - State_Lookup with columns State_ID and State_Name.
I create a page, include all columns from PERSON. For State the field is a select list that should do a lookup form the STATE_LOOKUP table. (I have entered 4 states in the table)
I am getting the following error however:
Error: ORA-06550: line 1, column 14: PL/SQL: ORA-00904: "STATE_ID": invalid identifier ORA-06550: line 1, column 7: PL/SQL: SQL Statement ignored performing List of Values query: "select STATE_ID d, STATE_ID v from STATE_ID_LOOKUP order by 1".
I have not entered any sql, just selected all of my options using defaults and dropdowns. What is causing the error and what do I need to change?
ThanksOkay, learned something: The database link name used, must not contain a dash. The DB_DOMAIN is appended automatically when you create a DB link, so if IT contains a dash, the db link name does as well. Check DBA_DB_LINKS to make sure you don't hit this well-hidden feature.
Regards
Martin Klier
[http://www.usn-it.de|http://www.usn-it.de] -
ODI Error: java.sql.SQLException: statement is not in batch mode
Greetings Gurus!
Would anybody know why changing a SQL view from
AND hapf.attribute1 LIKE '%Active%'
To
AND (hapf.attribute1 LIKE '%Active%' or hapf.attribute1 = ‘Frozen’)
cause ODI to fail?
This is the error message from ODI:
ODI-1228: Task SrcSet0 (Loading) fails on the target SUNOPSIS_ENGINE connection SUNOPSIS_MEMORY_ENGINE.
Caused By: java.sql.SQLException: statement is not in batch mode
at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
at org.hsqldb.jdbc.Util.sqlExceptionSQL(Unknown Source)
at org.hsqldb.jdbc.JDBCPreparedStatement.executeBatch(Unknown Source)
at oracle.odi.runtime.agent.execution.sql.SQLCommand.end(SQLCommand.java:267)
at oracle.odi.runtime.agent.execution.sql.SQLExecutor.endExecution(SQLExecutor.java:156)
at oracle.odi.runtime.agent.execution.sql.SQLExecutor.endExecution(SQLExecutor.java:1)
at oracle.odi.runtime.agent.execution.DataMovementTaskExecutionHandler.handleTask(DataMovementTaskExecutionHandler.java:113)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.processTask(SnpSessTaskSql.java:2913)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2625)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:558)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:464)
at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:2093)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$2.doAction(StartSessRequestProcessor.java:366)
at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:216)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:300)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$0(StartSessRequestProcessor.java:292)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$StartSessTask.doExecute(StartSessRequestProcessor.java:855)
at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:126)
at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:82)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.hsqldb.HsqlException: statement is not in batch mode
at org.hsqldb.error.Error.error(Unknown Source)
at org.hsqldb.error.Error.error(Unknown Source)
... 19 more
Thank you!
RayLooks like the single quotes around Frozen are not ascii single quotes. They seem to be a copy paste job from MSWord.
It should be 'Frozen' and then you shouldnt have that issue
>
AND hapf.attribute1 LIKE '%Active%'
To
AND (hapf.attribute1 LIKE '%Active%' or hapf.attribute1 = ‘Frozen’)
>
Devil is in the details ;) -
SQL-error "-955-Duplicate name" in DDL statement
Hi!
During upgrade preparations (PREPARE) i got follwing problem activating a table TAREF in SOLMAN32/MaxDB 7.5
estos100:smpadm 79> more MVNTTOOL.ELG
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
MVNTABS errors and RETURN CODE in P060227.SMP
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2EETP345 22:16:03: Retcode 1024: SQL-error "-955-Duplicate name" in DDL statement for "TAREF
2EETP345 "
2EETP334 22:16:03: error in DDL, nametab for "TAREF" not activated
1 ETP111 exit code : "8"
estos100:smpadm 80>
When looking from the ABAP perspective (se14 -> table "TAREF" -> Indexes) I see that the table has two indexes:
"0 X Primary index"
"1 X Index on Object Type".
When looking at details for "index 1" it says "does not exist in database".
How do I solve this ABAP dictionary inconsistancy?
Regards,
Fredrik
Message was edited by: Fredrik RosengrenHi Fredrik,
please open an OSS message for your issue.
Kind regards,
Roland -
I'm migrating from Reports 10.xxx to 11.1.2.0, and I run into something very strange. Any select statement on any trigger on Reports 11.xxx returns Error 0 at line x, column x SQL statement ignored.
The reports have been and are still running on Reports 10xxx with no problems.
Below one of those triggers:
function BeforeReport return boolean is
begin
select rv_low_value
into :cp_name
from cg_ref_codes
where rv_domain = 'COMPANY';
return (TRUE);
end;
Any help will be appreciated,
LuisWhat is that :cp_name. Is it a parameter?
-
Error in Migration Repository using Sql*Developer Migration Workbench
To migrate a MS access mdb database to Oracle using Sql*Developer Migration Workbench, I try to create first the the Migration Repository in SQL*Developer.
The repository is created, but under PACKAGES I could see that package MD_META has been compiled with errors.
PACKAGE BODY AO_PERSONAL.MD_META@DMCAPX (AO_PERSONAL):
Error(27,2): PL/SQL: SQL Statement ignored
Error(30,23): PL/SQL: ORA-00904: : ungültiger Bezeichner
Well, when I ignore this and continue with the next step of the migration process "Capture Microsoft Access Exported XML file" to create the Captured Model, I get the following error message:
ORA-04063: package body "AO_PERSONAL.MD_META" enthält Fehler ORA-06508: PL/SQL: aufgerufene Programmeinheit : "AO_PERSONAL.MD_META" konnte nicht gefunden werden ORA-06512: in "AO_PERSONAL.MD_PROJECTS_TRG", Zeile 3 ORA-04088: Fehler bei der Ausführung von Trigger 'AO_PERSONAL.MD_PROJECTS_TRG'
Target database RDBMS is Oracle Database 10g Enterprise Edition Release 10.2.0.3.0. So the proposal of note 427916.1 to create the Repository in a 10.2 RDBMS does not solve the problem.
I even tried to use the Quick Migrate feature in SQL*Developer, but got the same error message."inserted value too large for column"
Is there a LOGON trigger on the database or user ?
I'd be surprised at SQL Developer trying to insert data into anything on connect.
I'd suspect code being executed by the database, maybe using a MODULE or PROGRAM from v$session or USERENV / SYS_CONTEXT. -
PLS-00455: cursor 'CUR_1' cannot be used in dynamic SQL OPEN statement
create or replace function f_my_test_func
return refcur_pkg.refcur_t1
is
cur_1 refcur_pkg.refcur_t1;
begin
open cur_1
for
'select * from dept';
return cur_1;
exception
when others
then
insert into ddl_log (SQLTEXT)
values
('fucntion error');
end;I would suggest that cur_1 refcur_pkg.refcur_t1 is a stongly typed ref cursor i.e. it has RETURN dept%ROWTYPE or something similar in the declaration. You can't use strongly typed ref cursors with dynamic SQL in this way. The declaration should be weakly typed or just use sys_refcursor.
DTYLER_APP@pssdev2> DECLARE
2
3 TYPE t_Strong IS REF CURSOR RETURN dual%ROWTYPE;
4
5 lc_Strong t_Strong;
6
7 BEGIN
8
9 OPEN lc_Strong FOR
10 'SELECT * FROM dual';
11
12 END;
13 /
OPEN lc_Strong FOR
ERROR at line 9:
ORA-06550: line 9, column 10:
PLS-00455: cursor 'LC_STRONG' cannot be used in dynamic SQL OPEN statement
ORA-06550: line 9, column 5:
PL/SQL: Statement ignored
DTYLER_APP@pssdev2>
DTYLER_APP@pssdev2> DECLARE
2
3 TYPE t_Weak IS REF CURSOR;
4
5 lc_Weak t_Weak;
6
7 BEGIN
8
9 OPEN lc_Weak FOR
10 'SELECT * FROM dual';
11
12 END;
13 /
PL/SQL procedure successfully completed.
DTYLER_APP@pssdev2> DECLARE
2
3 lc_Weak sys_refcursor;
4
5 BEGIN
6
7 OPEN lc_Weak FOR
8 'SELECT * FROM dual';
9
10 END;
11 /
PL/SQL procedure successfully completed.
DTYLER_APP@pssdev2>HTH
David -
Error in IS_NUMBER Function PL/SQL!!
Hi Experts,
I have a pl/sql function for checking the input is numeber or not and it needs to retrun BOOLEAN value. Here is the code for that,
CREATE OR REPLACE function is_number(in_var in varchar2)
return BOOLEAN
is
v_number number;
begin
if in_var IS NOT NULL THEN
v_number := to_number(in_var);
return TRUE; -- No exception, so is a number
else
return FALSE;
end if;
exception
when others then
RAISE;
end;
When i run the above function,
select is_number('1') from dual;
Its errored out saying,
ORA-06552: PL/SQL: Statement ignored
ORA-06553: PLS-382: expression is of wrong type
Please let me know where i am wrong.
Thanks,
GWrite it in this way:
CREATE OR REPLACE FUNCTION is_number (in_var IN VARCHAR2)
RETURN VARCHAR2
IS
v_number NUMBER;
BEGIN
IF in_var IS NOT NULL
THEN
v_number := TO_NUMBER (in_var);
RETURN 'true'; -- No exception, so is a number
ELSE
RETURN 'FALSE';
END IF;
EXCEPTION
WHEN OTHERS
THEN
RETURN 'false';
END;
SELECT is_number ('d')
FROM DUAL;
false
SELECT is_number ('1')
FROM DUAL;
true- - - - - - - - - - - - - - - - - - - - -
Kamran Agayev A. (10g OCP)
http://kamranagayev.wordpress.com -
Error when running the apxldimg.sql to update the images direct from rel3.0
Hi everyone,
I'm new to APEX. I'm upgrading from v3.0 to v3.1. I'm on the post-installation, section on "Updating the Images Directory When Upgrading from Release 3.0", I ran into error below when running the apxldimg.sql script. Has anyone run into the is error before. If yes, how did you fix it?
Directory created.
filelist_xml xmltype := xmltype(bfilename(upload_directory_name,file_list),nls_charset_id('AL32UTF8'));
ERROR at line 15:
ORA-06550: line 15, column 36:
PLS-00306: wrong number or types of arguments in call to 'XMLTYPE'
ORA-06550: line 15, column 25:
PL/SQL: Item ignored
ORA-06550: line 38, column 15:
PLS-00302: component 'EXISTSRESOURCE' must be declared
ORA-06550: line 38, column 3:
PL/SQL: Statement ignored
ORA-06550: line 52, column 46:
PLS-00320: the declaration of the type of this expression is incomplete or
malformed
ORA-06550: line 52, column 3:
PL/SQL: Statement ignoredMy team member found another post that ran into the same problem and the section is for 11g only. My db is 9.2.0.5.
-
Hi everyone.
Can anyone tell me what is wrong in this code below?
Code:
function NO_DAYSFormula return Number is
begin
IF TO_CHAR(TO_DATE(:P_FR_DT, 'DD-MM-RRRR'), 'RRRR') =TO_CHAR(TO_DATE(:ACCT_OPN_DT, 'DD-MM-RRRR'), 'RRRR')
AND :P_TO_DT<:MATURITY_DATE
AND :ACCT_OPN_DT>:P_FR_DT
THEN RETURN (:P_TO_DT-:ACCT_OPN_DT+1);
ELSIF TO_CHAR(TO_DATE(:P_FR_DT, 'DD-MM-RRRR'), 'RRRR') =TO_CHAR(TO_DATE(:ACCT_OPN_DT, 'DD-MM-RRRR'), 'RRRR')
AND :P_TO_DT<:MATURITY_DATE
AND :ACCT_OPN_DT<:P_FR_DT
THEN RETURN (:P_FR_DT-:P_TO_DT+1);
ELSIF TO_CHAR(TO_DATE(:P_FR_DT, 'DD-MM-RRRR'), 'RRRR') =TO_CHAR(TO_DATE(:ACCT_OPN_DT, 'DD-MM-RRRR'), 'RRRR')
AND :P_TO_DT>:MATURITY_DATE
AND :ACCT_OPN_DT<:P_FR_DT
THEN RETURN (:P_FR_DT-:MATURITY_DATE+1);
END IF;
END;
It gets compiled successfully but when i run the report, i get 2 errors.
Error 1:
REP-1401: 'no_daysformula':Fatal PL/SQL error occurred.
ora-06503: PL/SQL : Function returned without value.
Error 2:
REP-0619: You cannot run without a layout.
Should i use only 1 return statement?
Can i use as many return statements as i want?
What is the exact mistake? Please let me know.
Thank You.Let me clear you the first thing...
If you get any fatal errors while running the report (e.g., function returned without value,no value etc.,) the report will show
REP-0619: You cannot run without a layout.
So you just correct the function 'no_daysformula' .
First of all you run the report without that formula column.
If it works fine then , Check the return value of your formula column (Your formula column properties --> Return value --> value (It will be DATE as i think so).
As function will always return a single value, Check your formula 'no_daysformula' returns the same.
declare a return variable say for example..
DECLARE
V_DATE DATE;
BEGIN
--YOUR CODE---
RETURN V_DATE := (RETURN VALUE)
END;
Last but not least ... use Else condition to return (NULL or any value ) in your code and check..
If any Problem persists let me know
Regards,
Soofi.
Maybe you are looking for
-
Looking for a more universal scripting language than AppleScript or Automator
I want to learn a cross-platform/web scripting language to automate tasks, write scripts and with the potential to create programs and web apps. I am looking for something that: - is not a program with a GUI like Automator, iKey, Quickeys, Maestro...
-
ITunes cannot find the "My music" folder
Whenever I try to open iTunes, it fails to open and instead I get an error message saying "The folder "iTunes" cannot be found or created, and is required. The default location for this folder is inside the "My Music" folder". Last time I used iTunes
-
I upgraded to iOS7 without incident and all has been functioning fine. However, today I am unable to access anything that requires connection. Wifi is strong, and working fine on other devices. Any suggestions?
-
Story Editor greyed out and won't scroll in Indesign 5.5
I have a document that I edited in track changes a month ago. When I open it now, the "Edit in Story Editor" in the edit tab is greyed out. How can I open the story editor panel to see the changes?? I am running Indesign 5.5 on Vista x64.
-
Report Painter/ Report writer
Hi, Can anybody please explain me what is report painter with an example to how to create it if u have any document please forward it to me <REMOVED BY MODERATOR> also please explain me what is characterstics, key figures set and variables, <REMOVED