Ora-00917 missing right paranthesis
hi,
pls help me to find the error in this query
INSERT INTO champ.case_worker
(case_worker_id,
primary_role_id,
worker_name,
initials,
short_name,
mainframe_id,
worker_status_code)
VALUES
(champ.case_worker_id_seq,
14,
IRTS (Issue Resolution Tracking System),
IRTS,
IRTS,
IRTS)
Message was edited by:
user596307
Sometimes the SQL compiler will shamelessly, well, lie to you about what the problem is. The missing "(" error is something that may have nothing whatsoever to do with the cited problem but some other structural problem
Similar Messages
-
ORA-00907 MISSING RIGHT PARANTHESIS
Dear all,
The query
FLASHBACK TABLE schema.table_name TO TIMESTAMP('18-JAN-2008 18:55:58','DD-MON-YYYY HH24:MI:SS');
gives me the error
ORA-00907 MISSING RIGHT PARANTHESIS
WHAT AM MISSING HERE ?
kAIPretty much the usual
You grossly violate forums etiquette by
- not posting a version and a platform
- not looking up the error message
- not verifying syntax
- by SHOUTING most of your question
in short you demonstrate you are utterly lazy and utterly rude.
Doing so, you have now entered as a runner up in the competition to qualify for the biggest abuser of this forum by not doing anything yourself.
Yes, I know you will be angry. And why will you be angry? Because I state the truth!
People like you should be banned from this forum completely.
Sybrand Bakker
Senior Oracle DBA -
Hi,
I'm trying to extract schema DDL from a database (10.2.0.4.0 - 64bit Enterprise Edition on Solaris 10). I run the query below and get an ORA-00907: missing right parenthesis error.
SELECT DBMS_METADATA.GET_DDL( REPLACE(object_type,' ','_') AS object_type, object_name) FROM user_objects WHERE object_type NOT IN ('TABLE_PARTITION','INDEX_PARTITION','LOB');
This is the output when running the above in sqlplus worksheet
select DBMS_METADATA.GET_DDL( REPLACE(object_type,' ','_') as object_type, object_name) FROM user_objects where object_type not in ('TABLE_PARTITION','INDEX_PARTITION','LOB')
ERROR at line 1:
ORA-00907: missing right parenthesis
removing the where clause gives the following:
select DBMS_METADATA.GET_DDL( REPLACE(object_type,' ','_') as object_type, object_name) FROM user_objects
ERROR at line 1:
ORA-00907: missing right parenthesis
Any pointers would be gratefully received. I know I could get the DDL out using exp/imp but I want to understand why I'm getting the missing parenthesis error.
cheers,
EwanSELECT DBMS_METADATA.GET_DDL( REPLACE(object_type,' ','_') AS object_type, object_name) FROM user_objects WHERE object_type NOT IN You don't need an alias here. Get rid of " AS object_type" and it should work.
-
UpdateRow(): ORA-00907 missing right parenthesis???
This pertains to Oracle8i 8.1.7 JDBC Drivers JDK 1.2.x for NT (classes12.zip) that I just downloaded today from the website.
I call rset.updateRow() after I update a particular column
rset.updateString("col_name","whatever")
and get the following SQLException message.
ORA-00907: missing right parenthesis.
I tried to call rset.updateRow() without doing an updateString() and it passes with no exception.
I've looked at my very simply code over and over and don't see how any of it could be a problem. Is it possible that Oracle released this driver forgetting about a little ")" somewhere in the SQL that it sends to the database in this method?
Again:
(1) rset.updateString("col_name","whatever");
rset.updateRow();
throws the SQLException
(2) rset.updateRow();
is fine by itself
nullIf you are using the FOR UPDATE in your SELECT stmt, there is a bug.
See BUG:1811866
Encountered the same problem myself.
Was unable to find any further reference to this bug on Oracle's site. Is this still outstanding, and, if so, is there a target date for the fix? -
FOR UPDATE on scrollable cursor and error: ORA-00907: missing right parenthesis
If change my query to have a FOR UPDATE and make it an updatable scrollable cursor I get an error on the updateRow() command saying "ORA-00907: missing right parenthesis"
If I remove the FOR UPDATE it works OK.
The problem I have is trying to update a CLOB from a ResultSet. If I do not upate any other column I get the error saying that the error"
"ORA-22920: row containing the LOB value is not locked"
I can get around this by adding FOR UPDATE. But if I add FOR UPDATE and try to update any non-CLOB column I get the 00907 error above.
Hmmmm. So here is what I can and cannot do:
- I CAN update the CLOB IF I update another column 1st and NO FOR UPDATE clause.
- I CAN update the CLOB only if I have FOR UPDATE clause.
- I CANNOT update just the CLOB without FOR UPDATE.
- I CANNOT update any non-CLOB column with FOR UPDATE.
What a pain in the ***! How am I to provide generic access to the applications being built on my DB layer. This is crazy!<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Andrew Edgar ([email protected]):
I have this same problem!
The error occurs when performing updateRow.
The turning off of auto commit only gets the query to work but not the actual update.
Will this be fixed in the next version of the Driver?<HR></BLOCKQUOTE>
Here is the stack Trace I recieved:
java.sql.SQLException: ORA-00907: missing right parenthesis
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1405)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:822)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:1446)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1371)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1900)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:363)
at oracle.jdbc.driver.UpdatableResultSet.execute_updateRow(UpdatableResultSet.java:2135)
at oracle.jdbc.driver.UpdatableResultSet.updateRow(UpdatableResultSet.java:1322) -
Query is throwing an error like missing right paranthesis.,
Hi,
The below query is throwing an error like missing right paranthesis.,
and Is there any way to write the same query in a simpler way ?
SELECT AVALABLEBALANCE
FROM (
( SELECT SUM(TH1.TRANSACTIONAMOUNT)
FROM TRANSACTIONHISTORY TH1,
TRANSACTIONTYPE TT,
CARDDETAIL CD,
P2P_CARDDETAIL P2P
WHERE TH1.TRANSACTIONTYPEID = TT.TRANSACTIONTYPEID
AND TH1.CARDID = CD.CARDID
AND CD.CARDID = P2P.CARDID
AND TH1.CARDID = 6013
AND TT.TRANSACTIONTYPECODE IN ('WITHDRAWAL_CHECK_FEE')
AND TRUNC(TH1.TRANSACTIONDATETIME) = TRUNC(TH3.TRANSACTIONDATETIME)
GROUP BY TH1.TRANSACTIONTYPEID,TH1.CARDID,TRUNC(TH1.TRANSACTIONAMOUNT)) -
( SELECT SUM(TH2.TRANSACTIONAMOUNT)
FROM TRANSACTIONHISTORY TH2,
TRANSACTIONTYPE TT,
CARDDETAIL CD,
P2P_CARDDETAIL P2P
WHERE TH2.TRANSACTIONTYPEID = TT.TRANSACTIONTYPEID
AND TH2.CARDID = CD.CARDID
AND CD.CARDID = P2P.CARDID
AND TH2.CARDID = 6013
AND TT.TRANSACTIONTYPECODE IN ('FUND_TRANSFER_RECEIVED')
AND TRUNC(TH2.TRANSACTIONDATETIME) = TRUNC(TH3.TRANSACTIONDATETIME)
GROUP BY TH2.TRANSACTIONTYPEID,TH2.CARDID,TRUNC(TH2.TRANSACTIONAMOUNT))
) T , TRANSACTIONHISTORY TH3
WHERE TH3.CARDID = 6013Hi Sekar,
Here is your formatted code:
/* Formatted on 2007/11/16 16:42 (Formatter Plus v4.8.0) */
SELECT avalablebalance
FROM ((SELECT SUM (th1.transactionamount)
FROM transactionhistory th1,
transactiontype tt,
carddetail cd,
p2p_carddetail p2p
WHERE th1.transactiontypeid = tt.transactiontypeid
AND th1.cardid = cd.cardid
AND cd.cardid = p2p.cardid
AND th1.cardid = 6013
AND tt.transactiontypecode IN ('WITHDRAWAL_CHECK_FEE')
AND TRUNC (th1.transactiondatetime) =
TRUNC (th3.transactiondatetime)
GROUP BY th1.transactiontypeid,
th1.cardid,
TRUNC (th1.transactionamount))
MINUS
(SELECT SUM (th2.transactionamount)
FROM transactionhistory th2,
transactiontype tt,
carddetail cd,
p2p_carddetail p2p
WHERE th2.transactiontypeid = tt.transactiontypeid
AND th2.cardid = cd.cardid
AND cd.cardid = p2p.cardid
AND th2.cardid = 6013
AND tt.transactiontypecode IN ('FUND_TRANSFER_RECEIVED')
AND TRUNC (th2.transactiondatetime) =
TRUNC (th3.transactiondatetime)
GROUP BY th2.transactiontypeid,
th2.cardid,
TRUNC (th2.transactionamount))) t,
transactionhistory th3
WHERE th3.cardid = 6013
-Edit: Lol this forum's text box does not have a proper formatter to show our codes perfectly :(.. Very sorry about the expected format here.. Lol !!
***Lol Poor Format***
Message was edited by:
user599090
I replaced the '-' with MINUS Keyword. That was the mistake you made i guess. -
FOR UPDATE on updatable cursor and error: ORA-00907: missing right parenthesis
Anyone run into this? I've searched the message board and bug db to no avail.
- Using latest Oracle JDBC 2.0 compliant "thin" driver and Oracle 8.1.6 database.
1) Using prepareStatement specifying an updatable cursor for something like "SELECT FNAME,LNAME FROM USERS FOR UPDATE OF FNAME,LNAME"
2) Updating FNAME using updateString("FNAME","whatever"), and then calling updateRow() of the ResultSet yields:
ORA-00907: missing right parenthesis
If I remove the FOR UPDATE clause then everything works just fine.
Workarounds/suggestions appreciated!
Thanks,
Ryan
null<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Andrew Edgar ([email protected]):
I have this same problem!
The error occurs when performing updateRow.
The turning off of auto commit only gets the query to work but not the actual update.
Will this be fixed in the next version of the Driver?<HR></BLOCKQUOTE>
Here is the stack Trace I recieved:
java.sql.SQLException: ORA-00907: missing right parenthesis
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1405)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:822)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:1446)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1371)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1900)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:363)
at oracle.jdbc.driver.UpdatableResultSet.execute_updateRow(UpdatableResultSet.java:2135)
at oracle.jdbc.driver.UpdatableResultSet.updateRow(UpdatableResultSet.java:1322) -
OraOLEDB.Oracle GetRecordSet() throw "ORA-00907: missing right parenthesis"
Hi,
I am unfortunately working on an old VB6 app that is constructing a huge (11902 characters) ad-hoc SQL statement which is then passed to the GetRecordSet() method of my DBConnection. The app is using the OraOLEDB.Oracle provider. When the GetRecordSet() method is executed, however, I get the following error:
ORA-00907: missing right parenthesis
Now I have grabbed the contents of the string that is passed in to the GetRecordSet() function and have thoroughly examined it and there are no missing parens. Additionally, I am able to execute the select statement in Oracle SQL Developer as well as SQL*Plus, withou difficulty. So I am sure that the string is syntactically correct.
I am beginning to suspect that something fishy is happening in the provider - perhaps the string is too long and it is getting truncated somewhere?
Can anyone out there help me out?
Thanks, Stevemaybe the conversion you are trying to do is not valid especially in the first one into binary(1).
check out the conversion table for CAST operator in the SQL REFERENCE of the documentation. -
Trying to use authorization schema but getting ORA-00907: missing right par
Hi,
I am fairly new to HMTLDB. I am busy going through the Issue Tracker Tutorial. I am on the last part of Tutorial. This part involves authorizing a user based on their roles in the company.
I now keep getting the following when I load my pages
ORA-00907: missing right parenthesis
Error ERR-1082 Error in executing authorization scheme code.
How do I go about debugging this error not sure where to start?if this helps I am using this PDF
http://www.oracle.com/technology/products/database/application_express/pdf/issue_tracking_tutorial_1.6_0.pdf
if you open the PDF file I am stuck on page 72-74. The page I am trying to open while i am logged on as FUNKYMONKEY is Page 4 which is in the documentation -
Error message ORA-0097 missing right parenthesis
Dear all;
Please what is wrong with this particular code because I keep getting the error message ORA-0097: missing right parenthesis
pl/sql: sql statement ignored. Thank you
spectification of package
create or replace package NEW_INFORMATION is
function get_total return number;
procedure daily_tasks;
function display_type_id return varchar2;
end NEW_INFORMATION ;body of package
create or replace package body NEW_INFORMATION is
function get_total return number is
oput number(10);
begin
select count(unique (p1.p_id)) into oput
from table_one p1 where p1.p_id in
('CYY','AIR, '');
return oput;
end;
function display_type_id return varchar2 is
used_cells varchar2(30);
begin
select unique(p1.p_id) as cells into used_cells
from part p1 where p1.pl_id in
('CYY','AIR', '');
return used_cells;
end;
procedure daily_tasks is
name_id varchar2(20);
temp_num number(6,2);
production_daystotal number(6,2);
result_first_cc_A number (7,2);
begin
name_id := display_type_id (); -- used to call the function
temp_num := get_total(); --used to call the function
select name_id, trunc(first_partcal_A.initial_cc_A / temp_num over()) +
case
when mod(first_partcal_A.initial_cc_A,temp_num over()) >= row_number() over(order by name_id) then 1
else 0
end
from
select round(total_as.t_as/prodmonths.proddaysinmonth) as inital_cc_A
from
(select count(*) as t_as from table_one p1 where p1.a_code = 'A') total_as,
(select count(*) as proddaysinmonth from
(select mon_dt + level - 1 as dt, to_char(mon_dt + level - 1, 'DY', 'NLS_DATE_LANGUAGE = ENGLISH') as dy_days from
((select trunc(to_date(m || '/' || a, 'MM/YYYY'), 'MM') as mon_dt
from
(select to_char(sysdate, 'MM') as m,
to_char(sysdate, 'YYYY') as a from dual)))
connect by mon_dt + level - 1 <= last_day(mon_dt))
where dy_days in ('MON', 'TUE', 'WED', 'THU'))prodmonths) first_partcal_A;
order by name_id;
end daily_tasks;
end NEW_INFORMATIONPls try this
CREATE OR REPLACE PACKAGE BODY new_information
IS
FUNCTION get_total
RETURN NUMBER
IS
oput NUMBER (10);
BEGIN
SELECT COUNT (UNIQUE (p1.p_id))
INTO oput
FROM table_one p1
WHERE p1.p_id IN ('CYY', 'AIR', '');
RETURN oput;
END;
FUNCTION display_type_id
RETURN VARCHAR2
IS
used_cells VARCHAR2 (30);
BEGIN
SELECT UNIQUE (p1.p_id) AS cells
INTO used_cells
FROM part p1
WHERE p1.pl_id IN ('CYY', 'AIR', '');
RETURN used_cells;
END;
PROCEDURE daily_tasks
IS
name_id VARCHAR2 (20);
temp_num NUMBER (6, 2);
production_daystotal NUMBER (6, 2);
result_first_cc_a NUMBER (7, 2);
BEGIN
name_id := display_type_id (); -- used to call the function
temp_num := get_total (); --used to call the function
SELECT name_id,
TRUNC (first_partcal_a.initial_cc_a / temp_num /*over()*/)
+ CASE
WHEN MOD (first_partcal_a.initial_cc_a, temp_num) >=
ROW_NUMBER () OVER (ORDER BY name_id)
THEN 1
ELSE 0
END
INTO name_id,
temp_num
FROM (SELECT ROUND (total_as.t_as / prodmonths.proddaysinmonth
) AS inital_cc_a
FROM (SELECT COUNT (*) AS t_as
FROM table_one p1
WHERE p1.a_code = 'A') total_as,
(SELECT COUNT (*) AS proddaysinmonth
FROM (SELECT mon_dt + LEVEL - 1 AS dt,
TO_CHAR
(mon_dt + LEVEL - 1,
'DY',
'NLS_DATE_LANGUAGE = ENGLISH'
) AS dy_days
FROM ((SELECT TRUNC
(TO_DATE (m || '/' || a,
'MM/YYYY'
'MM'
) AS mon_dt
FROM (SELECT TO_CHAR
(SYSDATE,
'MM'
) AS m,
TO_CHAR
(SYSDATE,
'YYYY'
) AS a
FROM DUAL)))
CONNECT BY mon_dt + LEVEL - 1 <=
LAST_DAY (mon_dt))
WHERE dy_days IN ('MON', 'TUE', 'WED', 'THU')) prodmonths) first_partcal_a
ORDER BY name_id;
END daily_tasks;
END new_information;i have added INTO clause
and removed over() after MOD and TRUNC -
CREATE TABLE tbl_room
( room_id NUMBER,
accommodation_id NUMBER,
floor_area NUMBER,
rentable NUMBER(1),
type VARCHAR2(20),
CONSTRAINT pk_room PRIMARY KEY (room_id),
CONSTRAINT fk_room_accommodation FOREIGN KEY (accommodation_id) REFERENCES tbl_accommodation(accommodation_id),
CONSTRAINT ck_rentable CHECK (rentable IN 0,1));
I am getting a "missing right paranthesis" error when i try to executre this create statement. Could someone explain why. The error is caused by the check constraint.
Thankstry this..
CREATE TABLE tbl_room
( room_id NUMBER,
accommodation_id NUMBER,
floor_area NUMBER,
rentable NUMBER(1),
type VARCHAR2(20),
CONSTRAINT pk_room PRIMARY KEY (room_id),
CONSTRAINT fk_room_accommodation FOREIGN KEY (accommodation_id) REFERENCES tbl_accommodation(accommodation_id),
CONSTRAINT ck_rentable CHECK (rentable IN (0,1))); -
ROWNUM, ORDER BY, ORA-00907: missing right parenthesis
Möchte man nur die ersten 3 Datenzeilen nach einer Sortierung haben, füttert man den SQL Server leicht und verständlich beispielsweise mit:
SELECT * FROM (SELECT TOP 3 * FROM History ORDER BY Start DESC) AS query1 ORDER BY Start;
Oracle, so habe ich festgestellt, kapiert das nicht und möchte überhaupt alles ganz anders. So habe ich herausbekommen, dass es bei Oracle kein TOP, sondern ein ROWNUM gibt. Erste Versuche scheiterten, weil ROWNUM vor ORDER BY ausgeführt wird, die Sortierung also erst nach ROWNUM erfolgt.
Aber dafür soll es eine Lösung geben, die auch überall in Foren aufgeführt wird. Doch leider funktioniert auch die angebliche Lösung nicht:
SELECT * FROM (SELECT * FROM History ORDER BY Start) WHERE ROWNUM <= 3;
{color:#ff0000}ORA-00907: missing right parenthesis{color}
Was ist denn nun wieder falsch?You can check here ->
satyaki>
satyaki>select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
PL/SQL Release 10.2.0.3.0 - Production
CORE 10.2.0.3.0 Production
TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
NLSRTL Version 10.2.0.3.0 - Production
Elapsed: 00:00:00.44
satyaki>
satyaki>
satyaki>with History
2 as
3 (
4 select to_date('14.07.06','DD.MM.YY') START_R, to_date('14.07.06','DD.MM.YY') ENDE, 'HZJ' GT_TYP, 2340 GT_ID, 4 SOLL, 0 ANFANGSIST, 4 ENDEIST, 2 STATUS from dual
5 union all
6 select to_date('17.07.06','DD.MM.YY'), to_date('17.07.06','DD.MM.YY'), 'JQA', 1234, 1, 0, 1, 2 from dual
7 union all
8 select to_date('17.07.06','DD.MM.YY'), to_date('17.07.06','DD.MM.YY'), 'HZJ', 2340, 1, 0, 1, 2 from dual
9 union all
10 select to_date('17.07.06','DD.MM.YY'), to_date('17.07.06','DD.MM.YY'), 'JQA', 1234, 1, 0, 1, 2 from dual
11 union all
12 select to_date('17.07.06','DD.MM.YY'), to_date('17.07.06','DD.MM.YY'), 'HZJ', 2340, 1, 0, 1, 2 from dual
13 union all
14 select to_date('17.07.06','DD.MM.YY'), to_date('17.07.06','DD.MM.YY'), 'HZJ', 2340, 4, 0, 4, 2 from dual
15 )
16 select *
17 from (
18 select *
19 from History
20 order by START_R desc
21 )
22 where rownum <= 3;
START_R ENDE GT_ GT_ID SOLL ANFANGSIST ENDEIST STATUS
17-JUL-06 17-JUL-06 JQA 1234 1 0 1 2
17-JUL-06 17-JUL-06 HZJ 2340 1 0 1 2
17-JUL-06 17-JUL-06 JQA 1234 1 0 1 2
Elapsed: 00:00:00.99
satyaki>It is running smooth here.
Regards.
Satyaki De. -
ORA-00907: missing right parenthesi
hello,
hi, i am having a problem with creating a temporary table
create global temporary table tt_My0
id NUMBER(10,5) DEFAULT NULL,
NAME VARCHAR2(40) DEFAULT NULL,
)but its giving an error
ORA-00907: missing right parenthesisi guess, its giving me that error cause it is considering field-name NAME as a keyword..
so how can i cop up that error
thank you..it worked here ,i jusr removed a comma.
create global temporary table tt_My0
id NUMBER(10,5) DEFAULT NULL,
NAME VARCHAR2(40) DEFAULT NULL -----removed comma
)Hope it helps,
CKLP
Edited by: CKLP on Apr 5, 2011 10:26 PM -
ORA-00917: missing comma when using NVL
Hi All,
I have a INSERT statement which works fine and looks something like:
EXECUTE IMMEDIATE
'insert into MYTABLE(ID,TASK_ROLE, PROGRESS,SALES_PERSON) values ...
However if I change the above piece to use NVL function like this:
EXECUTE IMMEDIATE
'insert into MYTABLE(ID,TASK_ROLE, NVL(PROGRESS,''0''),SALES_PERSON) values ...
I am getting the following error:
ORA-00917: missing comma
Where should I enter the extra comman needed?
Regards,
Pawel.Hi these are in fact two simple quotes '. If I use only one simple quote I get an error:
1 error has occurred
ORA-06550: line 48, column 239: PLS-00103: Encountered the symbol "0" when expecting one of the following: * & = - + ; < / > at in is mod remainder not rem return returning <> or != or ~= >= <= <> and or like LIKE2_ LIKE4_ LIKEC_ between into using || multiset bulk member SUBMULTISET_ The symbol "* was inserted before "0" to continue.
Same thing happens if I ommit the quotes at all and leave it like NVL(PROGRESS,0)
Edited by: padmocho on Sep 20, 2010 11:37 AM -
Kindly help ORA-00917: missing comma" ERR-1101 Unable to process function
HI Experts,
Since yesterday every thing was fine, i do not know what happened in the evening, we are facing some issue with our production.
I'm getting the following error ,when i running the report
ORA-00917: missing comma
Error ERR-1101 Unable to process function body returning query.
Since long time we have even not touched the code , i'm wondering about this error...the same code was working fine just 2 days back.
Kindly help me with this...
Code
DECLARE
date_from DATE:=:P46_TRANS_DATEFROM;
date_to DATE:=:P46_TRANS_DATETO;
--date_from DATE :=TO_DATE('22-Nov-2007','DD-Mon-yyyy');
--date_to DATE :=TO_DATE('23-Nov-2007','DD-Mon-yyyy');
date_counter DATE:=date_from;
v_city varchar2(32):=:P46_CITY;
str_month1 VARCHAR2(3):=SUBSTR(TO_CHAR(date_from,'DD-MON-YYYY'),4,3);
str_year1 VARCHAR2(4):=SUBSTR(TO_CHAR(date_from,'DD-MON-YYYY'),8,4);
str_month2 VARCHAR2(3):=SUBSTR(TO_CHAR(date_to,'DD-MON-YYYY'),4,3);
str_year2 VARCHAR2(4):=SUBSTR(TO_CHAR(date_to,'DD-MON-YYYY'),8,4);
day_from VARCHAR2(2):=SUBSTR(date_from,1,2);
day_to VARCHAR2(2):=SUBSTR(date_to,1,2);
CURSOR trans_alloc(m VARCHAR2,y NUMBER,email VARCHAR2) IS SELECT * FROM EFT_TRANS_ALLOCATION WHERE LOWER(MONTH)=LOWER(m) AND YEAR=y AND LOWER(email_id)=LOWER(email);
CURSOR trans_schedules(m1 VARCHAR2,y1 NUMBER,m2 VARCHAR2,y2 NUMBER) IS SELECT * FROM OD_SHIFT_SCHEDULE WHERE (UPPER(MONTH)=m1 OR UPPER(MONTH)=m2) AND (YEAR=y1 OR YEAR=y2);
CURSOR get_res_id(email VARCHAR2) IS SELECT resource_id,first_name,last_name FROM EFT_RESOURCES WHERE LOWER(email_id)=LOWER(email);
rec OD_SHIFT_SCHEDULE%ROWTYPE;
CURSOR get_shifts(id VARCHAR2) IS SELECT * FROM OD_SHIFTS WHERE shift_id=id;
ta EFT_TRANS_ALLOCATION%ROWTYPE;
sd OD_SHIFTS%ROWTYPE;
sql_str VARCHAR2(4000);
v_res_id NUMBER;
v_fname VARCHAR2(50);
v_lname VARCHAR2(50);
v_shift_id VARCHAR2(32);
s VARCHAR2(1000);
d VARCHAR2(32);
final_sql VARCHAR2(4000);
v_consent VARCHAR2(3);
s2 VARCHAR2(1000);
dn DATE;
BEGIN
DELETE FROM EFT_SHIFT_SCHEDULES_RPT;
OPEN trans_schedules(UPPER(str_month1),TO_NUMBER(str_year1),UPPER(str_month2),TO_NUMBER(str_year2));
LOOP
FETCH trans_schedules INTO rec;
EXIT WHEN trans_schedules%NOTFOUND;
OPEN get_res_id(rec.name);
FETCH get_res_id INTO v_res_id,v_fname,v_lname;
OPEN trans_alloc(TO_CHAR(date_counter,'MON'),TO_NUMBER(TO_CHAR(date_counter,'YYYY')),rec.name);
FETCH trans_alloc INTO ta;
IF trans_alloc%FOUND THEN
dbms_output.put_line (date_counter||'----'||date_to||'Res_id:----'||v_res_id||'-'||ta.slno);
dbms_output.put_line ('Found Alloc');
WHILE date_counter<=date_to
LOOP
--d:=d||'-'||str_month||'-'||str_year;
d:=SUBSTR(TO_CHAR(date_counter,'DD-MON-YYYY'),1,2);
s:='INSERT INTO temp_2 SELECT "'||d||'" from OD_SHIFT_SCHEDULE where slno='||rec.slno;
--dbms_output.put_line (d||'-'||s);
DELETE FROM temp_2;
EXECUTE IMMEDIATE s;
SELECT substr(trim(VAL),1,1) INTO v_shift_id FROM temp_2;
s2:='INSERT INTO temp_3 SELECT "'||d||'" from EFT_TRANS_ALLOCATION where slno='||ta.slno;
DELETE FROM temp_3;
EXECUTE IMMEDIATE s2;
SELECT VAL INTO v_consent FROM temp_3;
--dbms_output.put_line (v_shift_id||'-'||v_consent);
--dbms_output.put_line (date_counter||'-'||date_to);
IF v_consent='Y' THEN
--dbms_output.put_line ('Im inside consent'||v_consent);
IF v_shift_id IS NOT NULL THEN
--dbms_output.put_line ('Im inside shift not null'||v_shift_id);
OPEN get_shifts(v_shift_id);
FETCH get_shifts INTO sd;
IF sd.night_shift_indicator='Y' THEN
dn:=date_counter+1;
sql_str:='INSERT INTO eft_shift_schedules_rpt VALUES ('||v_res_id||','''||v_fname||''','''||v_lname||''','''||rec.name||''','''||sd.shift_name||''','''||date_counter||''','''||sd.start_from||''','''||sd.start_to||''','''||''','''||sd.active_yn||''','''||dn||''')';
ELSE
sql_str:='INSERT INTO eft_shift_schedules_rpt VALUES ('||v_res_id||','''||v_fname||''','''||v_lname||''','''||rec.name||''','''||sd.shift_name||''','''||date_counter||''','''||sd.start_from||''','''||sd.start_to||''','''||''','''||sd.active_yn||''','''||date_counter||''')';
END IF;
EXECUTE IMMEDIATE sql_str;
CLOSE get_shifts;
--dbms_output.put_line (sql_str);
END IF;
END IF;
COMMIT;
date_counter:=date_counter+1;
END LOOP;
END IF;
CLOSE trans_alloc;
CLOSE get_res_id;
--dbms_output.put_line (rec.name);
date_counter:=date_from;
END LOOP;
COMMIT;
CLOSE trans_schedules;
final_sql:='select a.first_name,a.last_name,a.email_id,a.shift_details,a.arrange_date,a.slot_from,a.slot_to,a.trans_arranged,a.active_yn,b.address1,b.address2,b.city,b.state,b.pin,b.worknumber,b.homenumber,b.mobilenumber,a.to_date from eft_shift_schedules_rpt a,eft_locations b where a.resource_id=b.resource_id and b.city =:P46_CITY';
--dbms_output.put_line (final_sql);
RETURN final_sql;
END;Hi Basva,
my best advice is find out where the error happens, e.g. using DBMS_UTILITY.FORMAT_ERROR_BACKTRACE .
In the next step you can fix the error and rework the code so that it looks nice and has some comments in it so everyone knows what it SHOULD do.
brgds,
Peter
Blog: http://www.oracle-and-apex.com
ApexLib: http://apexlib.oracleapex.info
BuilderPlugin: http://builderplugin.oracleapex.info
Work: http://www.click-click.at and http://www.wirsindapex.at
Maybe you are looking for
-
Error while creating service PO by BAPI_PO_CREATE1
Hi, I am trying to create a service PO using the BAPI_PO_CREATE1 with reference to service PR and I am getting an "In case of account assignment, please enter acc. assignment data for item" for which i found so many threads but none had resolved this
-
Goods Receipt at Moving Average price instead of PO price
We are finding a scenario where in goods receipt is getting booked at Moving average price instead of PO price. The material is defined with price control indicator as V like any other material. The issue is identifed for a specific material only. Ca
-
Data Medium Exchange of Travel Expenses for Finland
Hi, On sap menu search "Accounting-> Financial Accounting-> Travel Management-> Travel Expenses-> Periodic Processing-> Payment via Data Medium Exchange (DME)-> Change Country Grouping" when i try change to country finland, the following error appear
-
How remove Special stock indicator for dialog in PO componet overview
Hi I am creating production order with reference to the sales order (MTO) after creating the production order in component overview special stock indicator is default value is u20181u2019, plz any one suggest How remove Special stock indicator for di
-
Split pane - problem with resize
I have problem with splitPane. I can't resize panels using splitpane and i dont know why :( Here is my program: https://rapidshare.com/files/4139244909/inzynier.rar Any ideas, what i am doing wrong? Another problem is: When i try build this project i