[英]PL/SQL - Update a table after spooling the metadata into a file
I've got the following script, which stores the metadata for the tables that are in the MTTO_TAB_EXIST_ALL
column.我有以下脚本,它存储
MTTO_TAB_EXIST_ALL
列中表的元数据。 The files are stored individually and its file name is the same of the current spooling table文件单独存储,文件名与当前的spooling table相同
set pagesize 0
set linesize 100
set long 90000
SET TERMOUT OFF
spool out.sql
select 'spool C:\Users\personal\MAIN_USR\table\'||REPLACE(table_name, '$', '_')||'.txt'||chr(13)||chr(10)||
'SELECT DBMS_METADATA.GET_DDL'||chr(13)||chr(10)||
'(''TABLE'','''||table_name||''',''MTO_TABL'') '||chr(13)||chr(10)||
'FROM DUAL;'||chr(13)||chr(10)||
'spool off' as cmd
FROM MTTO_TAB_EXIST_ALL tea
WHERE tea.MRK_DEL_PERM = 'Y'
AND tea.OWNER_NM = 'MTO_TABL'
AND MRK_BACKUP_DDL != 'Y';
spool off
@OUT.SQL
What I need is after spooling that table, the existing record of it in column MRK_BACKUP_DDL
updates to 'Y'我需要的是在后台处理该表后,它在
MRK_BACKUP_DDL
列中的现有记录更新为“Y”
TABLE_NAME | MRK_BACKUP_DDL
— — — — — — — — — — — — — — — — — — — — — — — — — —
CA_3092_MVTO_NODISTR_2_MISC | Y
ED_EXTR_CSV_PRIMA_DEA_PUBLI | N
CA_T3054_GRP_OFICINAS_O_MISC0 | N
I couldn't find anything similar to the UPDATE
statement, so I would like to know if there is any way to do it.我找不到任何类似于
UPDATE
语句的内容,所以我想知道是否有任何方法可以做到。
I appreciate any help.我很感激任何帮助。
As you're creating everything dynamically, add update
in between, here:当您动态创建所有内容时,请在此处添加
update
:
'FROM DUAL;'||chr(13)||chr(10)||
--> here
'spool off' as cmd
"Here" would look like this; “这里”看起来像这样; maybe I failed with single quotes and stuff (I don't have your tables and code you wrote is kind of difficult to hop into) so - fix it, if necessary.
也许我用单引号和东西失败了(我没有你的表格,你写的代码很难跳进去)所以 - 如有必要,修复它。
'update MTTO_TAB_EXIST_ALL set mrk_backup_ddl = ''N'' where table_name = ' ||
chr(39) || MTO_TABL || chr(39) || ';'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.