Oracle PL/SQL脚本中的此斜杠字符是否是错误? [英] Is this slash character in an Oracle PL/SQL script an error?

查看:183
本文介绍了Oracle PL/SQL脚本中的此斜杠字符是否是错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为我的公司整理一系列用Oracle PL/SQL编写的SQL脚本.我遇到了一个基本脚本,底部附近有一个奇怪的斜线.通过这种方式将其检入CVS.这是纯语法错误还是它有一些我不知道的功能.稍微模糊的脚本:

I'm sorting out a series of SQL scripts for my company written in Oracle PL/SQL. I came across an essential script with a strangely placed slash near the bottom. It is checked into CVS this way. Is this a pure syntax error or does it have some function I'm not aware of. The slightly obfuscated script:

set serveroutput on size 2000;
--PL/SQL block to link ISSN in serial base on a company's ISSN text file

declare
    cursor ItemCursor is
        select issn is2 from web.obfuscated1 where issn is not null
            union
        select eissn is2 from web.obfuscated1 where eissn is not null;

    cursor ItemCursor1(aIS varchar2) is
        select obfuscated1_uid from web.obfuscated1 where group_num is null and issn in (
            select distinct issn from web.obfuscated1 where issn = aIS or eissn = aIS
                union
            select distinct eissn from web.obfuscated1 where issn = aIS or eissn = aIS
        )
            union
        select obfuscated1_uid from web.obfuscated1 where eissn in (
            select distinct issn from web.obfuscated1 where issn = aIS or eissn = aIS
                union
            select distinct eissn from web.obfuscated1 where issn = aIS or eissn = aIS
        );

    cursor ItemCursor2(aIS9 varchar2) is
        select obfuscated1_uid from web.obfuscated1 where issn in (
            select distinct issn from web.obfuscated1 where issn = aIS9 or eissn = aIS9
                union
            select distinct eissn from web.obfuscated1 where issn = aIS9 or eissn = aIS9
        ) and group_num is null;

    agroup      number(8);
    processCount    number(8);

    ------------------------------------------------------
    -- MAIN BLOCK -----------------------------------
    -------------------------------------------------
begin
    processCount := 0;

    agroup := null;
    for itemRec in ItemCursor loop
        agroup := null;
        begin
            select group_num into agroup from web.obfuscated1 where issn in (
                select distinct issn from web.obfuscated1 where issn = itemRec.is2 or eissn = itemRec.is2
                    union
                select distinct eissn from web.obfuscated1 where issn = itemRec.is2 or eissn = itemRec.is2
            ) and group_num is not null and issn is not null and eissn is not null and rownum <= 1;

        exception
            when no_data_found then
                agroup := null;
            when others then
                agroup := null;
        end;

        if agroup is not null then
            for itemRec2 in ItemCursor2(itemRec.is2) loop
                update web.obfuscated1 set group_num = agroup where obfuscated1_uid = itemRec2.obfuscated1_uid;
                commit;
            end loop;
        else
            processCount := processCount + 1;
            for itemRec1 in ItemCursor1(itemRec.is2) loop
                update web.obfuscated1 set group_num = processCount where obfuscated1_uid = itemRec1.obfuscated1_uid;
                commit;
            end loop;
            commit;
        end if;
    end loop;

    dbms_output.put_line('Total record read: ' || processCount);
exception
    when others then
        dbms_output.put_line('ORA' || sqlcode);
        dbms_output.put_line(substr(sqlerrm, 1, 255));
        dbms_output.put_line('ORA- Error during processing ' );
    end;
/
exit;

推荐答案

斜杠具有

执行最近执行的 SQL命令或PL/SQL块是 存储在SQL缓冲区中.你可以 在命令中输入斜杠(/) 提示或行号提示 多行命令.斜杠命令 功能类似于RUN,但确实 不列出命令.

Executes the most recently executed SQL command or PL/SQL block which is stored in the SQL buffer. You can enter a slash (/) at the command prompt or at a line number prompt of a multi-line command. The slash command functions similarly to RUN, but does not list the command.

这篇关于Oracle PL/SQL脚本中的此斜杠字符是否是错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆