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_INFORMATION
Pls 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
Similar Messages
-
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) -
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.
-
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) -
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? -
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. -
Direct-load Insert. ORA-00907: missing right parenthesis
Hi All,
i created one dummy table with two character columns
im trying to insert values like this.
insert into dummy select ('x','y') from dual;
the error is
ERROR at line 1:
ORA-00907: missing right parenthesis
Thanks in advanceSQL> insert into dummy1 select 'x','y' from dual;
1 row created.
SQL> select * from dummy1;
COL1 COL2
x y
Regards,
Sanju -
Error message: 'ORA-00926:missing VALUES keyword
Hi Friends,
I am trying to update a database table in SAPR3.ORACLE database from CRM via an ABAP program.
I did required BDCON setup. But I get the error message : ORA-00926:missing VALUES keyword.
Looking forward your help to solve this problem. Anyone came across such issue?
below is my code and BDCON setup
DB Connection DB_CONNECT
DBMS ORA
User Name test_db
DB password
Conn. info sapde9db00a
Connection Limit 10
Optimum Conns 5
TABLES: BUT000.
DATA: EXC_REF TYPE REF TO CX_SY_NATIVE_SQL_ERROR,
ERROR_TEXT TYPE STRING.
DATA W_PARTNER TYPE BUT000-PARTNER.
TYPES: BEGIN OF TYP_PARTNER,
MANDT TYPE SY-MANDT,
PARTNER_NUMBER TYPE BU_PARTNER,
END OF TYP_PARTNER.
DATA: ZZ_TEST TYPE STANDARD TABLE OF TYP_PARTNER WITH HEADER LINE.
DATA: DBTYPE TYPE DBCON_DBMS,
DBCUR TYPE CURSOR,
T_BUT000 LIKE BUT000 OCCURS 0 WITH HEADER LINE.
SELECT * INTO CORRESPONDING FIELDS OF TABLE T_BUT000 FROM BUT000 ORDER BY PRIMARY KEY.
LOOP AT T_BUT000.
ZZ_TEST-MANDT = SY-MANDT.
ZZ_TEST-PARTNER_NUMBER = T_BUT000-PARTNER.
APPEND ZZ_TEST.
ENDLOOP.
TRY.
EXEC SQL.
SET CONNECTION 'DB_CONNECT'
ENDEXEC.
EXEC SQL.
CONNECT TO 'DB_CONNECT'
ENDEXEC.
LOOP AT ZZ_TEST.
EXEC SQL.
INSERT INTO SAPR3."ZZTEST_DB":
(mandt, partner_number) VALUES('220', '0000000253');
ENDEXEC.
IF SY-SUBRC <> 0.
ENDIF.
ENDLOOP.
CATCH CX_SY_NATIVE_SQL_ERROR INTO EXC_REF.
ERROR_TEXT = EXC_REF->GET_TEXT( ).
MESSAGE ERROR_TEXT TYPE 'I'.
ENDTRY.
EXEC SQL.
SET CONNECTION DEFAULT
ENDEXEC.
Thanks in advance for you help,
regards
DJHi,
See my complete code to update values using internal table
TABLES: BUT000.
DATA: EXC_REF TYPE REF TO CX_SY_NATIVE_SQL_ERROR,
ERROR_TEXT TYPE STRING.
DATA W_PARTNER TYPE BUT000-PARTNER.
TYPES: BEGIN OF TYP_PARTNER,
MANDT TYPE SY-MANDT,
PARTNER_NUMBER TYPE BU_PARTNER,
END OF TYP_PARTNER.
DATA: ZZ_TEST TYPE STANDARD TABLE OF TYP_PARTNER WITH HEADER LINE.
DATA: DBTYPE TYPE DBCON_DBMS,
DBCUR TYPE CURSOR,
T_BUT000 LIKE BUT000 OCCURS 0 WITH HEADER LINE.
SELECT * INTO CORRESPONDING FIELDS OF TABLE T_BUT000 FROM BUT000 ORDER BY PRIMARY KEY.
LOOP AT T_BUT000.
ZZ_TEST-MANDT = SY-MANDT.
ZZ_TEST-PARTNER_NUMBER = T_BUT000-PARTNER.
APPEND ZZ_TEST.
ENDLOOP.
TRY.
EXEC SQL.
SET CONNECTION 'DB_CONNECT'
ENDEXEC.
EXEC SQL.
CONNECT TO 'DB_CONNECT'
ENDEXEC.
LOOP AT ZZ_TEST.
EXEC SQL.
INSERT INTO SAPR3.ZZTEST_DB (mandt, partner_number) VALUES (ZZ_TEST-MANDT, ZZ_TEST-PARTNER_NUMBER);
ENDEXEC.
IF SY-SUBRC <> 0.
ENDIF.
ENDLOOP.
CATCH CX_SY_NATIVE_SQL_ERROR INTO EXC_REF.
ERROR_TEXT = EXC_REF->GET_TEXT( ).
MESSAGE ERROR_TEXT TYPE 'I'.
ENDTRY.
EXEC SQL.
SET CONNECTION DEFAULT
ENDEXEC.
Edited by: Mourougane DJEARAMANE on Mar 31, 2008 2:11 PM -
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. -
ERROR OGG-00868 Error code 1291, error message: ORA-01291: missing logfile
OGG Version 12.1.2.1.0 OGGCORE_12.1.2.1.
DB : 11.2.0.4.3
I am getting below error.
2014-12-31 09:53:09 ERROR OGG-00868 Error code 1291, error message: ORA-01291: missing logfile
(Missing Log File <unknown>. Read Position SCN: 2585.802983323 (11103293443483)).
Our solution uses ADG and OGG
We have source and target where ADG was setup . We later broke ADG setup and made Oracle DB's in source and target into standalone.
As part of our solution during our deployment window ,we would break ADG i.e we would make both the source and target as independent DB’s with PRIMARY Read /Write mode.
-Take Guaranteed restore point on Source DB so that we can flash back at later stage(so of now we have not executed flash back command)
-Once ADG config is disabled we will start the OGG extract which is already configured before =We are at this stage where we are hit with errors and extract is not starting .Hi ,
The error shows it is waiting for the Logfile. The Integrated extract mainly needs of the availability of two things.
1. Archivelogs.
2. Trail Files.
Both should be retained to the needed / required level.
Please execute the below query and check the status of the Extract / Capture process.
The below query displays the information of each capture process in a database.,
COLUMN CAPTURE_NAME HEADING 'Capture|Name' FORMAT A7
COLUMN PROCESS_NAME HEADING 'Capture|Process|Number' FORMAT A7
COLUMN SID HEADING 'Session|ID' FORMAT 9999
COLUMN SERIAL# HEADING 'Session|Serial|Number' FORMAT 9999
COLUMN STATE HEADING 'State' FORMAT A20
COLUMN TOTAL_MESSAGES_CAPTURED HEADING 'Redo|Entries|Evaluated|In Detail' FORMAT 9999999
COLUMN TOTAL_MESSAGES_ENQUEUED HEADING 'Total|LCRs|Enqueued' FORMAT 9999999999
SELECT c.CAPTURE_NAME,
SUBSTR(s.PROGRAM,INSTR(s.PROGRAM,'(')+1,4) PROCESS_NAME,
c.SID,
c.SERIAL#,
c.STATE,
c.TOTAL_MESSAGES_CAPTURED,
c.TOTAL_MESSAGES_ENQUEUED
FROM V$STREAMS_CAPTURE c, V$SESSION s
WHERE c.SID = s.SID AND
c.SERIAL# = s.SERIAL#;
Also run this query to check, if the capture is waiting for which logfile.,
COLUMN CONSUMER_NAME HEADING 'Capture|Process|Name' FORMAT A15
COLUMN SOURCE_DATABASE HEADING 'Source|Database' FORMAT A10
COLUMN SEQUENCE# HEADING 'Sequence|Number' FORMAT 99999
COLUMN NAME HEADING 'Required|Archived Redo Log|File Name' FORMAT A40
SELECT r.CONSUMER_NAME,
r.SOURCE_DATABASE,
r.SEQUENCE#,
r.NAME
FROM DBA_REGISTERED_ARCHIVED_LOG r, DBA_CAPTURE c
WHERE r.CONSUMER_NAME = c.CAPTURE_NAME AND
r.NEXT_SCN >= c.REQUIRED_CHECKPOINT_SCN;
The above query clearly shows for which logfile the Extract / Capture process is waiting. Check if that logfile is available in your system.
Regards,
Veera -
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-00907 Missing right parenthesis? Buh?
Alright, so I've got this bit of PL/SQL code....
<i><font face="verdana" size="-1" color="#005F4B">declare
popname_first VARCHAR2(4000);
popname_second VARCHAR2(4000);
poppage_first VARCHAR2(16);
poppage_second VARCHAR2(16);
begin
select rname into popname_first from (select reportname rname from dms_occurances order by occurances desc) where rownum = 1;
select rname into popname_second from (select reportname rname from dms_occurances order by occurances desc) where rownum = 2;
select pn into poppage_first from (select pageno pn from dms_occurances order by occurances desc) where rownum = 1;
select pn into poppage_second from (select pageno pn from dms_occurances order by occurances desc) where rownum = 2;
</font></i>
....and a range of htp.print statements after that.
The problem is that I'm getting a ORA-00907 error telling me I'm missing my right parenthesis on line 11 (the first of the select assignment lines). Obviously this is not the case. I suspect it has something to do with the way I'm doing the query, but I can't think of any other method for it.
Please help!Are you aware that the predicate 'WHERE/AND ROWNUM = 2' will return exactly zero rows?
-
ORA-00907: missing right parenthesis when using group by clause with xmlagg
I have the following query and I am getting ORA 00907 Error when I am using group by clause with the xmlagg function.
select xmlelement("Mitigation",
xmlelement("m_szMethodName",tm.DisplayName),
xmlelement("SubstanceInterferenceProtocolList",
(select xmlagg(xmlelement("MitigationProtocol",
xmlelement("m_szMethodName",tm.DisplayName),
xmlelement("m_szInterferenceProtocolName",tmp.protocol_name),
xmlelement("m_szInterferenceSubstance",tmp.intf_mtrl_prod_code),
xmlelement("m_ProtocolParameters",
xmlelement("m_szProtocolName",tmp.protocol_name),
xmlelement("m_Consumables",
xmlelement("Consumable",
xmlelement("m_szConsumId", xrl.rgnt_pack_name),
xmlelement("m_szProductCode",xrl.pack_prod_code),
xmlelement("m_nVolume",tmp.fluid_vol),
xmlelement("m_szProtocolStep",xps.protocol_step_name))),
xmlelement("m_ProtParamList",
xmlagg(
xmlelement("ParameterValues",
xmlelement("m_szProtocolName",tmp.protocol_name),
xmlelement("m_Time",xpsd.parameter_ntime_value))
group by tmp.ccd_test_id,tmp.intf_mtrl_prod_code)
order by tmp.ccd_test_id, tmp.intf_mtrl_prod_code, xps.protocol_step_intprotocolstep )
from XPR_tdef_mitigation_protocol tmp, xp_reagentlist xrl,
xpr_protocol_settings xps, xpr_protocol_settings_default xpsd
where tmp.ccd_test_id = tm.ccd_test_id
and tmp.ccd_test_id = xrl.ccd_test_id
and tmp.pack_prod_code = xrl.pack_prod_code
and tmp.intf_type = 1
and xps.protocol_name = xpsd.protocol_name
and xps.protocol_step_name = xpsd.protocol_step_name
and xps.ps_action_parameterlist = xpsd.ps_action_parameterlist
and xps.protocol_name = tmp.PROTOCOL_NAME
from XPtoXPRTdef_defn_mapping tm
where tm.DisplayName = 'SYPH'If I remove the xmlagg clause along with the group by clause, the query runs fine and give me the output.
But in that XML format of the output is incorrect for my application.
Could someone help here?Hi,
userAtoZ wrote:
I have the following query and I am getting ORA 00907 Error when I am using group by clause with the xmlagg function.
... xmlagg(
xmlelement("ParameterValues",
xmlelement("m_szProtocolName",tmp.protocol_name),
xmlelement("m_Time",xpsd.parameter_ntime_value))
group by tmp.ccd_test_id,tmp.intf_mtrl_prod_code)Please don't post unformatted code. When posting any formatted text on this site, type these 6 characters:
\(small letters only, inside curly brackets) before and after each section of formatted text, to preserve spacing.
If the code above were formatted well, so that you could match each '(' with its closing ')', it would look something like this:... xmlagg ( xmlelement ( "ParameterValues"
, xmlelement ( "m_szProtocolName"
, tmp.protocol_name
, xmlelement ( "m_Time"
, xpsd.parameter_ntime_value
group by tmp.ccd_test_id
, tmp.intf_mtrl_prod_code
This is exactly what you posted, only the whitespace has been changed.
This makes it clear that the GROUP BY is inside the parentheses with the argument to XMLAGG. You can have an ORDER BY clause there, but not a GROUP BY clause. -
ORA-00907: missing right parenthesis
hi,
my requirement is creating xml using dynamic sql .but i got this error please help me.
declare
l_query varchar2(2000);
output clob;
begin
l_query:='select dbms_xmlgen.getxml('' select empno,to_char(sal,''99,999.99'') salary from emp '') loandetl from dual';
DBMS_OUTPUT.PUT_LINE(l_query);
EXECUTE IMMEDIATE l_query into output;
end;You can use "DBMS_XMLQUERY.getxml" or "dbms_xmlgen.getXML"
ind> declare
2 l_query varchar2(2000);
3 output clob;
4 begin
5 l_query := 'select empno, to_char(sal, ''99,999.99'') salary from emp_sriram';
6 DBMS_OUTPUT.PUT_LINE(l_query);
7 output := dbms_xmlgen.getXML(l_query);
8 DBMS_OUTPUT.PUT_LINE(output);
9 end;
10 /
select empno, to_char(sal, '99,999.99') salary from emp_sriram
<?xml version="1.0"?>
<ROWSET>
<ROW>
<EMPNO>7369</EMPNO>
<SALARY> 800.00</SALARY>
</ROW>
<ROW>
<EMPNO>7499</EMPNO>
<SALARY> 1,600.00</SALARY>
</ROW>
<ROW>
<EMPNO>7521</EMPNO>
</ROW>
<ROW>
<EMPNO>7566</EMPNO>
<SALARY> 2,975.00</SALARY>
</ROW>
<ROW>
<EMPNO>7654</EMPNO>
</ROW>
<ROW>
<EMPNO>7698</EMPNO>
<SALARY> 2,850.00</SALARY>
</ROW>
<ROW>
<EMPNO>7782</EMPNO>
<SALARY> 2,450.00</SALARY>
</ROW>
<ROW>
<EMPNO>7788</EMPNO>
<SALARY> 3,000.00</SALARY>
</ROW>
<ROW>
<EMPNO>7839</EMPNO>
<SALARY> 5,000.00</SALARY>
</ROW>
<ROW>
<EMPNO>7844</EMPNO>
<SALARY> 1,500.00</SALARY>
</ROW>
<ROW>
<EMPNO>7876</EMPNO>
<SALARY> 1,100.00</SALARY>
</ROW>
<ROW>
<EMPNO>7900</EMPNO>
<SALARY>
950.00</SALARY>
</ROW>
<ROW>
<EMPNO>7902</EMPNO>
<SALARY> 3,000.00</SALARY>
</ROW>
<ROW>
<EMPNO>7934</EMPNO>
<SALARY> 1,300.00</SALARY>
</ROW>
</ROWSET>
PL/SQL procedure successfully completed.
ind> ed
Wrote file afiedt.buf
1 declare
2 l_query varchar2(2000);
3 output clob;
4 begin
5 l_query := 'select empno, to_char(sal, ''99,999.99'') salary from emp_sriram';
6 DBMS_OUTPUT.PUT_LINE(l_query);
7 output := DBMS_XMLQUERY.getxml(l_query);
8 DBMS_OUTPUT.PUT_LINE(output);
9* end;
ind> /
select empno, to_char(sal, '99,999.99') salary from emp_sriram
<?xml version = '1.0'?>
<ROWSET>
<ROW num="1">
<EMPNO>7369</EMPNO>
<SALARY>
800.00</SALARY>
</ROW>
<ROW num="2">
<EMPNO>7499</EMPNO>
<SALARY>
1,600.00</SALARY>
</ROW>
<ROW num="3">
<EMPNO>7521</EMPNO>
</ROW>
<ROW num="4">
<EMPNO>7566</EMPNO>
<SALARY> 2,975.00</SALARY>
</ROW>
<ROW num="5">
<EMPNO>7654</EMPNO>
</ROW>
<ROW num="6">
<EMPNO>7698</EMPNO>
<SALARY>
2,850.00</SALARY>
</ROW>
<ROW num="7">
<EMPNO>7782</EMPNO>
<SALARY>
2,450.00</SALARY>
</ROW>
<ROW num="8">
<EMPNO>7788</EMPNO>
<SALARY>
3,000.00</SALARY>
</ROW>
<ROW num="9">
<EMPNO>7839</EMPNO>
<SALARY>
5,000.00</SALARY>
</ROW>
<ROW num="10">
<EMPNO>7844</EMPNO>
<SALARY>
1,500.00</SALARY>
</ROW>
<ROW num="11">
<EMPNO>7876</EMPNO>
<SALARY>
1,100.00</SALARY>
</ROW>
<ROW num="12">
<EMPNO>7900</EMPNO>
<SALARY>
950.00</SALARY>
</ROW>
<ROW num="13">
<EMPNO>7902</EMPNO>
<SALARY>
3,000.00</SALARY>
</ROW>
<ROW num="14">
<EMPNO>7934</EMPNO>
<SALARY>
1,300.00</SALARY>
</ROW>
</ROWSET>
PL/SQL procedure successfully completed.
ind> sriram
Edited by: sriram on Jun 9, 2011 1:17 AM -
Missing right parenthesis?
I have to create one table that has 106 columns, and I met one error that I can't understand. The error is ORA-00907, missing right parenthesis. But if I reduce the column number to 17, the table can be created. Why? Does Oracle XE limit the column number?
Cause:
A left parenthesis has been entered without a closing right parenthesis, or extra information was contained in the parentheses.All parentheses must be entered in pairs.
Action:
Correct the syntax and retry the statement.
Peter.
Maybe you are looking for
-
In the past week, Safari (for Mac) 5.0.2 (6533.18.5) has shut down "unexpectedly" at least 3 times daily. The report I receive is below ... please can someone tell me what's going on? Process: Safari [507] Path: /Applications/Safari.app/Contents/MacO
-
Cannot do a 5.1 mixdown in CS6
I am creating a 5.1 surround sound mix in Audition CS6 (tracks exported from Premiere Pro). After carefully panning each track in my 5.1 field I am ready to do a mixdown. Unfortunately, that option is greyed out. It must be because I am not assign
-
Tried to send a picture, now can't text this ONE p...
i'm on Windows (XP), he's on a Mac. i tried to send a pic that was actually from an online e-mail attachment, twice; he accepted, but got nowhere. then, i realized my mistake, downloaded the pic, and tried to send that -- but that didn't work. now, S
-
Tree component in Sun Studio Creator
Hello. I have a problem with Tree component in Sun Java Studio Creator when i use it. Error: com.sun.rave.web.ui.appbase.ApplicationException: org.apache.jasper.JasperException: java.net.MalformedURLException: no protocol: /layout/layout.dtd Please,
-
I am using a PC with windows 7. I have a number of figures that update daily as data is automatically download that I would like to build a page to display. I am hoping that by uploading an image using the URL it will update when the image updates at