sreeramnavale
Programmer
Hello Forum,
I am using Crystal Reports 9.0 with Oracle.
In my database expert I have the SQL Query as shown at end of this Message.
This SQL Query works on my production database but fails on test database. I would like to know the reason why it fails on my test database.
I did a bit of investigation my self and found out that the SQL is failing because of the following part of SQL.
product.productnbr in ('000' + substr('{?UPC}',1,11))
The error I get when the report is run on the test database is
Failed to Open a rowset.
SQL Engine Error: 'ORA-01722:invalid number'
Not supported.
Details: Fail to fetch data. OCI Call: OCIStmtFetch
Thanks in Advance.
SPN
SQL Query in Database Expert.
With item_data as (
select item_parent item, item_desc
from item_master@RMSLINK im
where
im.item = {?UPC} and im.item_level = 3 and im.PRIMARY_REF_ITEM_IND = 'Y'
),
scs_sku_data as
(
SELECT
productnbr,
SKUNBR
from
product
where
product.productnbr in ('000' + substr('{?UPC}',1,11))
),
scs_data as (
SELECT
organization.orgnbr,
scs_sku_data.productnbr,
storeinventory.qtyonhand,
storeinventory.LASTSALESCALCDATE,
case when (store.phase2blivedate >sysdate)
then 'N'
else 'Y'
end Phase2B
FROM
scs_sku_data,
storeinventory storeinventory,
store store,
organization organization
WHERE
(scs_sku_data.skunbr=storeinventory.skunbr)
AND (storeinventory.storeprofileid=store.storeprofileid)
AND (store.orgid=organization.orgid)
)
SELECT
scs_data.orgnbr,
scs_data.productnbr,
scs_data.qtyonhand,
scs_data.LASTSALESCALCDATE,
scs_data.Phase2B,
item_data.item_desc,
ils.STOCK_ON_HAND
from
scs_data,
item_loc_soh@RMSLINK ils,
item_data
where
(ils.item = item_data.item)
and (ils.loc = scs_data.orgnbr)
I am using Crystal Reports 9.0 with Oracle.
In my database expert I have the SQL Query as shown at end of this Message.
This SQL Query works on my production database but fails on test database. I would like to know the reason why it fails on my test database.
I did a bit of investigation my self and found out that the SQL is failing because of the following part of SQL.
product.productnbr in ('000' + substr('{?UPC}',1,11))
The error I get when the report is run on the test database is
Failed to Open a rowset.
SQL Engine Error: 'ORA-01722:invalid number'
Not supported.
Details: Fail to fetch data. OCI Call: OCIStmtFetch
Thanks in Advance.
SPN
SQL Query in Database Expert.
With item_data as (
select item_parent item, item_desc
from item_master@RMSLINK im
where
im.item = {?UPC} and im.item_level = 3 and im.PRIMARY_REF_ITEM_IND = 'Y'
),
scs_sku_data as
(
SELECT
productnbr,
SKUNBR
from
product
where
product.productnbr in ('000' + substr('{?UPC}',1,11))
),
scs_data as (
SELECT
organization.orgnbr,
scs_sku_data.productnbr,
storeinventory.qtyonhand,
storeinventory.LASTSALESCALCDATE,
case when (store.phase2blivedate >sysdate)
then 'N'
else 'Y'
end Phase2B
FROM
scs_sku_data,
storeinventory storeinventory,
store store,
organization organization
WHERE
(scs_sku_data.skunbr=storeinventory.skunbr)
AND (storeinventory.storeprofileid=store.storeprofileid)
AND (store.orgid=organization.orgid)
)
SELECT
scs_data.orgnbr,
scs_data.productnbr,
scs_data.qtyonhand,
scs_data.LASTSALESCALCDATE,
scs_data.Phase2B,
item_data.item_desc,
ils.STOCK_ON_HAND
from
scs_data,
item_loc_soh@RMSLINK ils,
item_data
where
(ils.item = item_data.item)
and (ils.loc = scs_data.orgnbr)