ORA-01405 in Pro*C Although no Column has NULL Value
I have a Pro*C program that fetch a cursor from Oracle 8.1.5 into host variables without indicators. I have tried the SQL statement and the SQL will never return any NULL value in any column, however I still got the ORA-01405 error. Any one has any clue?
Use Indicator variables and let me know if it solves your problem.
http://docs.jcu.edu.au/oracle/doc/server.804/a58233/dev.htm#2239
Similar Messages
-
To overcome column with null value-urgent
hai all,
when i query i get column with null value.
how to solve it?
thank in advance.
rcs
SQL> DESC SCOTT.CB1;
Name Null? Type
ID NUMBER
SUPCODE NUMBER
SUPLNAME VARCHAR2(100)
NAME VARCHAR2(100)
ITEMCODE VARCHAR2(10)
RECDOC NUMBER
RECDATE VARCHAR2(10)
TOTVALUE NUMBER
QTY NUMBER
CB_IPNO NUMBER
CB_VNNO NUMBER
CB_VDT VARCHAR2(10)
CB_AMT NUMBER
RECDOC_GR VARCHAR2(30)
RECDATE_GR DATE
SUPCODE_GR VARCHAR2(10)
TABLE LOOK LIKE THIS (NOT ALL DATA IN SAME ROW, BECUSE I INSERTED LAST 3 COLUMN VALUES):
ID SUPCODE SUPLNAME NAME ITEMCODE RECDOC RECDATE TOTVALUE QTY CB_IPNO CB_VNNO CB_VDT CB_AMT RECDOC_GR RECDATE_GR SUPCODE_GR
2015 AAAA 04117 9083 10545.6 78
2016 BBBB 04609 9087 25200 3600
2017 GGGG 04609 9088 28175 4025
2018 36591371.64 2565017.27
00001/07-08 02/04/2007 14020362
00002/07-08 02/04/2007 14020362
00003/07-08 02/04/2007 14010254
00004/07-08 02/04/2007 14010254
00005/07-08 02/04/2007 14021458
SQL> SELECT DISTINCT ID, SUPCODE_GR, NAME, ITEMCODE, RECDOC, RECDATE_GR, TOTVALUE, QTY FROM SCOTT.CB
1;
ID SUPCODE_GR
NAME
ITEMCODE RECDOC RECDATE_G TOTVALUE QTY
1
PRO.AT.ALU.POWDER UNCOATED
04609 15 51975 7425
2
PEN, GEL PEN
07969 17 154 11
ID SUPCODE_GR
I NEED RESULT AS FOLLOWS (ALL RESPECTIVE DDATA IN ONE LINE NOW NOT LIKE THAT):
ID SUPCODE SUPLNAME NAME ITEMCODE RECDOC RECDATE TOTVALUE QTY CB_IPNO CB_VNNO CB_VDT CB_AMT RECDOC_GR RECDATE_GR SUPCODE_GR
2015 AAAA 04117 9083 10545.6 78 00001/07-08 02/04/2007 14020362
============Even accounting for the formatting, I'm not sure I even understand the question. It could be any number of different problems or non-problems.
-
Sql query slowness due to rank and columns with null values:
Sql query slowness due to rank and columns with null values:
I have the following table in database with around 10 millions records:
Declaration:
create table PropertyOwners (
[Key] int not null primary key,
PropertyKey int not null,
BoughtDate DateTime,
OwnerKey int null,
GroupKey int null
go
[Key] is primary key and combination of PropertyKey, BoughtDate, OwnerKey and GroupKey is unique.
With the following index:
CREATE NONCLUSTERED INDEX [IX_PropertyOwners] ON [dbo].[PropertyOwners]
[PropertyKey] ASC,
[BoughtDate] DESC,
[OwnerKey] DESC,
[GroupKey] DESC
go
Description of the case:
For single BoughtDate one property can belong to multiple owners or single group, for single record there can either be OwnerKey or GroupKey but not both so one of them will be null for each record. I am trying to retrieve the data from the table using
following query for the OwnerKey. If there are same property rows for owners and group at the same time than the rows having OwnerKey with be preferred, that is why I am using "OwnerKey desc" in Rank function.
declare @ownerKey int = 40000
select PropertyKey, BoughtDate, OwnerKey, GroupKey
from (
select PropertyKey, BoughtDate, OwnerKey, GroupKey,
RANK() over (partition by PropertyKey order by BoughtDate desc, OwnerKey desc, GroupKey desc) as [Rank]
from PropertyOwners
) as result
where result.[Rank]=1 and result.[OwnerKey]=@ownerKey
It is taking 2-3 seconds to get the records which is too slow, similar time it is taking as I try to get the records using the GroupKey. But when I tried to get the records for the PropertyKey with the same query, it is executing in 10 milliseconds.
May be the slowness is due to as OwnerKey/GroupKey in the table can be null and sql server in unable to index it. I have also tried to use the Indexed view to pre ranked them but I can't use it in my query as Rank function is not supported in indexed
view.
Please note this table is updated once a day and using Sql Server 2008 R2. Any help will be greatly appreciated.create table #result (PropertyKey int not null, BoughtDate datetime, OwnerKey int null, GroupKey int null, [Rank] int not null)Create index idx ON #result(OwnerKey ,rnk)
insert into #result(PropertyKey, BoughtDate, OwnerKey, GroupKey, [Rank])
select PropertyKey, BoughtDate, OwnerKey, GroupKey,
RANK() over (partition by PropertyKey order by BoughtDate desc, OwnerKey desc, GroupKey desc) as [Rank]
from PropertyOwners
go
declare @ownerKey int = 1
select PropertyKey, BoughtDate, OwnerKey, GroupKey
from #result as result
where result.[Rank]=1
and result.[OwnerKey]=@ownerKey
go
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
How to take the Average of a DATEDIFF column with NULL values?
I am building an SSRS report that can display the average of a calculated datediff column in dd/hh/mm format with the following formula:
=Avg(IIF(Fields!LastCorrectedDate.Value is nothing,0, DATEDIFF("n",cdate(Fields!LastCorrectedDate.Value),cdate(Fields!
LastSignDate.Value)) \(60*24) & ":" & DATEDIFF("n",cdate(Fields!LastCorrectedDate.Value),cdate(Fields!
LastSignDate.Value)) mod (60*24)\60 & ":" & DATEDIFF("n",cdate(Fields!LastCorrectedDate.Value),cdate(Fields!
LastSignDate.Value)) mod (60*24) - (((DATEDIFF("n",cdate(Fields!LastCorrectedDate.Value),cdate(Fields!
LastSignDate.Value)) mod (60*24))\60)*60) ))
SSRS does not raise any errors with the formula and I have used the same formula for other columns without issue. I have noticed that this column includes null values which I think may be the problem. When the reports runs, it returns #ERROR on the column
but does not give a reason why. I am using SSRS report builder with visual basic logic as opposed to embedding SQL. Any help or feedback would be greatly appreciated.Hi No Ragrets,
According to your description, you want to calculate the average for the date time difference. Right?
In Reporting Services, Avg() function is only available for numeric values. In this scenario, the DateDiff() function to calculate the minutes difference will return a number. So we can do average calculation based on the return values first. Then we format
it as a time. We have tested this case in our local environment. Please try the following expression:
=floor(avg(DateDiff("n",Fields!StartDate.Value,Fields!EndDate.Value))) \(24*60) &":"&
floor(avg(DateDiff("n",Fields!StartDate.Value,Fields!EndDate.Value))/60 mod 24 )&":"&
floor(avg(DateDiff("n",Fields!StartDate.Value,Fields!EndDate.Value))) mod 60
The result looks like below:
If you have any question, please feel free to ask.
Best Regards,
Simon Hou -
How to validate if a column have NULL value, dont show a row with MDX
Hello,
I have this situation, I have a Result from MDX that return rows with values NULL on columns, I tried with NON EMPTY and NONEMPTY but the result is the same. That I want to do is validate if a column have a Null value discard the row, but I dont know how
to implement it, could somebody help me?, please.
Thanks a lot.
Sukey Nakasima
Sukey NakasimaHello,
I found the answer in this link https://social.technet.microsoft.com/Forums/sqlserver/en-US/f9c02ce3-96b2-4cd6-921f-3679eb22d790/dont-want-to-cross-join-with-null-values-in-mdx?forum=sqlanalysisservices
Thanks a lot.
Sukey Nakasima
Sukey Nakasima -
JDT1.MTHDATE has null value although the transaction has already closed
Dear All
I need to know about when is a transaction closing date
i think i can use JDT1.MTHDATE, but sometimes i found JDT1.MTHDATE have null value, although the transaction (AR or AP) have already been closed or paid
any body know why it could be happened ?
thanks
Best Regards
JeiMingHi,
Please check Note No. : 1179946 if the same relates to the issue reported by you.
Kind Regards,
Jitin
SAP Business One Forum Team -
How to select columns with null values
HI
In my table ‘A’ I have 10 columns and 30,000 records. I need all those columns whose value is null for all the records.
For example in the below table column 'suffix' is null for all the records. So I want column suffix to be selected.
Name Suffix Street
James 1100 Washington street
Richard 273 GEORGIA ST
Arnold 3018 OAKHILL AVE
MICHAEL 834 E 161ST ST
Joseph 410 PINE AVE
Thanks in advanceTrue...
But, i think here null needs to handle otherwise it will again throw some error like this ->
satyaki>
satyaki>select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
PL/SQL Release 10.2.0.3.0 - Production
CORE 10.2.0.3.0 Production
TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
NLSRTL Version 10.2.0.3.0 - Production
Elapsed: 00:00:00.20
satyaki>
satyaki>
satyaki>
satyaki>SELECT owner, table_name, column_name
2 FROM all_tab_cols
3 WHERE data_type NOT IN ('BLOB', 'LONG', 'CLOB')
4 AND dbms_xmlgen.getxmltype('select count('
5 || CASE
6 WHEN data_type NOT IN
7 ('BLOB', 'LONG', 'CLOB')
8 THEN
9 column_name
10 ELSE
11 '1'
12 END
13 || ') c from '
14 || owner
15 || '.'
16 || table_name).EXTRACT (
17 '//text()'
18 ).getnumberval () = 0
19 AND table_name IN
20 (SELECT table_name
21 FROM all_tab_privs
22 WHERE privilege = 'SELECT' AND USER IN (grantor, grantee));
ERROR:
ORA-19202: Error occurred in XML processing
ORA-24347: Warning of a NULL column in an aggregate function
ORA-06512: at "SYS.DBMS_XMLGEN", line 288
ORA-06512: at line 1
no rows selected
Elapsed: 00:00:04.03
satyaki>Or,
satyaki>
satyaki>
satyaki>SELECT table_name, column_name
2 FROM user_tab_cols
3 WHERE data_type NOT IN ('BLOB', 'LONG', 'CLOB')
4 AND dbms_xmlgen.getxmltype('select count('
5 || CASE
6 WHEN data_type NOT IN ('BLOB', 'LONG', 'CLOB') THEN
7 column_name
8 ELSE
9 '1'
10 END
11 || ') c from '||table_name).EXTRACT('//text()').getnumberval() = 0;
AND dbms_xmlgen.getxmltype('select count('
ERROR at line 4:
ORA-19202: Error occurred in XML processing
ORA-24347: Warning of a NULL column in an aggregate function
ORA-06512: at "SYS.DBMS_XMLGEN", line 288
ORA-06512: at line 1
Elapsed: 00:00:02.66
satyaki>
satyaki>Do you have any idea to resolve this issue in this context?
Regards.
Satyaki De. -
Fact column shows null values in report
Hi Experts,
I have a requirement where i need to create report from a Dimension Dim1 and 2 Fact Tables Fact1, Fact2 with the columns as Dim1.State, Fact1.Price, Fact1.Source,Fact2.Market Value. The two fact tables are at different granularity, when i run the report it is issuing the query only from Fact 1 and putting NULL for the column from Fact 2. Can someone guide me on how to approach.
Thanks,
ChandrasekharWelcome to the magic world of content level.
You give yourself the answer to your issue: "the two fact tables are at different granularity" (95% of chances you are just on that case for your issue).
Time for some reading: https://greatobi.wordpress.com/2013/09/10/the-single-most-important-thing-to-know-about-the-obi-rpd/ -
Display columns for Null Values in Crosstab
Hi All,
I have developed a crosstab in CR based on SAP BW Query. Report requirement demands to display all columns even though data is not present for those columns. However this report doesn't show the columns when there is no data. Can you please help to resolve this issue !!!
Regards,
SamirSamir,
As Abhilash stated, the crosstab rows/columns are like groups.
If you do not have a value to create a column, it will not show in the crosstab. Do you have a table that lists all the values you wish to show in the columns? Is it used in the report? Perhaps you can use it to create the columns by using a left outer link from the table with all the values to data table you are reporting on, and use it for your columns
If the columns are dates, and you do not have data for a particular date, that can be done.
[This post has a solution for a SQL server|How to dynamically create a table to join with;.
[Here is another solution|Generating Calendar Months for the year;.
There are other posts regarding this issue. I can not think of one at the moment for building a table for values other than a date but I am pretty sure I have seen one.
Debi -
Issues while joining two tables as the joining column has duplicate values - Please help!
Hi,
I have a table A -which has few columns including a Amount column - I am joining this table A to Table B. The joining column in B has duplicates. So, the number of records are getting more after the joining. As per the requirment when I create a table
after joining the tables and count the salary clumn, there is a difference in the counting. How can I solve this? Can you please help me?
Here is the DDL and sample values
create table #student (sid int, name varchar(10),salary int)
create table [#address] (sid int, city varchar(10),grade char(1),lineneumber int)
insert into #student values (1,'sachin',8000)
insert into #student values (2,'Dhoni',2000)
insert into #student values (3,'Ganguly',7000)
insert into #student values (4,'Kohli',1000)
insert into [#address] values(1,'mumbai','A',1)
insert into [#address] values(1,'mumbai','B',2)
insert into [#address] values(1,'mumbai','C',3)
insert into [#address] values(1,'mumbai','D',4)
insert into [#address] values(2,'JARKHAND','D',3)
insert into [#address] values(2,'JARKHAND','D',4)
SELECT S.SID,NAME,salary,CITY ,grade,linenumber
into #FINAL
FROM #STUDENT S
LEFT JOIN #ADDRESS A
ON S.SID=A.SID
SELECT SUM(salary) FROM #FINAL
--44000
Final result should be 18000 , but it is coming as 44000. can you please help me to get the correct result - what do i do in the joining?
In my real project, i have 5 tables joining, each table have more than 30 columns and few joining tables joining column have duplicates. I have simplified the issue so that i can ask the question clearly. So,while answering, please consider that also in mind.
thanks in advance for your help!SELECT S.SID,NAME,salary,CITY
into #FINAL
FROM #STUDENT S
LEFT JOIN (SELECT DISTINCT sid,city
FROM #Address) A
ON S.SID=A.SIDthis will do a join on student table and city table with unique sid and city name so adddress selection will be sid city1 mumbai2 jarkand -
Varchar Column Returning Null Value
Hi
I have a report with a subquery which contains a dynamic from clause which is set by the main query, the report returns date and number values from the view in the subquery but does not return varchar2 values, if I select the varchar2 values from the view in sqlplus then the value is returned.
Any help would be much appreciated thanks,
DereckPlease check the elasticity of the field in the Report Layout where you are returning the varchar2 value.
-
Returning a result from multiple columns based on the last date that the column has a value.
I have this table named (pmtable)
ctrlno jobid docdate work1 work2 work3
1 7 2/12/2014 20 hrs
10 hrs
2 7 2/22/2014 35 hrs
15 hrs
3 7 2/28/2014
12 hrs
4 8 1/17/2014 15 hrs
13hrs
I want the result to be like this
jobid work1 work2 work3
7 35hrs 10 hrs 12 hrs
Is this possible?Hi serenace,
To achieve your requirement, you can reference the below.
DECLARE @Tbl TABLE(ctrlno INT,jobid INT,docdate DATE,work1 INT,work2 INT,work3 INT);
INSERT INTO @Tbl VALUES(1,7,'2/12/2014',20,10,NULL);
INSERT INTO @Tbl VALUES(2,7,'2/22/2014',35,NULL,15);
INSERT INTO @Tbl VALUES(3,7,'2/28/2014',NULL,NULL,12);
INSERT INTO @Tbl VALUES(4,8,'1/17/2014',15,13,23);
INSERT INTO @Tbl VALUES(4,8,'2/17/2014',15,NULL,NULL);
INSERT INTO @Tbl VALUES(4,8,'3/17/2014',NULL,16,NULL);
;WITH cte AS(
SELECT jobid,docdate,attr,value FROM
@Tbl
UNPIVOT
(value FOR attr IN(work1,work2,work3)) AS UT
cte2 AS(
SELECT jobid,attr,value , ROW_NUMBER() OVER(PARTITION BY jobid,attr ORDER BY docdate DESC) AS rn
from cte
SELECT jobid,ISNULL([work1],0) [work1],ISNULL([work2],0) [work2],ISNULL([work3],0) [work3] FROM
cte2
PIVOT
(SUM(value) FOR attr IN([work1],[work2],[work3])) AS PT
WHERE rn=1
If you have any question, feel free to let me know.
Eric Zhang
TechNet Community Support -
ORA-01405: and ORA-08180
Hello All,
I have this mapping the gets deployed perfectly with no errors nor warning during the deployments. The problem is that whenever this mapping gets started or executed it fires the following warnings :
Warning
ORA-01405: fetched column value is NULL
Warning
ORA-08180: no snapshot found based on specified time
I don't actually know what does such warning mean so if anyone could give a hand i'd be grateful.
Regards,
HossamP.Sam wrote:
Hello All,
I have this mapping the gets deployed perfectly with no errors nor warning during the deployments. The problem is that whenever this mapping gets started or executed it fires the following warnings :
Warning
ORA-01405: fetched column value is NULL
Warning
ORA-08180: no snapshot found based on specified time
I don't actually know what does such warning mean so if anyone could give a hand i'd be grateful.
Regards,
HossamThe Oracle docs note this on the ora-01405 error*:
ORA-01405 fetched column value is NULL
Cause: The INTO clause of a FETCH operation contained a NULL value, and no indicator was used. The column buffer in the program remained unchanged, and the cursor return code was +2. This is an error unless you are running Oracle with DBMS=6, emulating version 6, in which case it is only a warning.
Action: You may do any of the following:
* Use the NVL function to convert the retrieved NULL to another value, such as zero or blank. This is the simplest solution.
* Use an indicator to record the presence of the NULL. You probably should use this option when you want a specific action to be taken when a NULL arises.
* Revise the cursor definition so that no columns possibly containing NULL values are retrieved.
ORA-01405 is thrown when you attempt to execute FETCH, which was returned as a NULL value, but there was no indicator in use. If you are using Oracle DBMS=6 (version 6) ORA-01405 is only a warning.
You might try resolving ORA-01405 by substituting a value with NVL function when a NULL value appears, or simply construct your cursor so that NULL values are not returned (you may also specify that columns with NULL values are not received).
The error ORA-8180 is reported when the time which is specified, is
mapped to a SCN which is beyond the bounds of a valid scn. Most likely
the specified time corresponds with a date which is more than 5 days ago
(server uptime). You can never flashback more than 5 days ago (server
uptime), irrespective of UNDO_RETENTION.
SOLUTION: Specify a more recent date to flashback. E.g.:
exp scott/tiger file=exp_flash.dmp log=exp_flash.log tables=flash
flashback_time='"2004-06-12 13:24:26"' -
SQL Loader: Null value in column
Have a tab delimited file, in UNIX
Some of the inbetween columns have null values
The records are failing to load with null column values.
I tried:
col10 nullif col10 ="(null)"
My control file is:
load data
infile 'abc.txt'
into table XX_data
fields terminated by X'09' optionally enclosed by '"'
TRAILING NULLCOLS
( col1,
col2 nullif col2 ="(null)",
col3)Sample data is tab delimited file. For some reason, it has problem reading the second date (+time) column in the same record when there are null values in preceding columns. It says:
ORA-01841: (full) year must be between -4713 and +9999, and not be 0
Col1 Col2 Col3 Col4 Col5 Col6 Col7 Col8 Col9 Col10 Col11 Col12
2000-01-03 10:38:05.733000000 XX AA Change 0 DOG CAT R 2000-01-03 10:38:05.733000000 GIRAFFE MONKEY COW -
Avoid shrinking of null values in a column....
I created an RTF template but one of the columns is shrinking if it has null values. Is there any way to avoid this.
If I replaced the null values with a dot it's workig fine, but the users dont wanna see the dots.
Any ideas !!!!!!!!!
Thanks in advance.Hi
Enclose the column in a Table. That should work
Srini Ramanujam
Maybe you are looking for
-
we are facing issue while creating Order, the error says "Your cart has been updated by another member. We have reloaded it for you. Please reenter your changes." (IBE_SC_ERR_RELOAD_C_MEMBER_UPD) . It appears if l_last_upd_party_id = l_owner_party
-
I updated my Iphone 3gs to last version of iOS and now I can't change my configurations of Mail, Contacts, Calendars.
-
What's the best external drive to use with Final Cut Pro?
I'm looking for a drive to mainly back up my final cut pro work, possibly do a little editing on, what's best? I have a G5 desktop.
-
Hi, I have to add bookmark in pdf file, i tried so many ways. But no use. i have a PDf with full text information, i want to add few text (Some words with in the PDF) from the content and need to add them in bookmark. i know i can add manulay but my
-
Podcasts clutter up my music library
I am subscribed to several podcasts. When I download one, it appears in the library list. I do not like this, as I find it clutters up the view. My podcasts are already listed in the podcast section, so it seems redundant for them also to be listed i