PL/SQL: ORA-01744: inappropriate INTO
Hi,
Iam pasted this code this error coming ...
any one can help me plz....
select PI.PEN_NUMBER||''(''||(PEN_CAPACITY-(SELECT nvl(SUM(NO_OF_HEAD_IN_PEN),0) from LOT_PEN WHERE PEN_ID=PI.PEN_ID))||'',''||PEN_CAPACITY||'')'' D, PEN_ID R FROM PEN_ID PI'
report error:
ORA-06550: line 1, column 100:
PL/SQL: ORA-01744: inappropriate INTO
ORA-06550: line 1, column 7:
PL/SQL: SQL Statement ignored
Yes you can:
CREATE TABLE PEN_ID ( PEN_NUMBER NUMBER, PEN_CAPACITY NUMBER, PEN_ID NUMBER PRIMARY KEY );
CREATE TABLE LOT_PEN ( NO_OF_HEAD_IN_PEN NUMBER, PEN_ID NUMBER PRIMARY KEY );
SELECT pi.pen_number || '(' || (pen_capacity - (SELECT nvl(SUM(no_of_head_in_pen)
,0)
FROM lot_pen
WHERE pen_id = pi.pen_id))
|| ',' || pen_capacity || ') ' d
,pen_id r
FROM pen_id pi;
0 rows selected.However, are you trying to use this in PL/SQL? and getting PLS-00427: an INTO clause is expected in this SELECT statement ?
I'm confused why you have two single quotes rather than one throughout and a trailing quote at the end, is this dynamic SQL? is there some other context of which you are not making us aware?
Similar Messages
-
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 -
Error -ora-01744 ( Inappropriate INTO )
Hi
Is it possible to select a record and than insert into another table in stored procedure (9i).
The same query works. But it shows error in procedure ora-01744
create or replace procedure SELECT_INSERT
is
dept_deptid number;
dept_deptname varchar2(20);
begin
INSERT INTO DEPT (SELECT DEPTID,NAME INTO dept_deptid,dept_deptname from department);
end SELECT_INSERT;
ThanksRemove paranthesis
INSERT INTO DEPT
SELECT DEPTID,NAME
from department; -
PL/SQL: ORA-22806: not an object or REF when Using Record in Package
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0
I have declared a record type in my package
create or replace
PACKAGE MYPKG AS
TYPE MYREC IS RECORD (VAL1 varchar2(20), val2 date);
PROCEDURE display_error (pSQLERRM number);
PROCEDURE P_LOAD_DATA (pStartDate Date, pEndDate Date);
FUNCTION F_EPI(refno1 in NUMBER, refno2 in NUMBER) return MYREC;
END MYPKG;
--In My Package Body
FUNCTION F_EPI(refno1 in NUMBER, refno2 in NUMBER) return MYREC is
F_param MYREC;
BEGIN
select myvarchar2, mydate into MYREC from MYTable
where myrefno1 = refno1
and myrefno2 = refno2
Exception
when others then
display_error(SQLERRM);
RETURN F_param;
END F_EPI ;
PROCEDURE P_LOAD_DATA (pStartDate Date, pEndDate Date) IS
insert into atable(myvarchar, mydate)
select F_EPI(refno1,refno2).val1,F_EPI(refno1,refno2).val2 from tab2;
END P_LOAD_DATA;
I get errors
Error(187,7): PL/SQL: SQL Statement ignored
Error(225,7): PLS-00382: expression is of wrong type
Error(225,7): PL/SQL: ORA-22806: not an object or REF
When I compile the package.
When I try to call the function from SQL I get an Invalid datatype error.Hi,
Before posting any query/plsql blocks, please ensure that you have written it clean and complete with less syntax errors. ( at least general syntax errors, you can avoid). Then somebody can have an interest to check your logical error.
About your posting, refer below solution step-by-step. It may help you, about what you are looking for? By the way, you must be knowing, what you are going to to do with. I haven't concentrated about your requirement; as it was not missing in your posting.
drop table test;
create table test(myvarchar varchar2(20), mydate date);
create or replace
package mypkg as
type myrec is record (val1 varchar2(20), val2 date);
--procedure display_error (psqlerrm in number); -- if you are passing sqlerrm, then parameter needs to be string type
procedure display_error (psqlerrm in varchar2);
procedure p_load_data (pstartdate in date, penddate in date);
function f_epi(refno1 in number, refno2 in number) return myrec;
end mypkg;
Package created.
--in my package body
create or replace
package body mypkg as -- added
procedure display_error (psqlerrm in varchar2) -- if you are declared a proc/func in spec, it needs to define in pkg body
is
begin
null; -- you should know, what to do here
dbms_output.put_line('Err -'||sqlerrm);
end display_error;
function f_epi(refno1 in number,refno2 in number)
return myrec
is
f_param myrec;
begin
-- select myvarchar2, mydate into MYREC from mytable
-- where myrefno1 = refno1
-- and myrefno2 = refno2;
select ename, hiredate into f_param from emp -- added demo logic by using emp
where empno = refno1
and mgr = refno2;
return f_param; -- added
exception
when others then
raise; -- if you are using OTHERS then, just raise it
display_error(sqlerrm);
--return f_param; -- what is this?
end f_epi;
procedure p_load_data (pstartdate in date, penddate in date) -- you must be knowing the use of 2 params ???
is
v_rec myrec; -- added
begin -- Added
--insert into atable(myvarchar, mydate)
-- select f_epi(refno1,refno2).val1,f_epi(refno1,refno2).val1 from tab2;
-- demo logic added with static params to call f_epi
v_rec:= f_epi(7499,7698);
insert into test values v_rec;
--null;
end p_load_data;
end mypkg;
Package body created.
SQL> exec mypkg.p_load_data(null,null);
PL/SQL procedure successfully completed.
SQL> select * from test;
MYVARCHAR MYDATE
ALLEN 20-FEB-81
Thanks! -
PL/SQL: ORA-00984: column not allowed here
I am Trying to compile this procedure, but i get error, could please anybody help me out.
Thanks.
SQL> create or replace procedure FOF_sport_setup(
2 v_model_cd in varchar2, -- model_cd used in many place
3 v_portfolio_name in varchar2, -- portfolio name
4 v_src_acct_nbr in varchar2, -- source account number for port
5 v_src_fund_nbr in varchar2, -- source fund number
6 v_fmr_fund_nbr in varchar2, -- fidelity fund number
7 v_src_cd in varchar2, -- source code
8 v_last_mod_id in varchar2 -- your corp id
9 )
10 as
11 v_new_portf_id number(12);
12
13 begin
14
15 select max(portf_id) into v_new_portf_id from portfolios;
16
17 insert into portfolios
18 (portf_id,
19 portf_cd,
20 portf_name,
21 portf_typ_cd,
22 inception_date,
23 sub_product_cd,
24 product_cd,
25 product_line_cd,
26 bus_line_cd,
27 dly_perf_restr_ind,
28 portf_mgr_id,
29 seed_acct_nbr,
30 use_epas_ind,
31 epas_drop_perf_ind,
32 src_acct_nbr,
33 src_fund_nbr,
34 fmr_fund_nbr,
35 src_cd,
36 last_mod_id,
37 last_mod_dt)
38 values
39 (new_portf_id,
40 v_model_cd,
41 v_portfolio_name,
42 "RETAIL",
43 v_inception_date,
44 "FREE",
45 "FREE",
46 "FREE",
47 "PAS",
48 "Yes",
49 3,
50 "31635C101",
51 "N",
52 "Y",
53 v_src_acct_nbr,
54 v_src_fund_nbr,
55 v_fmr_fund_nbr,
56 v_src_cd,
57 v_last_mod_id,
58 sysdate);
59
60 end;
61 /
Warning: Procedure created with compilation errors.
SQL> show errors procedure FOF_sport_setup
Errors for PROCEDURE FOF_SPORT_SETUP:
LINE/COL ERROR
17/2 PL/SQL: SQL Statement ignored
51/3 PL/SQL: ORA-00984: column not allowed here
SQL>create or replace procedure FOF_sport_setup(
v_model_cd in varchar2, -- model_cd used in many places for portf_id,
v_portfolio_name in varchar2, -- portfolio name
v_inception_date in varchar2,
v_src_acct_nbr in varchar2, -- source account number for portfolio table in sport db
v_src_fund_nbr in varchar2, -- source fund number
v_fmr_fund_nbr in varchar2, -- fidelity fund number
v_src_cd in varchar2, -- source code
v_last_mod_id in varchar2 -- your corp id
as
v_new_portf_id number(12);
begin
select max(portf_id) into v_new_portf_id from portfolios;
insert into portfolios
(portf_id,
portf_cd,
portf_name,
portf_typ_cd,
inception_date,
sub_product_cd,
product_cd,
product_line_cd,
bus_line_cd,
dly_perf_restr_ind,
portf_mgr_id,
seed_acct_nbr,
use_epas_ind,
epas_drop_perf_ind,
src_acct_nbr,
src_fund_nbr,
fmr_fund_nbr,
src_cd,
last_mod_id,
last_mod_dt)
values
(v_new_portf_id,
v_model_cd,
v_portfolio_name,
'RETAIL',
to_date('v_inception_date'),
'FREE',
'FREE',
'FREE',
'PAS',
'Yes',
3,
'31635C101',
'N',
'Y',
v_src_acct_nbr,
v_src_fund_nbr,
v_fmr_fund_nbr,
v_src_cd,
v_last_mod_id,
sysdate);
end;
=====================
The procedure got created without any errors, when i am trying to execute the procedure i am getting errors.
this is the parameters which i am passing:
exec FOF_sport_setup('01213', 'PAS International Fund of Funds', '2/15/2006', '01213', 'IFOFB', 'IFOFB', 'FPCMS', 'a382077')
SQL> exec FOF_sport_setup('01213', 'PAS International Fund of Funds', '2/15/2006', '01213', 'IFOFB',
'IFOFB', 'FPCMS', 'a382077')
BEGIN FOF_sport_setup('01213', 'PAS International Fund of Funds', '2/15/2006', '01213', 'IFOFB', 'IF
ERROR at line 1:
ORA-01858: a non-numeric character was found where a numeric was expected
ORA-06512: at "SPORT.FOF_SPORT_SETUP", line 15
ORA-06512: at line 1
===============
the description for the table is below
===========
SQL> desc portfolios
Name Null? Type
PORTF_ID NOT NULL NUMBER(25)
PORTF_CD VARCHAR2(10)
PORTF_NAME VARCHAR2(60)
STRATEGY_CD VARCHAR2(10)
CO_STOCK_LEV_CD VARCHAR2(10)
EFF_DATE DATE
PORTF_WEB_NAME VARCHAR2(60)
PORTF_TYP_CD VARCHAR2(10)
INCEPTION_DATE DATE
CLOSE_DATE DATE
SUB_PRODUCT_CD VARCHAR2(10)
PRODUCT_CD VARCHAR2(10)
PRODUCT_LINE_CD VARCHAR2(10)
BUS_LINE_CD VARCHAR2(10)
BUS_GRP_CD VARCHAR2(10)
PLAN_CD VARCHAR2(10)
ADVISOR_CD VARCHAR2(10)
RISK_LEVEL_CD VARCHAR2(10)
DLY_PERF_RESTR_IND VARCHAR2(3)
SUB_PORTF_IND CHAR(1)
PORTF_MGR_ID NUMBER(25)
SEED_ACCT_NBR VARCHAR2(9)
OBJECTIVE VARCHAR2(255)
PORTF_COMPOSITION_DESC VARCHAR2(50)
LGL_GRP VARCHAR2(30)
USE_EPAS_IND VARCHAR2(3)
EPAS_MODEL_NAME VARCHAR2(50)
EPAS_DROP_PERF_IND VARCHAR2(3)
SRC_ACCT_NBR VARCHAR2(15)
SRC_FUND_NBR VARCHAR2(6)
FMR_FUND_NBR VARCHAR2(6)
NET_ASSETS NUMBER(25,8)
SEED_MKT_VAL NUMBER(25,10)
ACCT_MKT_VAL NUMBER(25,10)
TOTAL_ASSETS NUMBER(25,10)
NET_OTHER_ASSETS NUMBER(25,8)
ACCRUED_INCOME NUMBER(25,10)
ACCRUED_INTEREST NUMBER
LIABILITIES NUMBER(25,10)
SHARES_OUTSTANDING NUMBER(25,10)
PRINCIPAL_CASH NUMBER(25,10)
INCOME_CASH NUMBER(25,10)
INVESTIBLE_CASH NUMBER(25,10)
SHIP_DATE DATE
REBALANCE_IND CHAR(1)
OUTBOUND_IND VARCHAR2(5)
LGL_MSG_CD CHAR(1)
LAST_SETTLE_DATE DATE
LAST_TRD_DATE DATE
LAST_ALLOC_DATE DATE
STATUS_CD CHAR(1)
SRC_CD NOT NULL VARCHAR2(5)
LAST_MOD_ID NOT NULL VARCHAR2(10)
LAST_MOD_DT NOT NULL DATE
PORTF_MGD_CD VARCHAR2(10)
========== -
PL/SQL: ORA-00932: inconsistent datatypes: expected UDT got NUMBER
Hi all,
Wondering if you could assist? I'm exploring User Types and having a small problem. I'm getting the above error for a user type I have created which I'm calling in a function. Here's what my code looks like which I'm running the 'scott' schema for testing purposes
SQL> CREATE OR REPLACE TYPE NBR_COLL AS TABLE OF NUMBER;
2 /
Type created.
SQL> create or replace FUNCTION first_rec_only
2 (
3 NUM_ID IN NUMBER
4 ) RETURN NUMBER IS
5 v_num NBR_COLL;
6 BEGIN
7 select deptno into v_num from dept;
8 RETURN v_num(v_num.FIRST);
9 END first_rec_only;
10 /
Warning: Function created with compilation errors.
SQL> show errors
Errors for FUNCTION FIRST_REC_ONLY:
LINE/COL ERROR
7/4 PL/SQL: SQL Statement ignored
7/11 PL/SQL: ORA-00932: inconsistent datatypes: expected UDT got
NUMBER
SQL>
Any clues to what I'm doing wrong? Cheers.The deptno column is a number, you cannot directly select a number into your type, you need to use your type's constructor.
Something like:
CREATE OR REPLACE FUNCTION first_rec_only (NUM_ID IN NUMBER) RETURN NUMBER IS
v_num NBR_COLL;
BEGIN
SELECT nbr_coll(deptno) INTO v_num from dept;
RETURN v_num(v_num.FIRST);
END first_rec_only;Note that although this will compile, it will throw ORA-01422: exact fetch returns more than requested number of rows when you run it. you need to either use the input parameter as a predicate on your query against dept, use rownum = 1 in the query or use bulk BULK COLLECT INTO, depending on what exactly you want to accomplish.
John -
PL/SQL ORA-00936 missing expression
Hello all,
I'm having an issues and need help with this script... Please help, thanks.
error:
====
31 32 /
AST_UPDATED_BY,LAST_UPDATE_LOGIN) values(i,'ERROR_LOG_ID'||i, 'PROCEDURE_NAME'||i||, 'REQUEST_ID' |i||, 'PROCESS_NAME' ||i||, 'ERROR_TYPE'|i|, 'MESSAGE_DETAILS' ||i||, 'ERROR_TIMESTAMP' |i|, 'STATUS' ||i||, 'CREATED_BY' ||i||, 'CREATION_DATE' ||i||, "to_char(last_update_date, 'dd-Mon-yyyy hh:mi:ss')" |i|, 'LAST_UPDATED_BY' ||i||, 'LAST_UPDATE_LOGIN');
ERROR at line 28:
ORA-06550: line 28, column 84:
PL/SQL: ORA-00936: missing expression
ORA-06550: line 27, column 1:
PL/SQL: SQL Statement ignored
script.
====
declare
CURSOR c_iostats IS
SELECT * from XXFRO.XXFRO_ERRORS;
ERROR_LOG_ID NUMBER;
PROCESS_NAME VARCHAR2(50);
ERROR_TYPE VARCHAR2(20);
STATUS VARCHAR2(20);
MESSAGE_DETAILS VARCHAR2(2000);
ERROR_LOG_ID NUMBER;
PROCEDURE_NAME VARCHAR2(50);
REQUEST_ID NUMBER;
PROCESS_NAME VARCHAR2(50);
ERROR_TYPE VARCHAR2(20);
MESSAGE_DETAILS VARCHAR2(2000);
ERROR_TIMESTAMP DATE;
STATUS VARCHAR2(20);
CREATED_BY NUMBER;
CREATION_DATE DATE;
LAST_UPDATE_DATE DATE;
LAST_UPDATED_BY NUMBER;
LAST_UPDATE_LOGIN NUMBER;
Begin
for i in 1..1000000 LOOP
insert into IO_TEST(ERROR_LOG_ID
,PROCEDURE_NAME
,REQUEST_ID
,PROCESS_NAME
,ERROR_TYPE
,MESSAGE_DETAILS
,ERROR_TIMESTAMP
,STATUS,CREATED_BY
,CREATION_DATE
,LAST_UPDATE_DATE
,LAST_UPDATED_BY
,LAST_UPDATE_LOGIN)
values(i,'ERROR_LOG_ID'||i, 'PROCEDURE_NAME'||i||, 'REQUEST_ID' |i||, 'PROCESS_NAME' ||i||, 'ERROR_TYPE'|i|, 'MESSAGE_DETAILS' ||i||, 'ERROR_TIMESTAMP' |i|, 'STATUS' ||i||, 'CREATED_BY' ||i||, 'CREATION_DATE' ||i||,'LAST_UPDATE_DATE' ||i||, 'LAST_UPDATED_BY' ||i||, 'LAST_UPDATE_LOGIN');
END LOOP;
end;
Thanks,
HCDBAHi,
Why are you using the concat(||) Symbol after i in the expression String 'CREATED_BY' ||i||. When you are padding between
two text we use so.
Ex: If you want to concat 'i' between String we use
DBMS_OUTPUT.PUT_LINE('Five is between '|| i || 'and Six');The Insert Statement should be re-written as
INSERT INTO io_test
(error_log_id, procedure_name, request_id,
process_name, ERROR_TYPE, message_details,
error_timestamp, status, created_by,
creation_date, last_update_date,
last_updated_by, last_update_login
VALUES (i, 'ERROR_LOG_ID' || i, 'PROCEDURE_NAME' || i,
'REQUEST_ID' || i, 'PROCESS_NAME' || i, 'ERROR_TYPE' || i,
'MESSAGE_DETAILS'
|| i, 'ERROR_TIMESTAMP' || i, 'STATUS' || i,
'CREATED_BY' || i, 'CREATION_DATE' || i,
'LAST_UPDATE_DATE' || i, 'LAST_UPDATED_BY' || i,
'LAST_UPDATE_LOGIN'
);Thanks,
Shankar -
PL/SQL: ORA-00942: table or view does not exist
Hi
i have logged into my schema and trying to access the database "DAD" which has the table name "SCHOOL"
i wrote a function which should give me new_sno when i give it the old_sno
and i have this errors , pls help
CREATE OR REPLACE FUNCTION ORIG_SN(OSNO in Number,OTN in Number)
RETURN Number IS
NEW_SNO Number:=0;
BEGIN
SELECT new_sno AS NEW_SNO
FROM DAD.SCHOOL
WHERE ORIG_SNO = OSNO AND ORIG_TN = OTN;
RETURN NEW_SNO;
END ORIG_SN;
Warning: Function created with compilation errors.
Errors for FUNCTION ORIG_SN:
LINE/COL ERROR
5/1 PL/SQL: SQL Statement ignored
6/15 PL/SQL: ORA-00942: table or view does not exist
Thanks in advance ..Try this,
CREATE VIEW SCHOOL_VIEW AS SELECT * FROM DAD.SCHOOL;and then change your function like
CREATE OR REPLACE FUNCTION ORIG_SN(OSNO in Number,OTN in Number)
RETURN Number IS
my_new_sno Number:=0;
BEGIN
SELECT new_sno INTO my_new_sno FROM SCHOOL_VIEW WHERE ORIG_SNO = OSNO AND ORIG_TN = OTN;
RETURN my_new_sno;
END ORIG_SN;and see if it is getting created without any errors.
-Arun
Edited by: Arunkumar Ramamoorthy on Aug 15, 2009 1:56 AM -
PL/SQL: ORA-04052: error occurred when looking up remote object.
Hi All,
I'm getting the following error message while executing a PL/SQL Block.
PL/SQL: ORA-04052: error occurred when looking up remote object UPLDUSER.filestatushistory@FTS
ORA-00604: error occurred at recursive SQL level 1
ORA-03106: fatal two-task communication protocol error
ORA-02063: preceding line from FTSStatement
declare
v_coun number;
begin
select count(*) into v_coun
from updluser.filestatushistory@fts;
end;Back ground of the situation as follows,
My DataBase version 10.2.0.3 DB Name :DB1
Table Owner : UPLDUSER
Table Name : FILESTATUSHISTORY
I have a report user on the same database and I have grant all on the above table to report user
Report User : RPT_FTS
SQL> GRANT ALL ON FILESTATUSHISTORY_V TO RPT_FTS;Now Please find the below database details where I'm getting subjected error.
Database version : 9.2.0.8
DB Name : DB2
User Name : RPT_REPORTS
I Have create a dblink from RPT_REPORTS to RPT_FTS on DB1 and the dblink works fine. But getting the above error while running it.
but When I do the same other 10.2.0.3 db , the above PL/SQL block works fine without any problem.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Now the strange about this is that I have Created a new table on DB1 db like below;
SQL> CREATE TABLE UPLDUSER.ABC AS SELECT * FROM FILESTATUSHISTORY;and retry my code on DB2 (9.2.0.8) after changing the table to ABC and it worked. Now I don't know whats wrong with a original table(FILESTATUSHISTORY).
To over come the problem and a work-a-round method I create a view on the DB1 (RPT_FTS) like the below
SQL> CREATE VIEW FILESTATUSHISTORY AS SELECT * FROM UPLDUSER.FILESTATUSHISTORY;and was able to run the PL/SQL block Remotely.
Just wants To know what whould have been the cause for this .
Cheers
KanchanaHi Kanchana,
Perhaps following link of google search has answer to your query
ORA-04052. The search result contains some useful articles whose URLs I shan't post in the forums.
HTH!
*009* -
Hi,
I have a package body as given below
CREATE OR REPLACE PACKAGE BODY DF AS
FUNCTION T24_GetCOPYBatchKeyAndDate(RECKEY VARCHAR2)
RETURN RTNVAL
IS
RTNVAL1 RTNVAL;
DELPOS INTEGER;
LISTSTRING VARCHAR2(4000);
BEGIN
SELECT XMLRECORD INTO LISTSTRING FROM V_F_RO_COPY_KEYLIST WHERE RECID = RECKEY;
LISTSTRING := TRIM(LISTSTRING);
WHILE LENGTH(LISTSTRING) <> 0
LOOP
DELPOS := INSTR(LISTSTRING, ' ');
IF DELPOS = 0 THEN
DELPOS := LENGTH(LISTSTRING) + 1;
END IF;
--SELECT SUBSTR(LISTSTRING, 9, DELPOS - 9) INTO RTNVAL FROM DUAL;
SELECT TO_DATE(SUBSTR(LISTSTRING, 1, 8),'YYYYMMDD'), SUBSTR(LISTSTRING, 9, DELPOS - 9) INTO RTNVAL1 FROM DUAL;
LISTSTRING := SUBSTR(LISTSTRING, DELPOS+1, LENGTH(LISTSTRING)-DELPOS);
END LOOP;
RETURN(RTNVAL1);
END T24_GetCOPYBatchKeyAndDate;
END DF;
but i get compilation errors below is the error can anyone let me know whats the exact problem here and earlier i used this fucntion as PIPILINED and PIPE_ROW(RTNVAL).
It was working fine now i wanted to test this without pipeline fucntion.
SQL> SHOW ERRORS;
LINE/COL ERROR
19/5 PL/SQL: SQL Statement ignored
19/105 PL/SQL: ORA-00947: not enough values
SQL>Now...if you do a BULK inside the loop, then the collection get's overwritten every loop iteration.
So going back to the original post
replacing
WHILE LENGTH(LISTSTRING) <> 0
LOOP
DELPOS := INSTR(LISTSTRING, ' ');
IF DELPOS = 0 THEN
DELPOS := LENGTH(LISTSTRING) + 1;
END IF;
SELECT TO_DATE(SUBSTR(LISTSTRING, 1, 8),'YYYYMMDD'), SUBSTR(LISTSTRING, 9, DELPOS - 9)) INTO RTNVAL1 FROM DUAL;
LISTSTRING := SUBSTR(LISTSTRING, DELPOS+1, LENGTH(LISTSTRING)-DELPOS);
END LOOP;
with
WHILE LENGTH(LISTSTRING) <> 0
LOOP
DELPOS := INSTR(LISTSTRING, ' ');
IF DELPOS = 0 THEN
DELPOS := LENGTH(LISTSTRING) + 1;
END IF;
RTNVAL1.EXTEND();
RTNVAL1(RTNVAL1.COUNT()) := DATEKEYPAIR(TO_DATE(SUBSTR(LISTSTRING, 1, 8),'YYYYMMDD')
, SUBSTR(LISTSTRING, 9, DELPOS - 9));
LISTSTRING := SUBSTR(LISTSTRING, DELPOS+1, LENGTH(LISTSTRING)-DELPOS);
END LOOP;
should help
hth -
I have a PL/SQL script processing information between Oracle database and MySQL database. My script ran perfectly with DG4ODBC 11.1.0.7. Then we upgraded Oracle to 10.2.0 and DG4ODBC 11.2.0.2. Now if I run my script from Solaris command line like ./myscript.shl, I get the following errors:
PL/SQL: ORA-00904: "cmswhit_moodle1"."mdl_grade_grades"."finalgrade": invalid identifier
PL/SQL: ORA-00904: "cmswhit_moodle1"."mdl_question_states"."attempt": invalid identifier
The strange thing is if I run the same query by cut and paste into sqlplus from command line, the query works perfectly without any problems.
What is the cause of this problem?
Any help would be greatly appreciated.
JeffreyHi Klaus,
The problem was solved after I updated MySQL ODBC to a new version from 5.1.8 to 5.1.13.
Summary of the problem and its solution:
The Problem: It appears that dg4odbc 11.2.0.2 requires a newer version of MyODBC. Previously I used MyODBC 5.1.8 which ran into problems with dg4odbc 11.20.0.2.
The Solution: After I updated MyODBC to 5.1.13, my PL/SQL scripts all work.
I need to point out that with MyODBC 5.1.8, I can run queries and updates from SQL*Plus console, but now PL/SQL scripts.
I'll close this thread.
Once again, thank you and happy holidays.
Jeffrey -
PL/SQL: ORA-00932: inconsistent datatypes: expected REF got CHAR
SQL> desc o.rel_module;
Name Null? Type
ID NOT NULL NUMBER(6)
TYPE NOT NULL CHAR(7)
BUILDDATE NOT NULL NUMBER(4)
DESIGNROOT NOT NULL NUMBER(6)
SQL> desc rel_module
Name Null? Type
ID NOT NULL NUMBER(6)
DESIGNROOT NOT NULL NUMBER(6)
REL_COMPOSITEPARTS REL_COMPOSITEPART_TAB
SQL> desc REL_COMPOSITEPART_TAB
REL_COMPOSITEPART_TAB TABLE OF REL_COMPOSITEPART
SQL> desc REL_COMPOSITEPART
Name Null? Type
TYPE CHAR(7)
BUILDDATE NUMBER(4)
SQL> create or replace procedure rel_module_p
2 as
3 cursor c is select ID, TYPE, BUILDDATE, DESIGNROOT from o.rel_module;
4 begin
5 FOR i in c
6 LOOP
7 INSERT into rel_module(id,REL_CompositeParts,DESIGNROOT)
Values (i.ID,REL_CompositePart_TAB(i.type,i.builddate), i.designroot);
8 END LOOP;
9 END;
10 /
Warning: Procedure created with compilation errors.
SQL> show err
Errors for PROCEDURE REL_MODULE_P:
LINE/COL ERROR
7/1 PL/SQL: SQL Statement ignored
7/93 PL/SQL: ORA-00932: inconsistent datatypes: expected REF got CHAR
Can you please tell me where needs correction.801556 wrote:
Can you please tell me where needs correction.Just a fix would be:
create or replace procedure rel_module_p
as
cursor c is select ID, TYPE, BUILDDATE, DESIGNROOT from o.rel_module;
begin
FOR i in c
LOOP
INSERT into rel_module(id,REL_CompositeParts,DESIGNROOT)
values (i.ID,REL_CompositePart_TAB(REL_COMPOSITEPART(i.type,i.builddate)), i.designroot);
END LOOP;
END;
/However, I'd assume what you want is:
create or replace procedure rel_module_p
as
cursor c is select ID,CAST(COLLECT(REL_COMPOSITEPART(TYPE,BUILDDATE)) AS REL_CompositePart_TAB) REL_COMPOSITEPARTS, DESIGNROOT
from rel_module
group by id,DESIGNROOT;
begin
FOR i in c
LOOP
INSERT into rel_moduleX(id,REL_CompositeParts,DESIGNROOT)
values (i.ID,i.REL_COMPOSITEPARTS, i.designroot);
END LOOP;
END;
/SY. -
PL-SQL-ORA-01704 - String literal too long
Hello guyz;
I am trying to store a value of over 4000 character long in a CLOB column and I got the error message that says "PL-SQL-ORA-01704 - String literal too long".
What can I do to overcome this challenge?
Thanking you for your usual support.sb92075 wrote:
Problem Exists Between Keyboard And Chair
We can't say what you are doing wrong since we don't know specifically what you actually do.Okay let me put it down this way.
I have an application using SQL Server as d backend engine & now, the user wants to migrate to Oracle. I now wrote a mini-program to create a schema/user in oracle with the schema/database (being used by the app) from SQL server. I verified the structure very well & every is just fine. Now, data migration (from SQL Server to Oracle).
I was able to move most tables data successfully without issue until I attempted to load a table which has a column (in SQL defined as text with over 4000 (var)chars/CLOB in Oracle). On moving a particular row to oracle db (after few rows have already been INSERTed into this particular table x), I got that err msg.
After battling with that for a while, I concluded to make d (DataMigrator) app take just d first 4000 string - only if the value in that field value length > 4000. This worked perfectly without issue but you know the implication - Data lost.
Do I need to switch something on/off in Oracle that expands the CLOB default maximum field size? Because I foresee this happening as soon as the application (that would now sit on Oracle) is now in use.
If you still don't understand this, I don't know how beta 2 explain this!
Edited by: aweklin on Mar 17, 2013 8:25 AM
Edited by: aweklin on Mar 17, 2013 8:25 AM
Edited by: aweklin on Mar 17, 2013 8:27 AM
Edited by: aweklin on Mar 17, 2013 8:27 AM -
Error(20,22): PL/SQL: ORA-00942: table or view does not exist
I am getting currently getting an error when I try and insert into a table from a different schema from my Stored Procedure:
Error(20,22): PL/SQL: ORA-00942: table or view does not exist
I am explicitly calling the table with the schema name infront i.e.
INSERT INTO SAPSR3.ZTREC_NAME_TYPE
MASTER_ID,
NAME_TYPE,
FAMILY_NAME,
FIRST_NAME,
MIDDLE_NAME,
TITLE
VALUES
In_MasterID,
In_NameType,
In_FamilyName,
In_FirstName,
In_MiddleName,
In_Title
I only get this error when I try and compile my stored procedure. If I try this insert not within a stored procedure (i.e. a blank script) it works perfectly.
Can anyone tell me what Im doing wrong?
Thanks.Hi,
It sounds like you (the procedure owner) have privileges on that table only through a role.
Roles don't count in stored procedures created with AUTHID OWNER (which is the default).
Either
(1) Have user SAPSR3 grant the necessary privileges directly to you (or to PUBLIC), or
(2) change the procedure so that it runs with the caller's privileges, by adding AUTHID CURRENT_USER after the argument list but before the keyword IS (os AS) like this:
CREATE OR REPLACE PROCEDURE foo
( x IN NUMBER
AUTHID CURRENT_USER
IS ... -
Hi
We are trying to create database trigger on update of table HZ_CUSTOMER_PROFILES when CREDIT_HOLD='Y'
If this update is done from certain operating unit we are inserting into another custom table when compiling trigger we are getting error as given below
LINE/COL ERROR
5/2 PL/SQL: SQL Statement ignored
17/2 PL/SQL: ORA-00936: missing expression
SQL> l 5
5*
SQL> l 17
17* COUNTRY,
Copying code used for creating trigger
CREATE OR REPLACE TRIGGER "APPS"."SDS_CREDIT_HOLD_ROW"
BEFORE UPDATE ON HZ_CUSTOMER_PROFILES
FOR EACH ROW
WHEN ( new.CREDIT_HOLD='Y')
BEGIN
IF FND_PROFILE.VALUE('ORG_ID')=3217 THEN
INSERT INTO SDS.SDS_CREDIT_HOLD
(CUSTOMER_NAME,
CUSTOMER_NUMBER,
ADDRESS,
CITY,
COUNTRY,
HOLD_BY,
MAIL_LIST1,
RESP_VALUE,
ORG_ID,
MAIL_LIST2)
VALUES
(select rc.customer_name,
rc.customer_number,
ra.address1,
ra.city,
ra.country,
fu.user_name,
fu.email_address,
TO_NUMBER(FND_GLOBAL.RESP_ID),
TO_NUMBER(fnd_profile.value('ORG_ID')),
SDS_EMAIL_ADD_FNC('KAMALAKAR.GUDAPAREDDI,BRIAN.MILLER')
from HZ_CUSTOMER_PROFILES hcp, ra_site_uses rsa,
ra_addresses ra, ra_customers rc, fnd_user fu,
(select distinct site_use_id from HZ_CUST_SITE_USES where site_use_code='BILL_TO'
and status='A') site_acct
where hcp.status='A'
and cust_account_id in (select distinct cust_account_id from HZ_CUSTOMER_PROFILES
where credit_hold='Y'
and status='A')
and hcp.site_use_id=rsa.site_use_id (+)
and rsa.address_id=ra.address_id (+)
and rsa.site_use_id= site_acct.site_use_id (+)
and hcp.cust_Account_id=rc.customer_id
and hcp.credit_hold='Y'
and hcp.last_updated_by=fu.user_id
and hcp.CUST_ACCOUNT_PROFILE_ID=:new.CUST_ACCOUNT_PROFILE_ID
and hcp.ROWID=:new.ROWID);
END IF;
-- commit;
END SDS_CREDIT_HOLD_ROW;
tried to search for fix in forums checked all columns in select clause and insert they appear to be fine attaching table structure also for reference
CREATE TABLE SDS_CREDIT_HOLD
(CUSTOMER_NAME VARCHAR(50),
CUSTOMER_NUMBER VARCHAR2(30),
ADDRESS VARCHAR2(240),
CITY VARCHAR2(60),
COUNTRY VARCHAR2(60),
HOLD_BY VARCHAR2(100),
MAIL_LIST1 VARCHAR2(240),
RESP_VALUE NUMBER,
ORG_ID NUMBER,
MAIL_LIST2 VARCHAR2(240))
if any hint for fixing this issue it will be highly appreciated
Thanks
Kamalakar.GProblem is here:
WHEN ( new.CREDIT_HOLD='Y')
Should be using a colon in front of any new or old columns in your PL/SQL and SQL, thus try this:
WHEN ( :new.CREDIT_HOLD='Y')
FYI: when using triggers (unless you specify otherwise in the trigger definition itself):
old values are referenced via :old.column and new values via :new.column
Maybe you are looking for
-
hi my iph4s wont turn on or off and seems to be zoomed into a particular part of the screen, loads normally when rebooted the phone. what is wrong with it? and how would i go abouts fixing it? also recovery mode shows up as a red icon instead of a bl
-
help me got and ipod but says disembled connect to itunes. plugged into computer made acct. for me but nothing,help need for new job. thanks
-
Bug??? AutoSuggestBehavior in an editableTable in 11.1.1.4
Not sure if it happened in the previous versions, but in Jdeveloper 11.1.1.4, the autoSuggestBehavior doesn't seem to work correctly in editable tables. So, I have an editable table (editingMode="editAll"), and an inputListOfValues with autoSuggestBe
-
My speakers are not workiing on my 4 month old laptop computer
how do i get my speakers on my new laptop to start working again without loseimg new files .
-
Photoshop Elements 6 Testversion Problem
Gestern habe ich mit die Testversion von Photoshop Elements 6.0 von der Adobe Homepage heruntergeladen. Möchte ich das Programm nun öffnen, erscheint folgende Meldung: "Problem mit Testversion. Beim Laden des Testzeitraums für Adobe Photoshop Element