选择案例,如果< 0然后选择' 0'
在这里寻找一些指导。我有一个执行余额计算的查询,该查询也被格式化以显示在我们发出的信件上。如果 Total_Billable - Annual_Sum <0,我希望显示 0。基本上,我想避免在清洁度方面显示负数。见下文:
select TO_CHAR(NVL(:TOTAL_BILLABLE2 - :ANNUAL_SUM2,0),'$999,990')<br>
into :REMAINING_BALANCE <br>
FROM SPRIDEN <br>
where SPRIDEN.SPRIDEN_ID = :Student_ID
我觉得我过度思考了在哪里放置 CASE 语句,但这是我第一次使用变量来计算另一个变量中的存储值。任何帮助将不胜感激!
Looking for a bit of guidance here. I've got a query performing a balance calculation that is also being formatted for display on a letter we've got going out. I'm looking to display 0 if Total_Billable - Annual_Sum <0. Basically, I want to avoid showing negative numbers for cleanliness. See below:
select TO_CHAR(NVL(:TOTAL_BILLABLE2 - :ANNUAL_SUM2,0),'$999,990')<br>
into :REMAINING_BALANCE <br>
FROM SPRIDEN <br>
where SPRIDEN.SPRIDEN_ID = :Student_ID
I feel like I'm VASTLY overthinking where to place my CASE statement, but this is my first go round using variables to calculate a stored value in another variable. Any help would be appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 案例:
Use a CASE WHEN: