We help IT Professionals succeed at work.

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

94 Views
Last Modified: 2018-10-31
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
Comment
Watch Question

Qlemo"Batchelor", Developer and EE Topic Advisor
CERTIFIED EXPERT
Top Expert 2015

Commented:
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?
Test your restores, not your backups...
CERTIFIED EXPERT
Expert of the Year 2019
Top Expert 2016
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
PortletPaulEE Topic Advisor
CERTIFIED EXPERT
Most Valuable Expert 2014
Awarded 2013
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Qlemo"Batchelor", Developer and EE Topic Advisor
CERTIFIED EXPERT
Top Expert 2015

Commented:
@maximus1974
Sorry? Haven't I've been the first to point out the basic issue?

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.