ORACLE 数据库问题 case when 条件 then (update 执行语句 ) els

ORACLE 数据库问题 case when 条件 then (update 执行语句 ) els,第1张

当然存在啊,语句格式如下,dbms_output.put_line('1')可以替换为任何语句。

declare

  v_num number

begin

  v_num := &请输入值

  case v_num

    when 1 then

      dbms_output.put_line('1')

    when 2 then

      dbms_output.put_line('2')

    when 3 then

      dbms_output.put_line('3')

    else

      dbms_output.put_line('null')

  end case

end

你的conn连接数据库的代码呢?

如果conn有连接的话,那就是这行代码错误了

sqlup

=

"Update

User

set

Pwd

=

'"

&

pwd1

&

"'

where

ID

=

'"

&

username

&

"'"

一般ID是自动编号的,在表里面用户名的字段应该是username,改为以下代码看看

sqlup

=

"Update

User

set

Pwd

=

'"

&

pwd1

&

"'

where

username

=

'"

&

username

&

"'"

如果按你的要求需要写个存储过程来实现。麻烦。

如果按下面来做的话,会有重复值,

update 表名 set column_no=datepart(day,column_time)

建议你把column_no 按如20090101来更新较方便,这样能与column_time能对应上。

update 表名 set column_no=(datepart(year,column_time)*100+datepart(month,column_time))*100+datepart(day,column_time)


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/sjk/9949670.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-03
下一篇2023-05-03

发表评论

登录后才能评论

评论列表(0条)

    保存