Divisor is equal to zero......Help...plz
Hi all.
I tried to get a tablespace and fragmentation information with blow script.
But I got an error(ORA-1476 : divisor is equal to zero)
How can I fix the script properly ?
Could anybody help me to fix the script?
Thanks in advance.
select tablespace_name,sum(obj_cnt) object_count,sum(ini_ext) init_ext,sum(nex_ex
t) next_ext,sum(byte)/1048576 bytesize,
(sum(byte)/1048576)- (sum(fbyte)/1048576) byteused,sum(fbyte)/1048576 bytefree,
sum(frags), sum(largest)/1048576 avail,
(sum(fbyte)/sum(byte))*100 free
from (select tablespace_name,0 obj_cnt,0 ini_ext,0 nex_ext, 0 byte, sum(bytes) fb
yte, count(*) frags, max(bytes) largest
from dba_free_space
group by tablespace_name
union
select tablespace_name,0, 0, 0, sum(bytes), 0, 0, 0 from dba_data_files
group by tablespace_name
union
select tablespace_name, 0, initial_extent/1024 ini_ext, next_extent/1024 nex_ext,
0,0,0,0
from dba_tablespaces
union
select tablespace_name, count(*) obj_cnt, 0, 0, 0, 0, 0, 0
from dba_segments
group by tablespace_name)
group by tablespace_name
The various NVL and DECODE solutions may get rid of the error, but will not get you the correct answer. By the way, you may want to look at the differences in behaviour between
(sum(fbyte)/decode(sum(byte),0,NULL))*100 free and
(sum(fbyte)/decode(sum(byte),0,1))*100 free before you use either.
Your real problem is that you have a temp tablespace using temporary files. This is the right thing to do, but, you need another union in your statement, to access dba_temp_files:
SELECT tablespace_name,SUM(obj_cnt) object_count,
SUM(ini_ext) init_ext, SUM(nex_ext) next_ext,
SUM(byte)/1048576 bytesize,
(SUM(byte)/1048576)- (SUM(fbyte)/1048576) byteused,
SUM(fbyte)/1048576 bytefree, SUM(frags), SUM(largest)/1048576 avail,
(SUM(fbyte)/SUM(byte))*100 free
FROM (SELECT tablespace_name, 0 obj_cnt, 0 ini_ext, 0 nex_ext, 0 byte,
SUM(bytes) fbyte, COUNT(*) frags, MAX(bytes) largest
FROM dba_free_space
GROUP BY tablespace_name
UNION ALL
SELECT tablespace_name,0, 0, 0, sum(bytes), 0, 0, 0
FROM dba_data_files
GROUP BY tablespace_name
UNION ALL
SELECT tablespace_name,0, 0, 0, sum(bytes), 0, 0, 0
FROM dba_temp_files
GROUP BY tablespace_name
UNION ALL
SELECT tablespace_name, 0, initial_extent/1024 ini_ext,
next_extent/1024 nex_ext, 0,0,0,0
FROM dba_tablespaces
UNION ALL
SELECT tablespace_name, COUNT(*) obj_cnt, 0, 0, 0, 0, 0, 0
FROM dba_segments
GROUP BY tablespace_name)
GROUP BY tablespace_nameYou should also use UNION ALL instead of UNION, because UNION implies a sort distinct, whil union all does not. The sort is unneccessary, and the distinct may cause you to lose rows.
TTFn
John
Similar Messages
-
BI Report Error:ORA-01476: divisor is equal to zero
I have written the Query containing the Pl/SQL procedures and is working fine when executed ,but when I am using the same query for the BI Publisher report , in the Runtime the report is giving error *"ORA-01476: divisor is equal to zero"* .
Please provide me with the answers and help ,as it is most important for me to get it solved.Hi,
Try this...
case when nvl(Y,0) = 0 then 0 else (X/Y) end
Replace your columns in place of X and Y in your query..
hope helps you....
Cheers,
Aravind -
HP QUERY DATA ERROR((SQLER=ORA01476 divisor is equal to zero
Experts,
We are seeing the following error in Inventory Optimization Horizontal Plan
HP QUERY DATA ERROR((SQLER=ORA01476 divisor is equal to zero
Navigation
Sign on as Inventory Planner responsibility, Inventory Plan > Workbench
Select the plan owning org, so you can see all orgs.
View by organizations
Select org: <Org Code>
Select Category <category>,
item <Item name
Right click, select Horizontal Plan > Default
Can you help please.Well the easiest way to troubleshoot this problem would be to find the row where FBASEVOLTAGE = 0. Something like this maybe:
SELECT BV.FBASEVOLTAGE
, FB.FMAGNITUDE_RESULT
, BS.IUBUSNO
FROM GN
JOIN GM ON GM.IELEMENT_MAP_ID = GN.IELEMENT_MAP_ID
JOIN BS ON GM.NPS_ELEMENT_ID = BS.IUBUSID
AND GM.NPS_ELEMENT_TYPE = 101
JOIN CONFIG_BASE_VOLTAGE BV ON BS.IBASEVOLTAGEID = BV.IBASEVOLTAGEID
JOIN FACT_BUS FB ON FB.IBUS_NO = BS.IUBUSID
AND FB.IPS_CASE_ID = GN.IPS_CASE_ID
WHERE BV.FBASEVOLTAGE = 0
AND GN.IPS_CASE_ID = 1637
; -
ORA-01476: divisor is equal to zero Error in tabular form
Hello,
My tabular form will give me this error sometimes: Error in add row internal routine: ORA-01476: divisor is equal to zero. I don't understand what causes it. On the form I have a on load - before header process that will add 5 blank rows automatically, which was wizard generated. This error doesn't always happen, when I turn off this process and then turn it back on it works fine. Currently I have to set the condition to never, so I don't get the error. Is this a bug with Apex?
Also, when there is data available I have to click on the next arrow for the data to display.
Please advise.
Thanks,
Mary
Edited by: MaryM on Feb 26, 2010 9:49 AM
Edited by: MaryM on Mar 2, 2010 11:16 AMHello,
I have the same error message for ADD ROWS in tabular form. It is also happens when I try to open one empty record using On Load when page rendered. Have you found a fix for that ?
Thanks,
Marina -
Divisor is equal to zero in date function
Hi
I have used a query like this but am getting error like divisor is equal to zero
with s_mon as (select to_char(add_months(trunc(sysdate,'rr'),level-1),'Mon-RR') month from dual connect by level <=12)
select s_mon.month,
tgdate
from abc ,s_mon
where to_char(tgdate(+),'Mon-RR')=s_mon.month
Result should be like this
month tgtdate
jan-12 01-01-12
feb-12 05-02-12
mar-12
apr-12
dec-12
Edited by: vishnu prakash on 27-May-2012 00:32Vishnu,
I did not get any error for the below statements; Does this not match with yours? If not, then please post your table structure, data and the exact query in which you are facing error.
drop table test_table;
create table test_table (pk_col number, col date);
insert into Test_table values (3, to_date('MAY-2012', 'MON-RR'));
insert into Test_table values (4, to_date('DEC-2012', 'MON-RR'));
select * from test_table;
with t as
select to_char(add_months(trunc(sysdate, 'rr'), level - 1), 'MON-RR') month
from dual
connect by level <= 12
select b.month, a.col
from test_table a,
t b
where to_char(a.col(+), 'MON-RR') = b.month
MONTH COL
APR-12
AUG-12
DEC-12 01-DEC-12
FEB-12
JAN-12
JUL-12
JUN-12
MAR-12
MAY-12 01-MAY-12
NOV-12
OCT-12
SEP-12 Regards,
P. -
Divisor is equal to zero error
Hi, I am getting divisor is equal to zero error while doing a calculation using sql. Is there a workaround this ?
ThanksWhat do you want to do, if the divisor is 0?
Is the SQL executed in SqlPlus or in a procedure/function?
Hi, I am getting divisor is equal to zero error while doing a calculation using sql. Is there a workaround this ?
Thanks -
How can i resolve divisor is equal to zero
hi,
i have the situation like i am calculating the column values. in that one field divided by other. but in that divisor field have zero. for that it's giving the error.
please help to do so...
example: select 8/o from dual;
error: ora-01476divisor equal to zeroindra wrote:
i have the situation like i am calculating the column values. in that one field divided by other. but in that divisor field have zero. for that it's giving the error.Either exclude it by adding:
divisor != 0to WHERE clause or use:
CASE divisor
WHEN 0 THEN whatever_result_you_want_for_zero_divisor
ELSE divident / divisor
ENDSY.
Edited by: Solomon Yakobson on Sep 19, 2011 6:47 AM -
Error in add row internal routine: ORA-01476: divisor is equal to zero
Hi,
I am using Tabular Form Report in my application. So, when the user enters the page for the first time, no fields appear (if he has previously not entered any values in the DB). So to avoid this I added a Data Manipulation process-> Add rows to tabular Form ->On load after footer, so that when the user logins whether he entered previous values or not, he can see some empty fields, but this is not working as expected.
Any ideas how to resolve this issue.Hmm other people have had this errorm found this hope it helps,
Hi,
Have a look at: Re: Add Row in detail table when check box is checked on a master report table as this shows how you can use javascript to clone a row -
Ora-01476 divisor is equal to zero
hi!
ROUND(SUM(VALOR_VDA) / SUM(DECODE(QTDE_VDA,0,1,QTDE_VDA)),2)
Oracle 10.2.0.1.0
Red Hat Enterprise 5is this QTDE_VDA field numeric
The only issues here with the decode is see is if the total value of all the rows when summed is 0 - zero then you will have zero-divide error
SS
Message was edited by:
user478316 -
ORA-01476: divisor equal to zero
When I try to run this query I get error 'ORA-01476: divisor equal to zero'. How can I write the query so it understand that it not should use Sum(SalesQuantity)=0 And Sum(Net_Sales)=0 in the Case?
SELECT year_month, customer,
(Sum(Case When record_type NOT IN ('B', 'E') And NET_SALES <> '0' Then NET_SALES Else Null End)/
Sum(Case When record_type NOT IN ('R', 'P') And SALES_QUANTITY <> '0' Then SALES_QUANTITY Else Null End)) As Test
Where Period_date Between to_date('2007-01-01','yyyy-mm-dd') And to_date('2007-09-30','yyyy-mm-dd')
FROM tbltest
Group By year_month, customerI generally use
whatever / NULLIF(expression, 0)Message was edited by:
William Robertson -
i had backup my iphone .. and it started but later it showed no space.. so i had to stop the backup..and had gone to preference>device and deleted the backup.. but still my iphone shows the availabilty as zero..plz help.. how to get the available space that was before..
rabidrabbit wrote:
Can I back up my iPhone 4S to my ipad 3 (64 gb)?
no
rabidrabbit wrote:
However, now I don't have enough space in iCloud to backup either device. Why not?
iCloud only give so much space for free storage, then if you exceed the limit of 5gb you have to pay for additional storage. -
How can I set my y-intercept (b) equal to zero retina macbook 2014
Hello everyone,
I hope you can reply to my question before 11:55p.m. today because that is when my report is due. I graphed my scatter plot and got my trend line, but my professor wants the class to set the y-intercept, the (b) from y=mx+b to zero. Can you guide me step by step on how to do that? I tried clicking on the Data section, then x-value, typed zero, but my graph disappeared. I am supposed to be using Excel for this, but I only have numbers. Can you set the y-int equal to zero using Numbers as well?Hi Theonlymary,
The LINEST function returns an array of the statistics for a straight line that best fits the given data using the least squares method.
LINEST(known-y-values, known-x-values, nonzero-y-intercept, more-stats)
Type = in a spare cell to bring up the Function Panel. Type LINEST in the search box to see help on that function.
I don't use LINEST but it seems you can get extra stats from an array that it returns.
It won't change your graph (it doesn't need a graph).
Regards,
Ian. -
Run Time error!!!Help plz
hi ..
every time i run my application i get this error which i can't understand where exactly the error is
can any one help plz
)at javax.swing.JLayeredPane.paint(JLayeredPane.java:546
)at javax.swing.JComponent.paintChildren(JComponent.java:498
)at javax.swing.JComponent.paint(JComponent.java:669
)at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:23
:at sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java
)54
at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:91
)at java.awt.Container.paint(Container.java:960
)at javax.swing.JFrame.update(JFrame.java:329
)at sun.awt.RepaintArea.update(RepaintArea.java:337
)at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:200
)at java.awt.Component.dispatchEventImpl(Component.java:2663
)at java.awt.Container.dispatchEventImpl(Container.java:1213
)at java.awt.Window.dispatchEventImpl(Window.java:914
)at java.awt.Component.dispatchEvent(Component.java:2497
)at java.awt.EventQueue.dispatchEvent(EventQueue.java:339
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
)read.java:131
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
)ad.java:98
)at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93
)at java.awt.EventDispatchThread.run(EventDispatchThread.java:85
this is part of the code:
public void actionPerformed(ActionEvent e)
FileInputStream fis = null;
if (e.getSource() == add) //The ADD button.
//User has not populated all the input fields.
if(name.getText().equals("")|| address.getText().equals("")|| phone.getText().equals("")|| sex.getText().equals("")|| dob.getText().equals("")|| photo.getText().equals(""))
JOptionPane.showMessageDialog(null, "Please fill in all the fields","Missing Fields",JOptionPane.INFORMATION_MESSAGE);
else
// save the new customer:
try
//1. take the customer's data and photo:
int userId = Integer.parseInt(id.getText());
String userName = name.getText();
String userAddress = address.getText();
String userPhone = phone.getText();
String userSex = sex.getText();
String userDateBirth = dob.getText();
//String userDateBirth=Date.parse(dob);
String photoName = photo.getText();
String audioName= audio.getText();
File file = new File(photoName);
int fileLength = (int)file.length();
//2. Set the user's photo into the photoHolder:
photoHolder.setVisible(false);
photoHolder = null;
comments.setVisible(false);
comments = null;
Icon[] custPhotos = {new ImageIcon(photoName)};
JList photosList = new JList(custPhotos);
photosList.setFixedCellHeight(100);
photosList.setFixedCellWidth(80);
photoHolder = new JPanel();
photoHolder.add(photosList);
makeComments();
//3. Insert the data and photo into the database:
if(fileLength > 0)
fis = new FileInputStream(file);
String query = " INSERT INTO CUSTOMER VALUES('"+userId+"', '"+ userName+ "', '"+ userAddress+ "', " +" '"+ userPhone+ "', '"+ userSex+ "', '"+ userDateBirth+ "', ?,?,? ) ";
PreparedStatement pstmt = conn.prepareStatement(query);
pstmt.setBinaryStream(1, fis, fileLength);
pstmt.setString(2,photoName);
pstmt.setString(3,audioName);
pstmt.executeUpdate();
comments.setText(userName+", added.");
else
String query = " INSERT INTO CUSTOMER (id, name, address, phone, sex, dob) VALUES('"+userId+"', '"+userName+"', '"+userAddress+"', '"+userPhone+"', '"+userSex+"', '"+userDateBirth+"') ";
stat.executeUpdate(query);
comments.setText("Customer saved without a photo.");
backPanel.add(photoHolder);
backPanel.add(comments);
updateTable();
//AddScroll();
} //try
catch (Exception ee)
//The danger of putting creating the JOptionPane in here is that it will show the same message regardless of the error.
JOptionPane.showMessageDialog(null, "Customers CPR already exits!!Please enter another CPR","Invalid",JOptionPane.INFORMATION_MESSAGE);
System.out.println("Caught exception in add action: " + ee);
ee.printStackTrace();
} //catch
} //if
}//add buttonhi...
i got where the error is..
now i have another problem..
Connecting to database..
Valid Login
Caught updateTable exception: java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsException
at UtilityMethods.updateTable(UtilityMethods.java:305)
(which is this line:
tableData[currentRow] = fieldString;)-----> i did this because one of the fields will be a Date and the others are strings
at UtilityMethods.updateTable(UtilityMethods.java:429)
at Login.validLogin(Login.java:114)
at Login.actionPerformed(Login.java:80)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:14
50)
at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Abstra
ctButton.java:1504)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel
.java:378)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:250
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonL
istener.java:216)
at java.awt.Component.processMouseEvent(Component.java:3715)
at java.awt.Component.processEvent(Component.java:3544)
at java.awt.Container.processEvent(Container.java:1164)
at java.awt.Component.dispatchEventImpl(Component.java:2593)
at java.awt.Container.dispatchEventImpl(Container.java:1213)
at java.awt.Component.dispatchEvent(Component.java:2497)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:2451
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:2216)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2125)
at java.awt.Container.dispatchEventImpl(Container.java:1200)
at java.awt.Window.dispatchEventImpl(Window.java:914)
at java.awt.Component.dispatchEvent(Component.java:2497)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:339)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
read.java:131)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:98)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:85)
this is the code :
void updateTable()
ResultSet results = null;
ResultSet results1 = null;
try
//Get the number of rows in the table so we know how big to make the data array..
int rowNumbers = 0;
int columnCount = 6;
results = stat.executeQuery("SELECT COUNT(*) FROM CUSTOMER ");
if(results.next())
rowNumbers = results.getInt(1);
} //if
if(rowNumbers == 0)
rowNumbers = 1;
tableData = new String[rowNumbers][columnCount];
//Initialize the data array with "" so we avoid possibly having nulls in it later..
for(int i =0;i<tableData.length;i++)
for(int j=0;j<tableData[0].length;j++)
tableData[i][j] = "";
//Populate the data array with results of the query on the database..
int currentRow = 0;
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
results1 = stat.executeQuery("SELECT * FROM CUSTOMER ORDER BY ID");
while (results1.next())
for(int i = 0; i < columnCount; i++){
Object field = results1.getObject(i + 1);
// actually this next line should be put outside your loop so you don't keep creating this object
// or whatever format you want
String fieldString;
if (field instanceof Date)
fieldString = sdf.format((Date) field);
else
fieldString = field.toString();
tableData[currentRow] = fieldString;
//tableData[currentRow][i] = results1.getString(i + 1);
currentRow++;
} //while
}//for
final String[] colName = { "CPR", "Name", "Address", "Phone", "Sex", "Date OF Birth" };
TableModel pageModel = new AbstractTableModel()
public int getColumnCount()
return tableData[0].length;
} //getColumnCount
public int getRowCount()
return tableData.length;
} //getRowCount
public Object getValueAt(int row, int col)
return tableData[row][col];
} //getValueAt
public String getColumnName(int column)
return colName[column];
} //getcolName
public Class getColumnClass(int col)
return getValueAt(0, col).getClass();
} //getColumnClass
public boolean isCellEditable(int row, int col)
return false;
} //isCellEditable
public void setValueAt(String aValue, int row, int column)
tableData[row][column] = aValue;
} //setValueAt
//dataTable.setValue( new JScrollBar(JScrollBar.HORIZONTAL), 2,1 );
}; //pageModel
//Create the JTable from the table model:
JTable dataTable = new JTable(pageModel);
// dataTable.setModel(); -
Hi
Im having a problem doing a division calculation, i get the error divisor is equal to 0.
select
project,
week_beginning week_no,
actual_quantity,
planned_quantity,
round ( sum (actual_quantity) over (partition by week_beginning order by week_beginning asc rows unbounded preceding) /
sum (planned_quantity) over (partition by week_beginning order by week_beginning asc rows unbounded preceding) ,2) cum_actual_quantity,
sum(planned_quantity) over (partition by week_beginning order by week_beginning asc rows unbounded preceding) cum_planned_quantity MarcoThat means your denominator is equal to zero.
for a simple example try
selct 2/0 from dual will give you the same error.
One workaround is use the decode.
Ex: select decode(denom,0,0,x/denom) from tab_name -
Im new to the 5g ipod help plz
will the ipod turn off if i leave it on pause? i know i have a really stupid question but help plz thx
Yes.
Maybe you are looking for
-
Camera Raw 7 does not recognize Canon 5D Mark III RAW files
Hello, I have Adobe Creative Cloud installed and I use Adobe Photoshop CS6 with Camera Raw 7. Photoshop nur Bridge CS6 do not recognize the RAW files from the Canon 5D Mark III, though it says on the Adobe support site that the camera is supported si
-
I need a refund issued to my card on line. I did not authorize a renewal of Match. I hate Match. It limits my ability to control my music on my devices.
-
I have no idea what to do and I keep trying it but it won't let me download it.
-
Hi, when will be available SAP NetWeaver 04s SP7 Preview ABAP on SAP Marketplace for download? Thanks. Bernd
-
Restrict Blank value in a custom table field.
Hi All, I have a custom table with some fields with check table search help. One of the field I want to make it value required field. For example Field u2018Cu2019 should have value (no blanks or Spaces). Field u2018Cu2019 has a check table search he