日期:2014-05-17  浏览次数:20986 次

如何修改使用PL/SQL查询出来的数据?
在ORCLA数据库中,用PL/SQL查询出了表数据,需要修改表中的一个数据,是个时间,‘yyyy-mm-dd 24h-mm-ss’,使用UPDATE 该如何的格式,如果不用UPDATE命令,又有什么办法?请指教!

------解决方案--------------------
to_char 函数
------解决方案--------------------
update tablename 
set fldtime=to_date('2010-02-14 14:00:00','YYYY-MM-DD H24:MI:SS') 
where .....
------解决方案--------------------
select * from tablename 
where fieldname = '&parameter' 
for update
------解决方案--------------------
没太懂楼主的意思:

1、select * from tablename where ....for update
手动修改之。。。
2、update tablename set colname=to_char(sydate,'YYYY-MM-DD HH12:MI:SS' ) where ...

commit;

------解决方案--------------------
探讨
在ORCLA数据库中,用PL/SQL查询出了表数据,需要修改表中的一个数据,是个时间,‘yyyy-mm-dd 24h-mm-ss’,使用UPDATE 该如何的格式,如果不用UPDATE命令,又有什么办法?请指教!

------解决方案--------------------
探讨
to_char 函数

------解决方案--------------------
SQL code

create table timetest
(
 timetest date
);

insert into timetest select to_date('2010-01-01 10:11:12','yyyy-mm-dd hh24:mi:ss') from dual;

------解决方案--------------------
SQL code
nsert into table 
select to_date('2010-02-21 9:16:12','yyyy-mm-dd hh24:mi:ss') from dual;

------解决方案--------------------
SQL code
insert into table 
select to_date('2010-02-21 9:16:12','yyyy-mm-dd hh24:mi:ss') from dual;

------解决方案--------------------
update tablename set ... where colname=to_char(sydate,'YYYY-MM-DD HH12:MI:SS' )

------解决方案--------------------
探讨
select * from tablename
where fieldname = '&parameter'
for update