隐藏特定列上的输出
我编写了一个包含存储过程和 REF 游标的包。我现在可以通过此光标显示表中的所有列。我希望能够插入一个循环,如果满足特定条件,七列中的四列将显示四个星号,其余列将显示其正常数据。
例如,我有一个名为“国家/地区”的列。每当 USA 出现在记录中时,四列(empid、ss、地址、部门)只需显示 ****,而其余列将正常显示。如果记录中包含美国以外的国家/地区,则所有列将正常显示数据。我知道有一个 noprint 函数,但我似乎不知道如何只显示星号。
I have written a package that has a stored procedure and a REF cursor. I am able to now display all of the columns in my table through this cursor. I would like to be able to insert a loop that if a certain condition is met, four of the seven columns will show four asterisks and the rest of the columns will show up with their normal data.
For example, I have a column called country. Any time that USA appears in a record, the four columns of (empid, ss, address, dept) will need to only show **** while the rest of the columns will appear as normal. If a country that is not USA is in a record, then all columns will show the data as normal. I know there is a noprint function but I can't seem to figure out how to just show the asterisks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
与其使用复杂的东西,只需使用
CASE
表达式即可:SELECT CASE WHEN Country = 'USA' THEN '*****' Else EmpID END as EmpID
Instead of using something complicated for this, just use a
CASE
expression:SELECT CASE WHEN Country = 'USA' THEN '*****' Else EmpID END as EmpID