Avatar of maximus1974
maximus1974 asked on

How I can prevent the results of a column from adding two zeroes to the end of the value?

How I can prevent the results of DAYS_LEFT from adding two zeroes to the end of the value(screenshot attached)? here is the statement I am using:
With N1 As (
SELECT 
  BA_VIEW_SHIPPING_ORDERS.SM_NUMBER, 
  BA_VIEW_SHIPPING_ORDERS.STATUS AS SM_STATUS, 
  BA_VIEW_SHIPPING_ORDERS.ORDER_TYPE, 
  BA_VIEW_SHIPPING_ORDERS.ORDER_NUMBER, 
  DEPARTMENT.DEPT_NAME, 
  BA_VIEW_SHIPPING_ORDERS.PN, 
  BA_VIEW_SHIPPING_ORDERS.DESCRIPTION, 
  BA_VIEW_SHIPPING_ORDERS.SHIP_NAME AS CUSTOMER_NAME, 
  BA_VIEW_SHIPPING_ORDERS.SHIP_VIA_CODE, 
  TRUNC(CASE WHEN BA_VIEW_WO_SUMMARY.CONTRACT_TAT IS NULL THEN 21 ELSE BA_VIEW_WO_SUMMARY.CONTRACT_TAT END - BA_VIEW_WO_SUMMARY.NET_TAT) AS WO_DAYS_LEFT, 
  TRUNC(BA_VIEW_SHIPPING_ORDERS.DUE_DATE - SYSDATE) AS SO_DAYS_LEFT, 
  TRUNC(CASE WHEN ORDER_TYPE = 'RO' THEN sysdate - BA_VIEW_SHIPPING_ORDERS.ENTRY_DATE ELSE 0 END) AS RO_DAYS_LEFT, 
  TRUNC(CASE WHEN ORDER_TYPE = 'WHS' THEN sysdate - BA_VIEW_SHIPPING_ORDERS.ENTRY_DATE ELSE 0 END) AS WHS_DAYS_LEFT
FROM 
  BA_VIEW_SHIPPING_ORDERS 
  LEFT OUTER JOIN BA_VIEW_WO_SUMMARY ON BA_VIEW_SHIPPING_ORDERS.ORDER_NUMBER = BA_VIEW_WO_SUMMARY.WO_NUMBER 
  LEFT OUTER JOIN DEPARTMENT ON BA_VIEW_SHIPPING_ORDERS.DPT_AUTO_KEY = DEPARTMENT.DPT_AUTO_KEY 
WHERE 
  BA_VIEW_SHIPPING_ORDERS.SM_NUMBER LIKE 'SHA%' 
  AND BA_VIEW_SHIPPING_ORDERS.STATUS NOT IN ('SHIPPED', 'CANCELLED')
  )
Select N1.*,(WO_DAYS_LEFT||SO_DAYS_LEFT||RO_DAYS_LEFT||WHS_DAYS_LEFT) Days_Left
From N1

Open in new window

screenshot
Oracle DatabaseSQL* oracle syntax

Avatar of undefined
Last Comment
Qlemo

8/22/2022 - Mon
Qlemo

That column is built by
WO_DAYS_LEFT||SO_DAYS_LEFT||RO_DAYS_LEFT||WHS_DAYS_LEFT

Open in new window

which doesn't make sense IMHO. You are just putting numerical values after each other, building a string. Did you mean
WO_DAYS_LEFT+SO_DAYS_LEFT+RO_DAYS_LEFT+WHS_DAYS_LEFT

Open in new window

which adds the numbers instead?
ASKER CERTIFIED SOLUTION
Bill Prew

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Qlemo

@maximus1974
Sorry? Haven't I've been the first to point out the basic issue?
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23