Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Reload problem. Where Clause causing field to go null

I am loading the inventory history transaction table from IFS (PL/SQL) using the following script:

select

     transaction_code,

     date_created,

     cost

from IFSAPP.INVENTORY_TRANSACTION_HIST_TAB;

this loads the whole table which is massive so I have been trying to restrict it to one year:

select

     transaction_code,

     date_created,

     cost

from IFSAPP.INVENTORY_TRANSACTION_HIST_TAB

where TO_CHAR(DATE_CREATED,'YYYY') = '2018';


this works except the cost field shows only null values.


Has anyone else encountered this problem?

12 Replies
shiveshsingh
Master
Master

Do you have values in cost column for 2018?

sunny_talwar

Are there rows in year 2018 where cost is not null?

Peter_Cammaert
Partner - Champion III
Partner - Champion III

That's more of a question for an Oracle PL/SQL forum.

All SQL statements are sent as-is through the ODBC/OLEDB driver to the database engine for analysis and execution. The results are then sent back and stored in a resident table. The latter part doesn't filter data, so if there is no data in column cost, then that probably means that Oracle isn't sending back any.

What happens if you run this SQL statement in the standard Oracle command line tool (SQL*Plus)? Do you get any values in cost?

wdchristensen
Specialist
Specialist

select


     Tbl.transaction_code,


     Tbl.date_created,


     Tbl.cost


from IFSAPP.INVENTORY_TRANSACTION_HIST_TAB as Tbl


where TO_CHAR(DATE_CREATED,'YYYY') = '2018';

Anonymous
Not applicable
Author

Yes there are values for 2018

wdchristensen
Specialist
Specialist

"Cost" may be a reserved word which means you would need to qualify it.

Anonymous
Not applicable
Author

Already tried with alias, doesn't work unfortunately.

wdchristensen
Specialist
Specialist

If you run

Select top 1 Tbl.*

From IFSAPP.INVENTORY_TRANSACTION_HIST_TAB as Tbl

where Tbl.cost > 0


Do you even have a column for cost?

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Cost is not a reserved word in Oracle SQL. See Oracle SQL Reserved Words