Alias problem in query error: ORA-00923
Hi,
While using alias for query as below I am getting the below error:
ORA-00923: FROM keyword not found where expected
Select (b.forecast_value * a.Spec_P90_cpuutil) as "ForecastSPECCPU" ||',' ||a.Spec_P90_cpuutil as "alias" FROM SM_System_Capacity a ,R_CustomerForecast b ,K_SystemCapacity d where TO_CHAR(a.ta_period,'YYYY-MM-DD') = '2007-11-01' and b.ta_period IS NOT NULL and a.target_name = d.dsi_target_name and a.target_name = 'xxxx';
"Select a.dsi_target_name ,a.dsi_table_key ,b.ta_period ,b.AVGAVGcpuutil, b.AVGAVGmemutil, b.AVGMAXcpuutil, b.P90AVGmemutil, (b.AVGAVGcpuutil * a.power_rating_value / 100) SPEC_Cpu_Util, (b.AVGMAXcpuutil* a.power_rating_value / 100) SPEC90_Cpu_Util,a.cpu, a.mhz, a.ram,a.os,a.applicationcomp,a.systemcomp,a.dsi_table_key,a.power_rating_value,(a.power_rating_value *80/ 100) System_Threshold,a.power_rating_value Business_Threshold, b.dsi_key_id_ from K_SystemCapacity a,SM_Systemtest b where a.dsikey = b.dsi_key_id_";
The full query is as above on which I used the || operator and got the same error, so I tried in parts which is also not working.
Please let me know how can I use alias for such queries.
Thanks,
Arun
you cannot concatenate aliased columns together
Select (b.forecast_value * a.Spec_P90_cpuutil) as "ForecastSPECCPU" ||',' ||a.Spec_P90_cpuutil as "alias"
you can select two columns
Select (b.forecast_value * a.Spec_P90_cpuutil) as "ForecastSPECCPU", a.Spec_P90_cpuutil as "alias"
or concat them, and then alias
Select (b.forecast_value * a.Spec_P90_cpuutil) ||',' ||a.Spec_P90_cpuutil as "alias"
Similar Messages
-
Parallel Query Error (Ora 12801 Ora-00904)
when i run this particular query in a report or in SQL it wrks
but some times it give the error .........
any one who could help ........ASAP
SELECT
D.DISTRIBUTOR_CODE "DIST_CODE",
D.DISTRIBUTOR_NAME "DIST_NAME",
O.OPERATOR_CODE "OPER_CODE",
O.OPERATOR_NAME "OPER_NAME",
O.ACTIVE_STATUS "Act",
r.receipt_no "receipt_no",
r.ch_or_dd_no "cheque",
r.receipt_date "receipt_date",
'' "channel Code",
'' "channel_name",
b. SUBS_IRD "ird_subs",
b.amount "amount"
FROM
dms_channel_dump z,
DMS_OPERATOR_MASTER O,
DMS_DISTRIBUTOR_MAIN D,
dms_receipt_header r,
DMS_BIFURCATION b
WHERE
b.channel_code = z.channel_code
and r.OPERATOR_CODE = O.OPERATOR_CODE
AND r.DISTRIBUTOR_CODE = D.DISTRIBUTOR_CODE
AND r.receipt_no = b.receiopt_no
union all
SELECT
D.DISTRIBUTOR_CODE "DIST_CODE",
D.DISTRIBUTOR_NAME "DIST_NAME",
'' "OPER_CODE",
'' "OPER_NAME",
'N' "Act",
r.receipt_no "receipt_no",
r.ch_or_dd_no "cheque",
r.receipt_date "receipt_date",
b.channel_code "channel Code",
z.channel_name "channel_name",
b. SUBS_IRD "ird_subs",
b.amount "amount"
FROM
dms_channel_dump z,
DMS_OPERATOR_MASTER O,
DMS_DISTRIBUTOR_MAIN D,
dms_receipt_header r,
DMS_BIFURCATION b
WHERE
b.channel_code = z.channel_code
and r.OPERATOR_CODE is null
AND r.DISTRIBUTOR_CODE = D.DISTRIBUTOR_CODE
AND r.receipt_no = b.receiopt_no
order by 4,7
ERROR:
ORA-12801: error signaled in parallel query server P004
ORA-00904: invalid column name
no rows selecte
REGARDS AND TIA
ADOLPHIf the data never changes, there would be no reason to gather statistics.
If the data changes, there may or may not be a reason to gather statistics. There is some risk to gathering statistics because that can cause query plans to change and you could find that a query that was working fine yesterday is running very slowly today. Failing to gather statistics, though, can have the same effect-- if a histogram on a column indicates that the maximum value of a date field is December 1, 2006 because you haven't updated statistics in a few days, the CBO may conclude that a query this column with a value of December 4 would return very few row, rather than the many rows that are really there, causing Oracle to use a different query plan. Oracle tends to believe that the latter risk is more of a concern than the former and in 10g regularly and automatically gathers statistics unless you susped that job. Some DBAs disagree with Oracle and prefer less frequent, more controlled statistics gathering.
If you GATHER AUTO, assuming your tables are set to MONITORING, Oracle gathers statistics on every table that has had more than some cutoff percentage of rows changed since statistics were last gathered. This cutoff is generally pretty reasonable, though ideally you'd probably want to gather statistics more frequently on smaller tables (adding 30 new rows to a 100 row table is probably more significant from a query plan perspective than adding 3 million rows to a 10 million row table) and less frequently on larger tables, more frequently on tables that have volatile data distributions (i.e. our DATE table) and less frequently on tables whose data distribution is relatively constant.
Justin -
I'm trying to write a PL/SQL function to dynamically return a query with varying # of columns. I've done this type of thing before wiith much success, however this is the first time I'm using a cursor for loop within a function to accomplish my task.
here is the error I get:
ORA-01858: a non-numeric character was found where a numeric was expected
Error ERR-1101 Unable to process function body returning query.
Mind you I have tested the PL/SQL from a SQL editor and it works fine. I'm confused.
Code is below.
Thanks in advance!
DECLARE
my_query varchar2(4000);
string1 varchar2(50) := 'select city, ';
string2 varchar2(4000) := '' ;
string3 varchar2(4000):= 'from
( select a.title, a.city, a.start_date, sum(a.total_stu) cnt
from sj_class_summary3 a
group by a.title, a.city, a.start_date
having a.title = :P4_COURSE )
group by title, city';
TYPE date_tab_type IS TABLE OF date INDEX BY PLS_INTEGER;
date_tbl date_tab_type;
i number;
BEGIN
i:=1;
for myrec in (select distinct start_date from sj_class_summary3
where start_date between :P4_START_DATE and :P4_END_DATE order by 1) loop
date_tbl(i) := myrec.start_date;
string2 := string2 || ' max( decode( start_date, ''' || date_tbl(i) || ''', cnt,0) ) "' || date_tbl(i) || '", ';
i := i+ 1;
end loop;
string2 := SUBSTR(string2,1,LENGTH(string2)-2);
string2 := string2 || ' ';
my_query := string1 || string2 || string3;
return my_query;
END;Hi Bob,
you also have another date to character to date conversion in:
decode( start_date, ''' || date_tbl(i) || ''', cnt,0)
does this need to be:
decode( start_date, to_date(''' || to_char(date_tbl(i), 'dd/mm/yyyy') || ''', ''dd/mm/yyyy''), cnt,0)
Regards
Michael -
Problems in Query, error handling and sqlj
I need some clarifications:
1. Can I use where clause in Insert query: for e.g: Insert into table_name (.., ...) values (.., ..) where id not in (Select Id from table_2 where name = '');
2. Can I handle error in my query in sqlj file. For e.g unique constraint violated error, I want to handle it like try-catch block in Java. So that if there would be any such error it will ignore.
3. I want to do this both in the sqlj file. Is it possible?
If anyone can answer it would be a great help for me.more appropriate forums :
PL/SQL
JDeveloper and ADF
SQL-Syntax and much more :
http://tahiti.oracle.com/
http://download.oracle.com/docs/cd/E11882_01/server.112/e10592/toc.htm
http://download.oracle.com/docs/cd/E11882_01/server.112/e10592/statements_9014.htm#i2163698
http://download.oracle.com/docs/cd/E11882_01/server.112/e10592/statements_9014.htm#i2079995
http://download.oracle.com/docs/cd/E11882_01/server.112/e10592/statements_9014.htm#i2145081 -
Query Errors: ORA-01036: illegal variable name/number
Hi All,
When I run a query against two tables within our data warehouse I am getting an IO Exception. Due to company restrictions I can't quickly increase my IO Limit So what I have done is written a query that cycles through all of the large tables partitions and extracts the data.
The problem I get is that when I run this query in Toad. It thinks my :MI, :SS are variables and wont run this. Does anyone know what I can do to resolve this issue?
create table completion_log
action_complate_dt date,
table_name varchar2(1000),
partition_number varchar2(1000)
nologging
compress ;
create table STORE_DATA_HERE
field_1 varchar2(1000),
field_2 date,
field_3 varchar2(1000)
nologging
compress ;
commit;
begin
for ptn in (select partition_name p from all_tab_partitions t where table_name='REALLY_LARGE_TABLE')
loop
execute immediate q'^
insert /*+ APPEND */ into STORE_DATA_HERE
SELECT field_1,
field_2,
field_3
FROM REALLY_LARGE_TABLE partition (^'||ptn.p||q'^)
WHERE field_3 IN ( 'XXXX', 'YYYY')
AND data_date BETWEEN TO_DATE('07/12/2011 00:00:00', 'DD/MM/YYYY HH24:MI:SS')
AND TO_DATE('08/12/2011 23:59:59', 'DD/MM/YYYY HH24:MI:SS')
^';
insert into completion_log values (sysdate,'STORE_DATA_HERE',ptn.p);
commit;
end loop;
end;In your case it is quite easy...
just remove the collons from the format and the literal...and off you go
begin
for ptn in (select partition_name p from all_tab_partitions t where table_name='REALLY_LARGE_TABLE')
loop
execute immediate q'^
insert /*+ APPEND */ into STORE_DATA_HERE
SELECT field_1,
field_2,
field_3
FROM REALLY_LARGE_TABLE partition (^'||ptn.p||q'^)
WHERE field_3 IN ( 'XXXX', 'YYYY')
AND data_date BETWEEN TO_DATE('07/12/2011 000000', 'DD/MM/YYYY HH24MISS')
AND TO_DATE('08/12/2011 235959', 'DD/MM/YYYY HH24MISS')
^';
insert into completion_log values (sysdate,'STORE_DATA_HERE',ptn.p);
commit;
end loop;
end; -
Fail to create SQL query report because of ORA-00923
Hi expert,
I would like to SQL query report using the following query:
select min(identified_date) first_identified,
max(actual_COMPLETE) last_closed,
count(id) total_issues,
sum(decode(status,'Open',1,0)) open_issues,
sum(decode(status,'Pending',1,0)) pending_issues,
sum(decode(status,'Resolved',1,0)) closed_issues,
sum(decode(status,'Will Not Resolve',1,0)) not_resolve_issues,
sum(decode(status,
'Open',decode(priority,null,1,0),
0)) open_no_prior,
sum(decode(status,
'Open',decode(priority,1,1,0),
0)) open_prior_1,
sum(decode(status,
'Open',decode(priority,'2',1,0),
0)) open_prior_2
sum(decode(status,
'Open',decode(priority,3,1,0),
0)) open_prior_3,
sum(decode(status,
'Open',decode(priority,'4',1,0),
0)) open_prior_4,
sum(decode(status,
'Open',decode(priority,5,1,0),
0)) open_prior_5
from SOFTPROJ_issues
where project_id = :P83_PROJECT
However, I got the following error during the steps of creation:
1 error has occurred
Query cannot be parsed, please check the syntax of your query. (ORA-00923: FROM¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿)
I wonder why if it is getting the error because I could create the report with the following query without problems:
select min(identified_date) first_identified,
max(actual_COMPLETE) last_closed,
count(id) total_issues,
sum(decode(status,'Open',1,0)) open_issues,
sum(decode(status,'Pending',1,0)) pending_issues,
sum(decode(status,'Resolved',1,0)) closed_issues,
sum(decode(status,'Will Not Resolve',1,0)) not_resolve_issues,
sum(decode(status,
'Open',decode(priority,null,1,0),
0)) open_no_prior,
sum(decode(status,
'Open',decode(priority,1,1,0),
0)) open_prior_1,
sum(decode(status,
'Open',decode(priority,3,1,0),
0)) open_prior_3,
sum(decode(status,
'Open',decode(priority,5,1,0),
0)) open_prior_5
from SOFTPROJ_issues
where project_id = :P83_PROJECT
1 error has occurred
Query cannot be parsed, please check the syntax of your query. (ORA-00923: FROM¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿)
The difference is to add the followings only:
sum(decode(status,
'Open',decode(priority,'2',1,0),
0)) open_prior_2
sum(decode(status,
'Open',decode(priority,'4',1,0),
0)) open_prior_4,
Does anyone have any idea to resolve the issue?
Thanks in advance,
RuiBy putting a comma after open_prior_2:
sum(decode(status,
'Open',decode(priority,'2',1,0),
0)) open_prior_2,Sima -
Database Adapter ORA-00923 problem...
I made "Execute custom SQL" in database adapter and this shows this error "ORA-00923: FROM keyword not found where expected", the Query works perfect in SQLDeveloper..
This is the Query:
SELECT
id_tarea,
SUBSTR(MAX(REPLACE(
SYS_CONNECT_BY_PATH(mail_responsable, '/')
,'/',', ')),2) Concatenated_String
FROM (
select a.id_cambio, a.id_tarea, a.mail_responsable,
row_number() OVER (Partition by id_cambio, id_tarea order by id_cambio) ROW#
FROM tareas_cambio A where a.id_cambio = 2 and a.id_tarea in (1, 2, 8))
START WITH ROW#=1
CONNECT BY PRIOR id_cambio=id_cambio AND PRIOR row# = row# -1
GROUP BY id_tarea;
Thanks for your help..I found the solotion!!
Create the view with a sqript and from sqlplus and NOT from Toad.
or
Goto <Project Folder> -> <database> -> <apps> -> <xxxx.view> ,go to the end, and remove the NUL value.
Thanks for the help any way!
Rafikki -
Hi,
I want to change the database field name in a query. That is, I have several fields in the database called cappto00, cappt01 and cappto02.
The cappto00 value is the present week, the cappt01 value is the following and catppto02 the following of cappt01 and the names for every field are S-1,S-2 and S-3.
I typed the following query
select cappto00 as concat('S-',to_char(sysdate,'ww'),
cappto01 as concat('S-',to_char(sysdate,'ww'+1),cappto02 as concat('S-',to_char(sysdate,'ww'+2)
from esml.sml_canels
But I have the following error:
ora-00923: FROM keyword not found where expected.
I know the alias must be a string. How can I do it?
Thanks.Would I prefer to create VIEW though procedure?
So every week or whenever necessary you can execute the
procedure to re-create view with new columns( according to your
supposed week number).
SQL> create table sms( cappto00 number,
2 cappto01 number, cappto02 number ) tablespace jam;
Table created.
SQL> insert into sms values(1001,2001,3001);
1 row created.
SQL> create or replace procedure sms_pro as
2 m varchar2(10):=concat('S_',to_char(sysdate,'WW'));
3 n varchar2(10):=concat('S_',to_char(sysdate,'WW')+1);
4 p varchar2(10):=concat('S_',to_char(sysdate,'WW')+2);
5 begin
6 execute immediate 'create or replace view ' ||
7 'sms_view('||m||','||n||','||p||') as select * from sms';
8 end;
9 /
Procedure created.
SQL> execute sms_pro
PL/SQL procedure successfully completed.
SQL> select * from sms_view;
S_30 S_31 S_32
1001 2001 3001 -
Dbms_sql in a different schema from query table-error ** ORA-00942
Oracle Experts,
I think I am having problems with using DBMS_SQL in which the function was created in one schema and the query table was created in a different schema.
We have 2 schemas: S1, S2
We have 2 tables:
T1 in Schema S1
T2 in Schema S2
We have a function F1 created by DBA in schema S1 that uses the dbms_sql as:
CREATE OR REPLACE FUNCTION S1.F1(v1 in VARCHAR2) return NUMBER IS
cursor1 INTEGER;
BEGIN
cursor1 := dbms_sql.open_cursor;
dbms_sql.parse(cursor1, v1, dbms_sql.NATIVE);
dbms_sql.close_cursor(cursor1);
return (0);
EXCEPTION
when others then
dbms_sql.close_cursor(cursor1);
return (1) ;
END;
I am using jdeveloper 11G. We have an Oracle DB 11g.
We have a java program which uses jdbc to talk to our Oracle DB.
Basically, in my java program, I call function F1 to check if the query is valid.
If it is, it returns 0. Otherwise, returns 1:
oracle.jdbc.OracleCallableStatement cstmt = (oracle.jdbc.OracleCallableStatement) connection.prepareCall ("begin ? := S1.F1 (?); end;");
cstmt.registerOutParameter (1, java.sql.Types.INTEGER);
cstmt.setString(2, "Select * from S2.T2");
cstmt.execute ();
Since the table that I run the query is T2, created in different schema than F1 was created in, I have the error:
** ORA-00942: table or view does not exist
So my questions are these:
- I am using Oracle DB 11g, if I run the query on a table that created in a different schema from the one that the function (which uses dbms_sql) was created in, I would get the error ORA-00942?
- If I runs the query on table T1 in the same schema as the function F1, would I have the same problem(The reason I ask is I cannot create any table in schema S1 because the DBA has to do it; I am not a DBA)
- This is not a problem, but a security feature because of SQL injection?
- How to resolve this issue other than creating the table in the same schema as the function that utilizes DBMS_SQL?
Regards,
BinhDefiner rights (default) stored objects run under owner's security domain and ignore role based privileges. So regardless what user you are logged in as, function S1.F1 always executes as user S1 and ignores user S1 roles. Therefore exeuting statement within S1.F1:
Select * from S2.T2requires user S1 to have SELECT privilege on S2.T2 granted to S1 directly, not via role.
SY. -
Error: ORA-01722: invalid number performing List of Values query.
when i created a cascading select list, For the first time it worked properly then little later
it is giving this error.
Error: ORA-01722: invalid number performing List of Values query: "select distinct cl_name d, cl_no r from Kclient where gr_no = :P1_GRNO order by 1
could any one please solve the problem?
2. when i run the application. in all the items edit button is automatically seen
including in the login screen.
could any one identify what is the error and give me a solution.Is this better?
select DISTINCT FIRST_NAME||' '||LAST_NAME display_value
, ROW_ID return_value
from "PSA_RESOURCE_MANAGER"
where PSA_RESOURCE_MANAGER.ACTIVE_FLAG='Y'
AND :P117_REPORTING_MANAGER = PSA_RESOURCE_MANAGER.REPORTING_MANAGER
AND :P117_REPORTING_MANAGER <> -1 order by 1or
select DISTINCT FIRST_NAME||' '||LAST_NAME display_value
, ROW_ID return_value
from "PSA_RESOURCE_MANAGER"
where PSA_RESOURCE_MANAGER.ACTIVE_FLAG='Y'
AND :P117_REPORTING_MANAGER = PSA_RESOURCE_MANAGER.REPORTING_MANAGER
AND :P117_REPORTING_MANAGER != '-1' order by 1Is ROW_ID a column in your table by the way? If not, you should use ROWID (without the underscore) -
SQL-Query with JDBC returns error ORA-00600
Hi,
I try to execute a SQL-Query using JDeveloper 3.2.3 and the Oracle JDBC-Library 8.1.7
The following statement
'ResultSet rset=stmt.executeQuery(SQL-String);'
where stmt is Statement returns a Database-Error
ORA-00600 with the Arguments [ttcgcshnd-1], [0] [], [], [], [], [], []
when the SQL-String queries Varchar2 or CHAR-Columns.
The Query returns correct values for numeric fields.
The Database-Server is running on Oracle 9i
Does anybody know, what could be the reason?
Thanks, HaroldI found many forums about it also, but I still haven't got solution yet.
They talk about the cause, and report to oracle group and so on,
but I still don't know how to solve my problem and how to enable my oracle 9i jdbc driver working.
Need help please -
ORA-12801 error signalled in parallel query with ORA-00018 max # session
Hello,
I've just run dbca to create a new database. On completion I received the following:
ORA-12801 error was signalled in parallel query server
ORA-00018 maximum number of sessions exceeded
ORA-06512 at sys_utl_recomp line 760
ORA-06512 as sys_utl_recomp line 773
ORA-06512 as sys_utl_recomp line 1
The processes are set at 100, sessions is set at 115?
Can you tell how to address this error and resolve the problem? I'm thinking that I should rerun sys_utl_recompHi,
You didn't mention oracle version as well OS.
might be you hit a bug.
check the below link for reference
https://metalink2.oracle.com/metalink/plsql/f?p=130:14:8051847734518941130::::p14_database_id,p14_docid,p14_show_header,p14_show_help,p14_black_frame,p14_font:NOT,21564.1,1,1,1,helvetica
Regards,
Taj -
i am facing problem when configuring listener.ora and tnsnamess.ora in listener side it is showing The listener supports no services The command completed successfully and in when i cross check with listener from tns it is showing the error
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor
here is my listener file
lsn =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.125.128)(PORT = 1575))
#ADR_BASE_LISTENER = /u01/app/oracle
(SID_LIST_LISTENER=
(SERVICE_NAME=kull)
(ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1)
tnsnames.ora
to_lsn=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = server1)(PORT = 1575))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = kull )
my database name is kull
please somebody helpBiswaranjan wrote:
i have two database one is kull and another is kk
i configured listener.ora in kull
and tnsnames.ora in kk
when i am running lsnrctl start listener in database kull
This makes no sense. You don't configure a listener nor a tnsnames.ora "in a database". I hope this is just a language issue and not reflective of a fundamental misunderstanding of how tns works.
read: http://edstevensdba.wordpress.com/2011/02/09/sqlnet_overview/ Help! I can’t connect to my database
read: http://edstevensdba.wordpress.com/2011/02/16/sqlnet_client_cfg/ Help! I can’t connect to my database (part duex)
it is showing the message
Alias lsn
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 05-JUL-2013 19:08:06
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/product/11.2.0/db_1/log/diag/tnslsnr/server1/lsn/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1575)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=server1)(PORT=1575)))
The listener supports no services
The command completed successfully
and in another database in kk when i am giving the command tnsping to_lsn
it is giving this message
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = server1)(PORT = 1575)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = kull)))
OK (0 msec)
but when i am cross check sqlplus system/manager@ to_lsn
it is giving the following error
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor -
Getting error SQL Error : ORA-14551: cannot perform a DML operation inside a query
Hi gurus ,
Your help is greatly appreciated ..
I am doing some changes in the fucntion for an existing package .Introducing the new below check , am updating one of the tables based on a if condition ..
IF numALLOWED_COUNT >= numLAST_COUNT_ADDED+1 THEN
blnGDS_Allowed :=True;
varSTMT := 'UPDATE PROD.TMS_PROCESS_COUNTER ';
varSTMT := varSTMT ||' SET last_count_added = last_count_added+1';
varSTMT := varSTMT ||' WHERE process_name = ''DAILY_GDS_COUNT''';
varSTMT := varSTMT ||' AND COUNTER_IND = ''750FD130''';
PROC_LOG('Update Tms_Process_counter varSTMT --' || varSTMT);
IF INSERT_BATCH(99,varSTMT) > 0 THEN
NULL;
END IF;
Function for insert_batch :
UNCTION INSERT_BATCH(numTABLE_ID IN NUMBER, varSQL_STATEMENT IN VARCHAR2) RETURN NUMBER IS
varINSERT_BATCH_STMT VARCHAR2(32767) := NULL;
varADD_REC_TYPE BATCH_TABLES.ADD_REC_TYPE%TYPE;
BEGIN
PROC_LOG( 'INSIDE INSERT_BATCH IRC : ' || varSQL_STATEMENT ); --IRC 9/20 UC
INSERT INTO BATCH_STATEMENT(QUEUE_ID,TABLE_ID,STATEMENT,QUEUE_SEQUENCE_ID)
VALUES (numQUEUE_ID,numTABLE_ID,varSQL_STATEMENT,1);
RETURN 1;
EXCEPTION WHEN OTHERS THEN
PROC_LOG('Failed in INSERT_BATCH');
PROC_LOG('SQL Error : ' || SUBSTR(SQLERRM,1,1000));
RETURN -1;
END INSERT_BATCH;
desc PROD.BATCH_STATEMENT
QUEUE_ID NUMBER(15) NOT NULL
TABLE_ID NUMBER(2) NOT NULL
STATEMENT VARCHAR2(4000 BYTE) NOT NULL
QUEUE_SEQUENCE_ID NUMBER(5) NOT NULL
Some how when its calling the insert_batch , its giving me the error in the logs as below:
04:01:41 - Update Tms_Process_counter varSTMT --UPDATE PROD.TMS_PROCESS_COUNTER SET last_count_added = last_count_added+1 WHERE process_name = 'DAILY_GDS_COUNT' AND COUNTER_IND = '750FD130'
04:01:41 - INSIDE INSERT_BATCH IRC : UPDATE PROD.TMS_PROCESS_COUNTER SET last_count_added = last_count_added+1 WHERE process_name = 'DAILY_GDS_COUNT' AND COUNTER_IND = '750FD130'
04:01:41 - Failed in INSERT_BATCH
04:01:41 - SQL Error : ORA-14551: cannot perform a DML operation inside a querySome how when its calling the insert_batch , its giving me the error in the logs as below:
04:01:41 - SQL Error : ORA-14551: cannot perform a DML operation inside a query
Yes - and the exception is telling you EXACTLY what the problem is. You have a query
IF INSERT_BATCH(99,varSTMT) > 0 THEN
And you are performing a DML operation inside that query:
INSERT INTO BATCH_STATEMENT(QUEUE_ID,TABLE_ID,STATEMENT,QUEUE_SEQUENCE_ID)
VALUES (numQUEUE_ID,numTABLE_ID,varSQL_STATEMENT,1);
Like the exception says: you can't do that.
You need to call the function using PL/SQL and capture the return value into a variable. Then test that variable:
myVar := INSERT_BATCH(99,varSTMT);
if myVar > 0 THEN -
Error ORA-01652 while running select query
A select query returning millions of records is returning the following error.
SQL Error [
ORA-01652: unable to extend temp segment by 128 in tablespace TEMP
We requested DBA to increased the TEMP tablespace. He increased it to 20GB and also, changed to Autoextent.
When we executed the query again, we got the same error ?
What could be the reason of this issue and how it can be resolved ?All sort operations that don't fit into the SORT_AREA_SIZE will go to the temp tablespace (they can be seen as direct writes in the trace file).
It can easy be the case, that your temp tablespace needs to be many GB in size [we have a table with millions of rows and for the loading/merging our temp is 80GB in size].
May be you can change your process of loading i.e. with this select you fill a intermediate table (with CTAS) and do your processing there or even try to do the processing in SQL while building the table. You could also try to do the processing with a cursor and BULK COLLECT LIMIT 100 and then inserting into the target table with the FORALL statement.
Maybe you are looking for
-
Using actions to process photos
This question was posted in response to the following article: http://help.adobe.com/en_US/photoshopelements/using/WS57a26560eb6a24db1e1a3067139e6fd9e17- 8000.html
-
GoldenGate and Oracle Express Edition ??
Hi Experts I hoppe you can help me, Can I use OGG with Oracle Express Edition ?? Kind Regards J.A.
-
Save for Web Issues with PS CC
Whenever I try to save for web, no matter which preference I choose to save as, my images are defaulting to GIF's at 256 colors, causing my images to be very grainy. I've tried resetting my preferences, and reinstalling PS CC to no avail. Any pointer
-
Aliging Fields in Custom Check-in Form
Hi, I have created profile, it have total 6-fields. Check-in and everything working fine!!!! Am facing issue in aligning fields... Like i want to align sale, below price... While adding fields I've selected price as below of sale and also Am using ar
-
Flash audio player not playing in safari (it shows but does not play).
Basically i own an internet radio station and for some reason the web player (flash player) no longer plays in Safari since i upgraded to OS X Lion, was working before but not now, it does show the player it just does not play any audio, however it d