Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Pl/sql - Ora-00907

Empfohlene Antworten

Veröffentlicht

Hallo,

ich hoffe mir kann jemand helfen.

Und zwar folgendes Statement in einer Procedure wirft eine Exception.

insert into temp_aenderung
select sysinsert, count(sysinsert), tabellen_liste_ja_mva(i), 'insert'
FROM (
select to_char(SYSINSDATUM,'YYYY-MM-DD') as sysinsert, to_char(SYSUPDDATUM,'YYYY-MM-DD') as sysupdate
from tabellen_liste_ja_mva(i)
where SYSINSDATUM >= to_date('2000-01-01','YYYY-MM-DD')
and SYSINSDATUM < to_date('2008-06-01','YYYY-MM-DD')
and to_char(SYSINSDATUM,'YYYY-MM-DD') <> to_char(SYSUPDDATUM, 'YYYY-MM-DD')
)
GROUP by sysinsert;[/PHP]

Dieses Statement wirft diese Exception

[PHP]LINE/COL ERROR
-------- -----------------------------------------------------------------
57/3 PL/SQL: SQL Statement ignored
61/30 PL/SQL: ORA-00907: missing right parenthesis

Die anderen auch, aber da ist es das gleiche.

Lasse ich so ein Statement in Squrriel laufen funktioniert das auch wunderbar, nur in der Prozedur funktioniert das nicht. Kann mir da jemand helfen?

Vielen Dank.

Anbei noch die Prozedur.

alter session set plsql_debug=true;

create or replace package statistiken as
procedure main;
end statistiken; -- end of package bws_olaptransfer
/

create or replace package body statistiken as
pkgversion_mc constant varchar2(120) := '$Id:$';
sql_v varchar2(10000);

type tabellen_liste_ja_va is varray(15) of varchar(30);
tabellen_liste_ja_mva tabellen_liste_ja_va := tabellen_liste_ja_va (
'Tabelle1',
'Tabelle2',


procedure main as

begin
for i in tabellen_liste_ja_mva.first..tabellen_liste_ja_mva.last loop
insert into temp_log values (sysdate, tabellen_liste_ja_mva(i));
commit;

insert into temp_aenderung
select sysinsert, count(sysinsert), tabellen_liste_ja_mva(i), 'insert'
FROM (
select to_char(SYSINSDATUM,'YYYY-MM-DD') as sysinsert, to_char(SYSUPDDATUM,'YYYY-MM-DD') as sysupdate
from tabellen_liste_ja_mva(i)
where SYSINSDATUM >= to_date('2000-01-01','YYYY-MM-DD')
and SYSINSDATUM < to_date('2008-06-01','YYYY-MM-DD')
and to_char(SYSINSDATUM,'YYYY-MM-DD') <> to_char(SYSUPDDATUM, 'YYYY-MM-DD')
)
GROUP by sysinsert;

commit;

insert into temp_log values (sysdate, tabellen_liste_ja_mva(i));
commit;

insert into temp_aenderung
select sysupdate, count(sysupdate),tabellen_liste_ja_mva(i), 'update'
FROM (
select to_char(SYSINSDATUM, 'YYYY-MM-DD') as sysinsert, to_char(SYSUPDDATUM, 'YYYY-MM-DD') as sysupdate
from tabellen_liste_ja_mva(i)
where SYSUPDDATUM >= to_date('2000-01-01', 'YYYY-MM-DD')
and SYSUPDDATUM < to_date('2008-06-01', 'YYYY-MM-DD')
and to_char(SYSINSDATUM, 'YYYY-MM-DD') <> to_char(SYSUPDDATUM,'YYYY-MM-DD'))
GROUP by sysupdate;
commit;

insert into temp_log values (sysdate, tabellen_liste_ja_mva(i));
commit;

insert into temp_aenderung
select sysupdate, count(sysupdate), tabellen_liste_ja_mva(i),'insertupdate'
FROM (
select to_char(SYSINSDATUM, 'YYYY-MM-DD') as sysinsert, to_char(SYSUPDDATUM, 'YYYY-MM-DD') as sysupdate
from tabellen_liste_ja_mva(i)
where SYSUPDDATUM > to_date('2008-05-31', 'YYYY-MM-DD')
and SYSUPDDATUM < to_date('2008-07-01', 'YYYY-MM-DD')
and to_char(SYSINSDATUM, 'YYYY-MM-DD') = to_char(SYSUPDDATUM, 'YYYY-MM-DD'))
GROUP by sysupdate;
commit;
end loop;
end main;
end statistiken;
/
grant execute on statistiken to public;

show errors

quit
[/PHP]

Viele Grüße

Kurschi

Nein. Das ist ein Copy&Paste Fehler.

Ich habe herausgefunden, dass ich dazu dynamisches SQL verwenden muss.

ql_v:=
'insert into temp_aenderung ' ||
'select sysupdate, count(sysupdate), ' || chr(39) || tbl || chr(39) || ', ' || chr(39) || 'insertupdate' || chr(39) ||
' FROM (' ||
'select to_char(theinsertdate, ' || chr(39) || 'YYYY-MM-DD' || chr(39) || ') as sysinsert, to_char(theupdatedate, ' || chr(39) || 'YYYY-MM-DD' || chr(39) || ') as sysupdate ' ||
'from ' || tbl ||
' where theupdatedate > to_date(' || chr(39) || '2008-05-31' || chr(39) || ', ' || chr(39) || 'YYYY-MM-DD' || chr(39) || ') ' ||
'and theupdatedate < to_date(' || chr(39) || '2008-07-01' || chr(39) || ', ' || chr(39) || 'YYYY-MM-DD' || chr(39) || ') ' ||
'and to_char(theinsertdate, ' || chr(39) || 'YYYY-MM-DD' || chr(39) || ') = to_char(theupdatedate, ' || chr(39) || 'YYYY-MM-DD' || chr(39) || ')' ||
')' ||
' GROUP by sysupdate';

execute immediate(sql_v);[/PHP]

Damit funktioniert das.

Vielen Dank.

Gruß Kurschi

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.