Toad truncating/rounding large Oracle numbers? - oracle

We have a table with a 'price' field of type NUMBER(20,7).. In TOAD I do this:
update mytable set price = 1234567890123.1234567;
Then I do this select:
select price, to_char(price) from mytable
PRICE TO_CHAR(PRICE)
1234567890123.12 "1234567890123.1234567"
Question is, why does TOAD truncate the result when displaying the NUMBER(20,7) field? The data is obviously there as it prints out with to_char.
??

Toad limits numbers in the data grid to 15 digits. I believe this is because excel limits numbers to 15 digits as well (or used to limit them). You can turn on "scientific notation" in options -> data grids -> data, check box Display large numbers in scientific notation. That won't probably help, either.

-> Right click on the data grid
-> Select "Grid Options..."
-> Under "Data Grids" chose "Data"
-> Uncheck "Display large numbers in Scientific Notation"
After doing these you need to close and open TOAD again. This worked for me in TOAD Version 8.6.0.38

I had a similar problem, Toad was truncating/rounding my numbers when being displayed in grid view.
I found out that by using the Execute Statement button or by pressing F9 to run the query then the truncation/rounding would not be performed.
I hope that helps.

Related

Totals row in Toad resultset? (via UI)

In Toad for Oracle 12:
I make various queries on-the-fly to analyze data. For example:
select
worktype,
count(*) as count
from
maximo.workorder
group by
worktype
In the query resultset, it would be helpful if I could toggle a totals row on/off to quickly analyze the results.
Example: get the grand total of the COUNT column. Or, in other queries, play around with count, max, standard deviation, variance, etc.
It would be the equivalent to the MS Access totals tool (not to be confused with GROUP BY):
Is there an way to do that using the UI in Toad 12?
You can, I believe. I don't have TOAD 12 any more, but - give it a try:
select all cells you're interested in
right-click
from the menu, select "Calculate selected cells"
check the result
note that - if result list contains a lot of columns and you're calculating the ones far on the right, you'll have to scroll left to see the result

Select row value from column in interactive report

Version: Oracle 18.2
I have an interactive report in my application. When I click the 'delete' icon, I want to delete information about the user I selected. Is there a way to get the value from the 'Facility Manager' column so I can use that value in a select statement to perform the delete statement.
I've tried to do it by using the ROW_ID variable (:selected_rowid) but this didn't work.
+ Interactive Report Image
+ Set Value statement
The column value is referenced by hashes, e.g. #STUDENT_ID#.
Have a look at what Jackie McIlroy wrote, "Delete a Row of a Report with a Dynamic Action" (https://jackiemcilroy.blogspot.com/2018/03/delete-row-of-report-with-dynamic-action.html) . She describes the process in details, with a lot of screenshots.
If I were you, I'd do one of the following:
use an interactive report with a form (and navigate to the form in order to delete a row)
if it has to be a tabular layout, I'd try
the old tabular form
the new interactive grid
I don't think I'd remove rows from the interactive report (but OK, that's just me, and my ideas usually aren't too smart).

How to increase number of displayed rows in a tabular form using apex 5.0

Currently my tabular form displays 10 rows at a time. How do I increase the number of rows to be displayed, say from the current default number of 10 to something like 20? Is there a place somewhere in the page attribute where you can set the number of rows to be displayed, as in the case of an interactive report?
Region -> Attributes -> Layout -> Number of Rows
In scripting window you will find a drop-down with row label, select it and choose the number of rows you want to display.
If you are facing this problem for an 11g Oracle SQL Developer:
More than 10 rows available. Increase rows selector to view more rows.
Then you can directly solve this from drop down menu of rows situated beside Autocommit checkmark from SQL Workshop:
select 1000000 to show more rows :
Run those queries again!
Final Result having 21 rows in result :
This might have solve your problem!
You can call function
javascript:apex.widget.tabular.addRow();
N number of times per click... For example,
Generate 2 rows, call
javascript:apex.widget.tabular.addRow();
javascript:apex.widget.tabular.addRow();
Generate 4 rows, call
javascript:apex.widget.tabular.addRow();
javascript:apex.widget.tabular.addRow();
javascript:apex.widget.tabular.addRow();
javascript:apex.widget.tabular.addRow();

Crystal Reports Issue turning a string into a number

I'm having one of those throw the computer out the window days.
I am working on a problem involving Crystal Reports (Version 10) and an Oracle Database (11g).
I am taking a view from the database that returns a string (varcahr2(50)) which is actually a number, when a basic SELECT * query is run on this view I get the number back in the format 000000000000100.00.
When this view is then used in Crystal Reports I can view the field data, but I can't sum the data as it is not a number.
I began, by attempting to using ToNumber on the field, to which Crystal's response was that the string was not numeric text. Ok fair enough, I went back to the view and ran TO_NUMBER, when this was then used in crystal it did not return any results. I also attempted to run TO_CHAR on the view so that I could hopefully import the field as text and then perform a ToNumber, yet the same as with the TO_NUMBER no records were displayed.
I've started new reports, I've started new views. No avail.
This seems to have something to do with how I am retrieving the data for the view.
In simplistic terms I'm pulling data from a table looking at two fields a Foreign Key and a Value field.
SELECT PRIMARY_KEY,
NVL(MAX(DECODE(FOREIGN_KEY, FOREIGN_KEY_OF_VALUE_I_NEED, VALUE_FIELD)), 0)
FROM MY_TABLE
GROUP BY PRIMARY_KEY
When I attempted to put modify the result using TO_NUMBER or TO_CHAR I have used it around the VALUE_FIELD itself and the entire expression, wither way works when the run in a SQL statement. However any TO_NUMBER or TO_CHAR modification to the statement returns no results in Crystal Reports when the view is used.
This whole problem smacks of something that is a tick box or equivalent that I have overlooked.
Any suggestions of how to solve this issue or where I could go to look for an answer would be greatly appreciated.
I ran this query in SQL Developer:
SELECT xxx, to_number(xxx) yyy
FROM (
SELECT '000000000000100.00' XXX FROM DUAL
)
Which resulted in:
XXX YYY
000000000000100.00 100
If your field is truly numeric, you could create a SQL Expression field to do the conversion:
-- {%NUMBER_FIELD}
TO_NUMBER(TABLE.VALUE_FIELD)
This turned out to be an issue with how Crystal Reports deals with queries from a database. All I needed to do was contain my SQL statement within another Select Statement and on this instance of the column apply the TO_NUMBER so that Crystal Reports would recognize the column values as numbers.
Hopefully this helps someone out, as this was a terrible waste of an afternoon.

Export results of a query to a set of INSERT statements?

In Oracle I have the requirement to produce a set of INSERT statements using the results of a SELECT statement. Basically the same way that Toad for Oracle will export the contents of a table to a set of Insert Statements either in a file or on the clip board. Is this possible?
The reason for this is that some of my geometric data is in WGS84 format and when I access it it needs to be British National Grid. This is not a problem in Oracle as I can simply use SDO_CS.Transform(date, srid) however in SQL Server this is not possible. My intention is to produce the INSERTS in Toad and them run them on SQL Server in order to populate the geometry column with the pre-transformed data. This means applying the transform in Oracle during the SELECT.
I don't quite understand how you're trying to export the data from TOAD. But it should work as follows:
Run your SELECT statement in a TOAD editor window.
Press the right mouse button in the data grid with the result and select "Export dataset...".
Choose "Insert Statements" from the first drop down.
Click OK.

Resources