Query runs fine in 9i but results to ORA-01652 unable to extend temp in 10g
Hi,
We are having issues in running a SQL query in 10g. In 9i, it runs fine with no problems but when run in 10g, It takes forever and the temp tablespace grows very large upto 60GB until we get ORA-01652 error due to lack of disk space. This does not occur in 9i, where query runs in only 20 mins and does not take up temp that big. 9i version is 9.2.0.8. 10g is 10.2.0.3
Heres the SQL query:
SELECT
J2.EMPLID,
TO_CHAR(J2.EFFDT,'YYYY-MM-DD'),
J2.EFFSEQ,
J2."ACTION",
J2.ACTION_REASON,
TO_CHAR(J2.GRADE_ENTRY_DT,'YYYY-MM-DD'),
J2.COMPRATE,
J2.CHANGE_AMT,
J2.COMP_FREQUENCY,
J2.STD_HOURS,
J2.JOBCODE,
J2.GRADE,
J2.PAYGROUP,
PN2.NATIONAL_ID,
TO_CHAR(PC.CHECK_DT,'YYYY-MM-DD'),
SUM(PO.OTH_EARNS),
To_CHAR(SUM(PO.OTH_EARNS)),
PO.ERNCD,
'3',
TO_CHAR(PC.PAY_END_DT,'YYYY-MM-DD'),
PC.PAYCHECK_NBR
FROM PS_JOB J2,
PS_PERS_NID PN2,
PS_PAY_OTH_EARNS PO,
PS_PAY_CHECK PC
WHERE J2.EMPL_RCD = 0
AND PN2.EMPLID = J2.EMPLID
AND PN2.COUNTRY = 'USA'
AND PN2.NATIONAL_ID_TYPE = 'PR'
AND J2.COMPANY <> '900'
AND J2.EFFDT <= SYSDATE
AND PC.EMPLID = J2.EMPLID
AND PC.COMPANY = PO.COMPANY
AND PC.PAYGROUP = PO.PAYGROUP
AND PC.PAY_END_DT = PO.PAY_END_DT
AND PC.OFF_CYCLE = PO.OFF_CYCLE
AND PC.PAGE_NUM = PO.PAGE_NUM
AND PC.LINE_NUM = PO.LINE_NUM
AND PC.SEPCHK = PO.SEPCHK
AND EXISTS (SELECT ERNCD
FROM PS_P1_CMP_ERNCD P1_CMP
WHERE P1_CMP.ERNCD = PO.ERNCD AND EFF_STATUS = 'A')
GROUP BY J2.EMPLID,
J2.EFFDT,
J2.EFFSEQ,
J2.ACTION,
J2.ACTION_REASON,
J2.GRADE_ENTRY_DT,
J2.COMPRATE,
J2.CHANGE_AMT,
J2.COMP_FREQUENCY,
J2.STD_HOURS,
J2.JOBCODE,
J2.GRADE,
J2.PAYGROUP,
PN2.NATIONAL_ID,
PC.CHECK_DT,
PO.ERNCD,
'3',
PC.PAY_END_DT,
PC.PAYCHECK_NBR
Similar Messages
-
How to find which query ORA-1652: unable to extend temp segment by 128 in
How can i find which query caused the below error,the query is not running currently
ORACLE ERRORS IN ALERTS LOG dnb2stg3 - lnx300 on Thu Jun 17 12:10:01 EDT 2010
1 ORA-1652: unable to extend temp segment by 128 in tablespace TEMP_SCHED
SQL> select inst_id, tablespace_name, total_blocks, used_blocks, free_blocks from gv$sort_segment;
INST_ID TABLESPACE_NAME TOTAL_BLOCKS USED_BLOCKS FREE_BLOCKS
1 TEMP 638336 0 638336
4 TEMP 565760 0 565760
4 TEMP_SCHED 16776704 0 16776704
3 TEMP 484864 0 484864
3 TEMP_SCHED 0 0 0
2 TEMP 455808 0 455808
6 rows selected.
SQL> SQL> SELECT S.sid || ',' || S.serial# sid_serial, S.username,
2 T.blocks * TBS.block_size / 1024 / 1024 mb_used, T.tablespace,
3 T.sqladdr address, Q.hash_value, Q.sql_text
FROM v$sort_usage T, gv$session S, gv$sqlarea Q, dba_tablespaces TBS
4 5 WHERE T.session_addr = S.saddr
6 AND T.sqladdr = Q.address (+)
7 AND T.tablespace = TBS.tablespace_name
8 ORDER BY S.sid;
no rows selectedHello,
You may try to catch the SQL with a Servererror Trigger.
This link will give you an interesting example:
http://oratips-ddf.blogspot.com/2008/09/to-err-is-human.html
Hope this help.
Best regards,
Jean-Valentin -
Query to find which past ses caused ORA-1652: unable to extend temp segment
Hi,
I m trying to get information on the sessions/sql query that have cause ORA-1652: unable to extend temp segment from past 2 days. Basically need to know which all sessions in past 2 days have caused ORA-1652: unable to extend temp segment.
I have generated the AWR report but not able to figure it out which sessions caused this error.
Thanks in advance913410 wrote:
Hi,
I m trying to get information on the sessions/sql query that have cause ORA-1652: unable to extend temp segment from past 2 days. Basically need to know which all sessions in past 2 days have caused ORA-1652: unable to extend temp segment.
I have generated the AWR report but not able to figure it out which sessions caused this error.
Thanks in advance
01652, 00000, "unable to extend temp segment by %s in tablespace %s"
// *Cause: Failed to allocate an extent of the required number of blocks for
// a temporary segment in the tablespace indicated.
// *Action: Use ALTER TABLESPACE ADD DATAFILE statement to add one or more
// files to the tablespace indicated. -
A javaScript code that runs fine in IE but not in other plz help
Hello friends,
plese help me in getting the code for Opera and Mozilla browsers. The following code runs fine in IE but not in other browsers. it show titlebar in other browsers. What to do disable titlebar in other browsers? plz help
<html>
<head>
<script>
//Frameless Banner Popup
// Set the url of the banner popup window page
//var theURL = "index.htm";
var theURL = "/cgi-bin/login";
// Set the title of the popup window
var title = "Login"
// Set the size of the popup window
var windowWidth = 350; // cannot be less than 100
var windowHeight = 350; // cannot be less than 100
//var windowWidth = window.screen.width; // cannot be less than 100
//var windowHeight = window.screen.height; // cannot be less than 100
// Set the position of the popup window
var windowX = ((window.screen.width/2) - 175);
var windowY = ((window.screen.height/2) - 175);
// Set true to auto-center (positions will be ignored)
var autocenter = false;
// Set true for popup to close when launch page does
var autoclose = false;
var s="width="+windowWidth+",height="+windowHeight;
var beIE=document.all?true:false;
var done=new Object("no");
if(autocenter){
windowX = (window.screen.width-windowWidth)/2;
windowY = (window.screen.height-windowHeight)/2;
function doAgilePopup(){
if (beIE){
agilePopper = window.open("","popAgile","fullscreen,"+s);
agilePopper.blur();
window.focus();
agilePopper.resizeTo(windowWidth,windowHeight);
agilePopper.moveTo(windowX,windowY);
var frameString=""+
"<html>"+
"<head>"+
"<title>"+title+"</title>"+
"</head>"+
"<frameset rows='*,0' framespacing=0 border=0 frameborder=0>"+
"<frame name='top' src='"+theURL+"' scrolling=no>"+
"<frame name='bottom' src='about:blank' scrolling='no'>"+
"</frameset>"+
"</html>"
agilePopper.document.open();
agilePopper.document.write(frameString);
agilePopper.document.close();
}else{
agilePopper=window.open(theURL,"popAgile","scrollbars=no,"+s);
agilePopper.blur();
window.focus();
agilePopper.resizeTo(windowWidth,windowHeight);
agilePopper.moveTo(windowX,windowY);
agilePopper.blur();
if (autoclose){
window.onunload = function(){agilePopper.close();}
done="okay";
</script>
</head>
<BODY onLoad="doAgilePopup(),top.window.close()">
</body>
</html>missing semicolon in end of the variable frameString ,
better write the string in single line thats easy to find the bugs like this.
var frameString=""+
"<html>"+
"<head>"+
"<title>"+title+"</title>"+
"</head>"+
"<frameset rows='*,0' framespacing=0 border=0 frameborder=0>"+
"<frame name='top' src='"+theURL+"' scrolling=no>"+
"<frame name='bottom' src='about:blank' scrolling='no'>"+
"</frameset>"+
"</html>" -
Query running ok in SQL but giving error in form trigger
Hi guys
here is the query
SELECT NVL(BGM_PERAMT,0) INTO PERAMT FROM BROKERAGE_MASTER
WHERE BGM_BROKERAGETYPE = 'BR01' AND BGM_PERAMT <> 0
The above query working fine in SQL but giving following error in when_button_pressed trigger
[In a host language program, all records have been fetched. The return code from the fetch was +4 indicating that all records have been returned from the SQL query. ]
please give me the solution for this problem.
It is very urgent
regards
ashaok below is the code
CURSOR RESALE_BROKERAGE IS SELECT am_brokerCd resalebrcd,'' resalesbrcd,NVL(SUM(AM_AMT),0) RESALE_AMT,COUNT(AM_RESALENO) TOTCNT,NVL(SUM(AM_UNITSAPPLD),0) RESALE_UNITS
FROMRNT_RESALE_MASTER
WHERE am_brokercd is not null AND AM_PROCTAG='Y' AND
(to_date(to_char(AM_PROCDT,'DD/MON/YYYY')) BETWEEN
to_date(to_char(:rnt_broker_date.fromdt,'DD/MON/YYYY')) AND
to_date(to_char(:rnt_broker_date.todate,'DD/MON/YYYY')))
GROUP BY am_brokerCd
UNION
SELECT AM_BROKERCD resalebrcd,
am_subbrokercd resalesbrcd,
NVL(SUM(AM_AMT),0) RESALE_AMT,COUNT(AM_RESALENO) TOTCNT,
NVL(SUM(AM_UNITSAPPLD),0) RESALE_UNITS
FROM RNT_RESALE_MASTER
WHERE am_brokercd is not null AND AM_PROCTAG='Y' AND AM_BROKERCD = 'ARN-9760' AND (to_date(to_charAM_PROCDT,'DD/MON/YYYY')) BETWEEN
to_date(to_char(:rnt_broker_date.fromdt,'DD/MON/YYYY')) AND
to_date(to_char(:rnt_broker_date.todate,'DD/MON/YYYY')))
GROUP BY AM_BROKERCD,am_subbrokercd;
Asha -
EBS Forms functional script runs fine in OpenScript but not from OTM
Hi,
I have an EBS forms functional test script which runs fine in OpenScript, but when scheduled from OTM, the web part runs fine but when it comes to forms, the script fails with the following error:
Forms Object Not Found! XPath: //forms:window[(@name='NAVIGATOR')], Type: oracle.oats.scripting.modules.formsFT.helper.test.FormWindow, Cause: No Matches <Less>
I have performed all the steps below already:
1) Stopping the OATS Agent service and changing it to manual.
2) Starting the command prompt and running the AgentManagerService command as mentioned in your forum.
3) The console displays
C:\>C:\OracleATS\agentmanager\bin\AgentManagerService.exe -c AgentManagerService
.conf
wrapper | --> Wrapper Started as Console
wrapper | Launching a JVM...
jvm 1 | Wrapper (Version 3.0.3)
jvm 1 |
4) I have added the test in the OTM with the following command line settings:
-browser.type InternetExplorer -formsft.startup_timeout 30 -formsft.action_timeout 20 -formsft.response_timeout 10 -delayPercentage -1 -delayMin 0 -delayMax 5 -FormsAutomationEnabler.bat -enableForms true
But each time the script fails, please note that my script has assets and they are placed within the script folder.
Please help me on this at earliest.
Thanks,
AartiHello Aarti!
I had the same problem and this steps help to solve the problem:
You need to enable Forms Automation under agent. Please follow by below steps.
1.open command prompt
2.cd C:\OracleATS\agent
3.FormsAutomationEnabler.bat -enableForms true
4. Run script from OTM
Attila -
Mail runs fine at first but after awhile it freezes the machine. I have shut the mac down and restart. I am running Mountain Lion which was updated from Leopard. I reinstalled original programs from disk and solved this same problem with Contact. Mail is still a problem. May also include itunes which seems to add to the problem.
Run Disk Utility to check the SMART status of your hard drive.
-
More than 100 Mb space in tablespace but keeps having ORA-1653 unable to ex
Platform AIX 6.1
Oracle version 10.2.0.5.3
JOB_DET is a single table in one tablespace D_LGA1. It's space taken is 12096 Mb, the tablespace is capped at 12288 Mb, so technically it has 191 Mb free space.
13:06:55 SQL> select segment_name,tablespace_name,bytes/1024/1024 as mbytes
13:07:13 2 from dba_segments where segment_name='JOB_DET';
SEGMENT_NAME TABLESPACE_NAME MBYTES
JOB_DET D_LGA1 12096
13:08:00 SQL> select tablespace_name, sum(bytes/1024/1024) as sum_mb,
sum(maxbytes/1024/1024) as sum_maxbytes_mb, AUTOEXTENSIBLE
from dba_data_files
where tablespace_name in ('D_LGA1') group by tablespace_name, autoextensible order by 1;
TABLESPACE_NAME SUM_MB SUM_MAXBYTES_MB AUTOEXTEN
D_LGA1 12288 12288 YES
13:08:16 SQL> select tablespace_name, sum(bytes/1024/1024) as sum_free_mb
13:08:25 2 from dba_free_space where tablespace_name in ('D_LGA1')
13:08:32 3 group by tablespace_name order by 1;
TABLESPACE_NAME SUM_FREE_MB
D_LGA1 191.8125however I keep getting ORA-1653 in the alert log.
Thu Mar 08 13:09:54 TAIST 2012
ORA-1653: unable to extend table ADMIN.JOB_DET by 128 in tablespace D_LGA1
ORA-1653: unable to extend table ADMIN.JOB_DET by 8192 in tablespace D_LGA1
...OK, this is weird, but nevertheless, I added another datafile, which allows it to extend the size.
After which, the size of the segment JOB_DET is 12160 Mb, which was lesser than the original max size!! There doesnt seem to be any fragmentation going on there. I'm puzzled. Someone able to explain?
14:42:26 SQL> select segment_name,tablespace_name,bytes/1024/1024 as mbytes
14:42:28 2 from dba_segments where segment_name='JOB_DET';
SEGMENT_NAME TABLESPACE_NAME MBYTES
JOB_DET D_LGA1 12160Edited by: len on Mar 8, 2012 3:05 PMHi sybrand,
would this help?
SQL> select * from dba_tables where table_name='JOB_DET';
OWNER TABLE_NAME TABLESPACE_NAME CLUSTER_NAME IOT_NAME STATUS PCT_FREE PCT_USED INI_TRANS
MAX_TRANS INITIAL_EXTENT NEXT_EXTENT MIN_EXTENTS MAX_EXTENTS PCT_INCREASE FREELISTS FREELIST_GROUP
BLOCKS EMPTY_BLOCKS AVG_SPACE CHAIN_CNT AVG_ROW_LEN AVG_SPACE_FREELIST_BLOCKS NUM_FREELIST_BLO
DEGREE INSTANCES CACHE TABLE_LO SAMPLE_SIZE LAST_ANAL PAR
IOT_TYPE T S NES BUFFER_ ROW_MOVE GLO USE DURATION SKIP_COR MON CLUSTER_OWNER DEPENDEN
COMPRESS DRO
ADMIN JOB_DET D_LG06 VALID 5 2
255 65536 1048576 1 2147483645 YES N 51475345
1531830 0 0 0 158 0 0
1 1 N ENABLED 51475345 10-FEB-12 NO
N N NO DEFAULT DISABLED YES NO DISABLED YES DISABLED
DISABLED NO
SQL> select * from dba_free_space where tablespace_name='D_LGA1';
TABLESPACE_NAME FILE_ID BLOCK_ID BYTES BLOCKS RELATIVE_FNO
D_LGA1 28 516100 67043328 8184 28
D_LGA1 36 516105 67043328 8184 36
D_LGA1 75 8201 37814272 4616 75
D_LGA1 119 516105 67043328 8184 119
SQL> select * from dba_tablespaces where tablespace_name='D_LGA1';
TABLESPACE_NAME BLOCK_SIZE INITIAL_EXTENT NEXT_EXTENT MIN_EXTENTS MAX_EXTENTS PCT_INCREASE MIN_EXTLE
CONTENTS LOGGING FOR EXTENT_MAN ALLOCATIO PLU SEGMEN DEF_TAB_ RETENTION BIG
D_LGA1 8192 65536 1 2147483645 65536 ONLINE
PERMANENT LOGGING NO LOCAL SYSTEM NO AUTO DISABLED NOT APPLY NOEach data file has roughly 64 Mb free space in them, the only way I can think it would result in ORA-1653 is if what the application was trying to insert/update far exceeds 64 Mb at one go?
This is my assumption, or am I out of the box already? -
ORA-1653: unable to extend table - but enough space for datafile
We encountered this problem in one of our database Oracle Database 10g Release 10.2.0.4.0
We have all datafiles in all tablespaces specified with MAXSIZE and AUTOEXTEND ON. But last week database could not extend table size
Wed Dec 8 18:25:04 2013
ORA-1653: unable to extend table PCS.T0102 by 128 in tablespace PCS_DATA
ORA-1653: unable to extend table PCS.T0102 by 8192 in tablespace PCS_DATA
Wed Dec 8 18:25:04 2013
ORA-1653: unable to extend table PCS.T0102 by 128 in tablespace PCS_DATA
ORA-1653: unable to extend table PCS.T0102 by 8192 in tablespace PCS_DATA
Wed Dec 8 18:25:04 2013
ORA-1653: unable to extend table PCS.T0102 by 128 in tablespace PCS_DATA
ORA-1653: unable to extend table PCS.T0102 by 8192 in tablespace PCS_DATA
Datafile was created as ... DATAFILE '/u01/oradata/PCSDB/PCS_DATA01.DBF' AUTOEXTEND ON NEXT 50M MAXSIZE 31744M
Datafile PCS_DATA01.DBF had only 1GB size. Maximum size is 31GB but database did not want to extend this datafile.
We used temporary solution and we added new datafile to same tablespace. After that database and our application started to work correctly.
There is enough free space for database datafiles.
Do you have some ideas where could be our problem and what should we check?
ThanksShivendraNarainNirala wrote:
Hi ,
Here i am sharing one example.
SQL> select owner,table_name,blocks,num_rows,avg_row_len,round(((blocks*8/1024)),2)||'MB' "TOTAL_SIZE",
2 round((num_rows*avg_row_len/1024/1024),2)||'Mb' "ACTUAL_SIZE",
3 round(((blocks*8/1024)-(num_rows*avg_row_len/1024/1024)),2) ||'MB' "FRAGMENTED_SPACE"
4 from dba_tables where owner in('DWH_SCHEMA1','RM_SCHEMA_DDB','RM_SCHEMA') and round(((blocks*8/1024)-(num_rows*avg_row_len/1024/1024)),2) > 10 ORDER BY FRAGMENTED_SPACE;
OWNER TABLE_NAME BLOCKS NUM_ROWS AVG_ROW_LEN TOTAL_SIZE ACTUAL_SIZE FRAGMENTED_SPACE
DWH_SCHEMA1 FP_DATA_WLS 14950 168507 25 116.8MB 4.02Mb 112.78MB
SQL> select tablespace_name from dba_segments where segment_name='FP_DATA_WLS' and owner='DWH_SCHEMA1';
TABLESPACE_NAME
DWH_TX_DWH_DATA
SELECT /* + RULE */ df.tablespace_name "Tablespace",
df.bytes / (1024 * 1024) "Size (MB)",
SUM(fs.bytes) / (1024 * 1024) "Free (MB)",
Nvl(Round(SUM(fs.bytes) * 100 / df.bytes),1) "% Free",
Round((df.bytes - SUM(fs.bytes)) * 100 / df.bytes) "% Used"
FROM dba_free_space fs,
(SELECT tablespace_name,SUM(bytes) bytes
FROM dba_data_files
GROUP BY tablespace_name) df
WHERE fs.tablespace_name = df.tablespace_name
GROUP BY df.tablespace_name,df.bytes
UNION ALL
SELECT /* + RULE */ df.tablespace_name tspace,
fs.bytes / (1024 * 1024),
SUM(df.bytes_free) / (1024 * 1024),
Nvl(Round((SUM(fs.bytes) - df.bytes_used) * 100 / fs.bytes), 1),
Round((SUM(fs.bytes) - df.bytes_free) * 100 / fs.bytes)
FROM dba_temp_files fs,
(SELECT tablespace_name,bytes_free,bytes_used
FROM v$temp_space_header
GROUP BY tablespace_name,bytes_free,bytes_used) df
WHERE fs.tablespace_name = df.tablespace_name
GROUP BY df.tablespace_name,fs.bytes,df.bytes_free,df.bytes_used
ORDER BY 4 DESC;
set lines 1000
col FILE_NAME format a60
SELECT SUBSTR (df.NAME, 1, 60) file_name, df.bytes / 1024 / 1024 allocated_mb,
((df.bytes / 1024 / 1024) - NVL (SUM (dfs.bytes) / 1024 / 1024, 0))
used_mb,
NVL (SUM (dfs.bytes) / 1024 / 1024, 0) free_space_mb
FROM v$datafile df, dba_free_space dfs
WHERE df.file# = dfs.file_id(+)
GROUP BY dfs.file_id, df.NAME, df.file#, df.bytes
ORDER BY file_name;
Tablespace Size (MB) Free (MB) % Free % Used
DWH_TX_DWH_DATA 11456 8298 72 28
FILE_NAME ALLOCATED_MB USED_MB FREE_SPACE_MB
/data1/FPDIAV1B/dwh_tx_dwh_data1.dbf 1216 1216 0
/data1/FPDIAV1B/dwh_tx_dwh_data2.dbf 10240 1942 8298
SQL> alter database datafile '/data1/FPDIAV1B/dwh_tx_dwh_data2.dbf' resize 5G;
alter database datafile '/data1/FPDIAV1B/dwh_tx_dwh_data2.dbf' resize 5G
ERROR at line 1:
ORA-03297: file contains used data beyond requested RESIZE value
Although , we did moved the tables into another TB , but it doesn't resolve the problem unless we take export and drop the tablespace aand again import it .We also used space adviser but in vain .
As far as metrics and measurement is concerned , as per my experience its based on blocks which is sparse in nature related to HWM in the tablespace.
when it comes to partitions , just to remove fragmentation by moving their partitions doesn't help .
Apart from that much has been written about it by Oracle Guru like you .
warm regards
Shivendra Narain Nirala
how does free space differ from fragmented space?
is all free space considered by you to be fragmented?
"num_rows*avg_row_len" provides useful result only if statistics are current & accurate. -
ORA-1653: unable to extend table (but tablespace is not full!)
Hi folks,
I was navigating through the Alert Log file and I'm strangely noticing the error:
ORA-1653: unable to extend table PROMO.DETAILS by 40973 in tablespace PROMO
I'm defining it as strange because:
(1) The tablespace is only 65% full (there are 750MB of freespace), and
(2) There is ample space on the harddisk
I then used TOAD to try to debug the problem and there is a tool which allows me to view a map of the tablespace. I could see that the tablespace "PROMO" had indeed freespace, but the table "DETAILS" looked like it had no space where to extend (there was a table both before, and after it in the map). Is there a way to solve this problem , or isn't a problem at all?this problem occurs because
your table don't find one big free space for next extent in tablespace.
solutions:-
1st solution
* alter tablespace <tablespace_name> add datafile ' path';
OR
2nd solution
- coalesce your tablespace 'alter tablespace <tablespace name> coalesce'.
OR
3rd solution
check u r pctincrease parameter if it is 50 then
ALTER TABLE <tablename> STORAGE (NEXT 1M PCTINCREASE 0);
kuljeet pal singh -
Execute query run fine with numeric data not give result on string data
Hi master
Sir I use under blow code for execute query
sir when I use numeric data then run fine but when I use character data then not give any result
with numeric run fine
DECLARE
DD VARCHAR2(15);
BEGIN
DD:=10;
set_block_property('emp', default_where, 'where DEPTNO='||DD);
go_block('emp');
execute_query;
set_block_property('emp', default_where, '');
END;
With character not give any result
DECLARE
DD VARCHAR2(15);
BEGIN
DD:='SALESMAN';
set_block_property('emp', default_where, 'where RTRIM(EMPNO)='||DD);
go_block('emp');
execute_query;
set_block_property('emp', default_where, '');
END;
Please give me any ideabro it is not working on string format coz of the missing quotes. e.g. 'smith' or smith. so the quoted string will be compared. in set_block_property u have to include extra quotes on the variable. e.g.
set_block_property('emp',default_where,'where ename='''||:emp.ename||'');
or with conditional statement
set_block_property('emp',default_where,'where ename='''||:emp.ename||''' and dname='''||dept.deptno||'');
there i included two extra qoutes before joining ename and in the an extra quote to complete to string. if u would like to debug at runtime to show if the qouted string condition is proper then assign the where clause to a variable and message it up.
like
myvariable:='where ename='''||:emp.ename||'';
message(myvariable);
message(myvariable);
set_block_property('emp',default_where,myvariable);
after the string is quoted properly the execute query will work fine, also use the function upper or lower to compare strings.
zaibi. -
Query running fine in one environment but failing in other environment
Hi,
I have a query which i am trying to execute in two different environments.
Test :- Oracle Database 11g Release 11.2.0.1.0 - 64bit Production
Prod:- Oracle Database 11g Release 11.2.0.1.0 - 64bit Production
Now query executes finely in one environment and fails in other environment.
It gives following error.
ORA-01861: literal does not match format string
01861. 00000 - "literal does not match format string"
The query is too long and contains CHAR-DATE and DATE-CHAR conversions.
The same query works fine on TEST environment and and fails on PROD environment.
Any help related to it would be appreciated.
Thanks,
MaheshMaheshGx wrote:
Hi,
I have a query which i am trying to execute in two different environments.
Test :- Oracle Database 11g Release 11.2.0.1.0 - 64bit Production
Prod:- Oracle Database 11g Release 11.2.0.1.0 - 64bit Production
Now query executes finely in one environment and fails in other environment.
It gives following error.
ORA-01861: literal does not match format string
01861. 00000 - "literal does not match format string"
The query is too long and contains CHAR-DATE and DATE-CHAR conversions.
The same query works fine on TEST environment and and fails on PROD environment.
Any help related to it would be appreciated.
Thanks,
MaheshThat's called a bug. One caused by the person who developed the code. They relied on implicit conversion between strings and dates when
production quality code will always use to_char and to_date functions with a format mask. -
Query runs in management studio but not in SQLAgent job
I have the following query which runs fine in Management Studio but when I put it in a SQLAgent job it fails saying
Error formatting query, probably invalid parameters (SQLState 42000 Error 22050)I have tried changing Quote characters but to no avail.
Does anybody have any idea why this would be happening?
Regards
Ron
declare @servername nvarchar(150)
set @servername = @@servername
declare @mysubject nvarchar(200)
set @mysubject = 'Toners adjusted out '+@servername+'.'
EXEC msdb.dbo.sp_send_dbmail @recipients='[email protected]',
@subject = @mysubject,
@body = 'Toners were adjusted out. View attachment to see the details',
@query = 'use livedatabase;select trc_part, trc_job, trc_qty, trc_inits from livedatabase.dbo.Traces
where trc_part like "TONER%"
and CAST(trc_date as date) = CAST(getdate() as date)
and trc_typ = "O"',
@query_result_width = 600,
@attach_query_result_as_file = 1I have another SQLAgent job that is almost identical in what it does, ie sending an email with a query result and it works fine. See below.
Therefore it can't be permissions or dbmail setup but I cannot see what it is.
--== This is for SQL 2005 and higher. ==--
--== We will create a temporary table to hold the error log detail. ==--
--== Before we create the temporary table, we make sure it does not already exist. ==--
IF OBJECT_ID('tempdb.dbo.ErrorLog') IS Not Null
BEGIN
DROP TABLE tempdb.dbo.ErrorLog
END
--== We have checked for the existence of the temporary table and dropped it if it was there. ==--
--== Now, we can create the table called tempdb.dbo.ErrorLog ==--
CREATE TABLE tempdb.dbo.ErrorLog (Id int IDENTITY (1, 1) NOT NULL,
logdate DATETIME, procInfo VARCHAR(10), ERRORLOG VARCHAR(MAX))
--== We create a 3 column table to hold the contents of the SQL Server Error log. ==--
--== Then we insert the actual data from the Error log into our newly created table. ==--
INSERT INTO tempdb.dbo.ErrorLog
EXEC master.dbo.sp_readerrorlog
--== With our table created and populated, we can now use the info inside of it. ==--
BEGIN
--== Set a variable to get our instance name. ==--
--== We do this so the email we receive makes more sense. ==--
declare @servername nvarchar(150)
set @servername = @@servername
--== We set another variable to create a subject line for the email. ==--
declare @mysubject nvarchar(200)
set @mysubject = 'Deadlock event notification on server
'+@servername+'.'
--== Now we will prepare and send the email. Change the email address to suite your environment. ==--
EXEC msdb.dbo.sp_send_dbmail @recipients='[email protected]',
@subject = @mysubject,
@body = 'Deadlock has occurred. View attachment to see the deadlock info',
@query = 'select logdate, procInfo, ERRORLOG from tempdb.dbo.ErrorLog where Id >= (select TOP 1 Id from tempdb.dbo.ErrorLog WHERE ERRORLOG Like ''%Deadlock encountered%'' order by Id DESC)',
@query_result_width = 600,
@attach_query_result_as_file = 1
END
--== Clean up our process by dropping our temporary table. ==--
DROP TABLE tempdb.dbo.ErrorLog -
Same Conect By query workds fine in 9i but not in 10g - Please help
We recently moved our project from 9i to 10g. A connect by query works fine in 9i environment but same not working in 10g environment. Please help.
While trying with a sample table, that also behaves samem way. Please find the query and help on how to solve.
create table test_connect_by (
parent number,
child number,
constraint uq_tcb unique (child)
insert into test_connect_by values ( 5, 2);
insert into test_connect_by values ( 5, 3);
insert into test_connect_by values (18,11);
insert into test_connect_by values (18, 7);
insert into test_connect_by values (17, 9);
insert into test_connect_by values (17, 8);
insert into test_connect_by values (26,13);
insert into test_connect_by values (26, 1);
insert into test_connect_by values (26,12);
insert into test_connect_by values (15,10);
insert into test_connect_by values (15, 5);
insert into test_connect_by values (38,15);
insert into test_connect_by values (38,17);
insert into test_connect_by values (38, 6);
insert into test_connect_by values (null, 38);
insert into test_connect_by values (null, 26);
insert into test_connect_by values (null, 18);
COMMIT;
In Oracle 10g:
SQL> select level, lpad(' ',2*(level-1)) || to_char(child) s
2 from test_connect_by
3 start with level = 1
4 connect by prior child = parent;
no rows selected
In Oracle 9i:
SQL> select level, lpad(' ',2*(level-1)) || to_char(child) s
2 from test_connect_by
3 start with level = 1
4 connect by prior child = parent;
LEVEL S
1 2
1 3
1 10
1 5
2 2
2 3
1 9
1 8
1 11
1 7
1 13
1 1
1 12
1 15
2 10
2 5
3 2
3 3
1 17
2 9
2 8
1 6
1 38
2 15
3 10
3 5
4 2
4 3
2 17
3 9
3 8
2 6
1 26
2 13
2 1
2 12
1 18
2 11
2 7
39 rows selected.Hi,
user10739895 wrote:
It works fine and gives result without the "START WITH LEVEL = 1".
However, in 9i, we get the result with the clause "START WITH LEVEL = 1" and after migrating, now in 10g, we are not getting the result. Is it like in 10g, if it is Level 1, we should not specify?
Also, please clarify, is it like, if we don't specify the default is Level 1? Conceptually, LEVEL is assigned when rows enter the result set. Rows that enter because of the START WITH clause, by definition, have LEVEL=1. Rows that enter because of CONNECT BY have the LEVEL of the row to which they are connected, plus 1.
"START WITH LEVEL = 1" returns no rows when I try it in Oracle 11.1.0.
I suggest not using it.
If you don't have a START WITH clause, you'll START WITH every row in the table. That seems to be what you got in Oracle 9. Is that what you want? If so, then just don't use a START WITH clause. -
Query working fine in toad but not in forms 6i
i have following coding on when button press triger
declare
CURSOR C1(year number,month number) IS
SELECT ITM_NO,ITM_NAME,XAQ QTY,XAQ*TP VAL,gp
FROM
select ci.itm_no ITM_NO,ci.itm_name ITM_NAME ,cpg.group_id gp ,xaq ,ALLIED.CORP_PRIC_TP( ci.itm_no)TP from
select prod_no,sum(xaq)*1 xaq
from
select prod_no, sum(nvl(xrd_sqty,0)) Xaq
from allied.mrk_01_02
where year=year and f_prd=month
and area_id in (10200,10400,10100,10300,10500,20500,20300,20100,20200,20400,30100,30400,30300,30200)
group by prod_no
union all
select prod_no, sum(nvl(xrd_sqty,0)) Xaq
from allied.mrk_02_02
where year=year and f_prd=month
and area_id in (10200,10400,10100,10300,10500,20500,20300,20100,20200,20400,30100,30400,30300,30200)
group by prod_no
union all
select prod_no, sum(nvl(xrd_sqty,0)) Xaq
from allied.mrk_03_02
where year=year and f_prd=month
and area_id in (10200,10400,10100,10300,10500,20500,20300,20100,20200,20400,30100,30400,30300,30200)
group by prod_no
union all
select prod_no, sum(nvl(xrd_sqty,0)) Xaq
from allied.mrk_04_02
where year=year and f_prd=month
and area_id in (10200,10400,10100,10300,10500,20500,20300,20100,20200,20400,30100,30400,30300,30200)
group by prod_no
group by prod_no
) A,allied.corp_inv ci,allied.corp_01_01 c01, allied.corp_01_02 c02,allied.corp_prod_group cpg,allied.v_prod_grp vpg
where ci.itm_no=a.prod_no
and ci.itm_no=c02.itm_no
and c01.grp_id=c02.grp_id
and c01.grp_id in(55,56,57,58,59)
and vpg.prod_no =ci.itm_no
and vpg.group_id=cpg.group_id
where XAQ <>0;
Begin
delete from fiaz.tmp_topten_prod;
for i in c1(:year,:month)
loop
insert into fiaz.tmp_topten_prod
values(i.itm_no,i.itm_name,i.qty,i.val,i.gp,0);
end loop;
standard.commit;
message('inserted in temp');
exception when others then
message (dbms_error_text);
message (dbms_error_text);
End;
Same Query (as used in cursor c1) works fine in toad but giving wrong result from forms... and the problem is xaq field i.e returns incorrect qty...
i guess union clause is not working in this situation...
plz suggest me the appropriate changes in the query to work well from form as well...
combination:Forms 6i,Oracle 8.0.6
Regards,
Usman AfzalAs per your suggestion i have created a stored procedure but the followin error prevents procedure creation
create or replace procedure fiaz.topten_prod(v_yr number,v_mn number) is
begin
delete from fiaz.tmp_topten_prod;
insert into fiaz.tmp_topten_prod(itm_no,itm_name,qty,val,grp_id,prority)
SELECT ITM_NO,ITM_NAME,XAQ QTY,XAQ*TP VAL,gp,0
FROM
select ci.itm_no ITM_NO,ci.itm_name ITM_NAME ,cpg.group_id gp ,xaq ,ALLIED.CORP_PRIC_TP( ci.itm_no)TP from
select prod_no,sum(xaq) xaq
from
select prod_no, sum(nvl(xrd_sqty,0)) Xaq from allied.mrk_01_02
where year=v_yr and f_prd=v_mn
and area_id in (10200,10400,10100,10300,10500,20500,20300,20100,20200,20400,30100,30400,30300,30200)
group by prod_no
union all
select prod_no, sum(nvl(xrd_sqty,0)) Xaq
from allied.mrk_02_02
where year=v_yr and f_prd=v_mn
and area_id in (10200,10400,10100,10300,10500,20500,20300,20100,20200,20400,30100,30400,30300,30200)
group by prod_no
union all
select prod_no, sum(nvl(xrd_sqty,0)) Xaq
from allied.mrk_03_02
where year=v_yr and f_prd=v_mn
and area_id in (10200,10400,10100,10300,10500,20500,20300,20100,20200,20400,30100,30400,30300,30200)
group by prod_no
union all
select prod_no, sum(nvl(xrd_sqty,0)) Xaq
from allied.mrk_04_02
where year=v_yr and f_prd=v_mn
and area_id in (10200,10400,10100,10300,10500,20500,20300,20100,20200,20400,30100,30400,30300,30200)
group by prod_no
group by prod_no
) A,allied.corp_inv ci,allied.corp_01_01 c01, allied.corp_01_02 c02,allied.corp_prod_group cpg,allied.v_prod_grp vpg
where ci.itm_no=a.prod_no
and ci.itm_no=c02.itm_no
and c01.grp_id=c02.grp_id
and c01.grp_id in(55,56,57,58,59)
and vpg.prod_no =ci.itm_no
and vpg.group_id=cpg.group_id
where XAQ <>0;
commit;
end;
Error:
"PLS-00201: identifier ALLIED.MRK_01_02 must be declared "
i have not changed any thing in query working fine in toad without create procedure text and if i describe this table it shows the structure (desc allied.mrk_01_02)
Now where is the problemmmmm
Plz Help
Maybe you are looking for
-
Add hyperlink in a page to direct to a .pdf report in oracle ADF jdeveloper
Hi, I want to put a hyperlink, which will direct the user to the report. but I am getting the problem with, "where should I put the pdf file" any help please??? here is my code: <a target="_blank" href="/faces/DocumentationKNM.pdf">Guide Book</a> wh
-
Looking for BOM and Routing objects created with a BAPI
(I ran this one up the flagpole in the data forum and didn't get any responses. Maybe someone here has see this phenomon?) I'm invoking BAPI_MATERIAL_BOM_GROUP_CREATE from an external Java program. I believe my code matches the example I find here a
-
Video FX- fast/ reverse/ slow problems?
Why is it that when i slow down the speed of a clip, it seems to jitter/ shake just a bit? Is that how it is supposed to happen.. Shouldnt the movement be smooth? Thanks!
-
HT204289 how do I stream my ipad to my samsung smart tv?
Am I able to stream from my Ipad to my Samsung Smart TV? Thanks for your help
-
XI IDOC Master Data Synch with Change Pointer (GLMAST)
Hi, I have scenario to create integration between 2 SAP system with XI 7.0 using IDOC - GLMAST. I already acitvate Change Pointer Globally (BD61) and Activate Change Pointer for GLMAST (BD50). The problem is whenever changes have done in system 1, 2