如何使用pl sql提交和发布搜索字段

时间:2017-02-06 12:57:52

标签: html sql plsql toad

我想将我的按钮嵌入此光标中。所以当用户将数据输入到“搜索字段”时然后点击按钮' Unsuspend',Process SCRIPT应该运行并将3个不同的信息(Student_no,Suspend_account和Student_name)发布到我的下一页。

是否有任何java脚本我必须包括如果是这样请帮助。如果不是我能做什么来运行流程脚本。

- 处理SCRIPT -

CURSOR C_STUDENTS(P_TERM VARCHAR2) IS
            SELECT SZRASPR_STUDENT_NO STUDENT,
                SZRASPR_PIDM PIDM,
                SZRASPR_SUSPEND_ACCOUNT SUSPEND 

                FROM SZRASPR
                WHERE SZRASPR_TERM_CODE = P_TERM
                AND SZRASPR_STUDENT_NO IN ('000925656');

        V_TERM VARCHAR(6) := '201600';
        V_STUDENT VARCHAR(10);
        V_PIDM INTEGER;
        V_OUTCOME INTEGER;
        V_STEP1_COUNT INTEGER;
        V_STEP3_COUNT INTEGER;
            TYPE Type5record IS RECORD(Type5rowid ROWID, StudentLog VARCHAR2(200));
            TYPE Type5table IS TABLE OF Type5record
            INDEX BY BINARY_INTEGER;
            Type5delete Type5table;
            Type5empty Type5table;
            Type5count INTEGER := 0; 

    BEGIN
        FOR V_STUDENTS IN C_STUDENTS(V_TERM) LOOP
            V_STUDENT := NULL;
            V_STUDENT := V_STUDENTS.STUDENT;

            IF V_STUDENTS.SUSPENDED = 'Y' THEN 
            V_PIDM := NULL;
            V_PIDM := V_STUDENTS.PIDM;
            V_STEP1_COUNT := 0;


            UPDATE SZRASPR 
                SET SZRASPR_SUSPEND_ACOUNT = 'N', SZRASPR_SEN = 1
                WHERE SZRASPR_TERM_CODE = V_TERM
                AND SZRASPR_STUDENT_NO = V_STUDENT;
                V_STEP1_COUNT := SQL%ROWCOUNT;
            IF V_STEP1_COUNT > 0 THEN 
                COMMIT;
                END IF;


            V_OUTCOME := NULL;
            HWZKASPR.P_ASPIRETBRACCD(V_PIDM, V_OUTCOME);
            IF V_OUTCOME = 1 THEN 
                --
                SELECT ROWID INTO Type5delete(Type5count).Type5rowid
                FROM SZRASFN WHERE SZRASFN_TERM_CODE = V_TERM
                AND SZRASFN_STUDENT_NO = V_STUDENT
                AND SZRASFN_ACTIVITY_DATE > SYSDATE - INTERVAL '10' MINUTE;
            END IF;
            Type5delete(Type5count).StudentLog := 'STUDENT:'||V_STUDENT
                                                    ||' Step1count:'||V_STEP1_COUNT
                                                    ||' Step2outcome:'||CASE WHEN V_OUTCOME = 1 THEN
                                                    'OK' ELSE 'NOT OK' END 
                                                    ||'Step3count:';
            Type5count := Type5count + 1;
        ELSE
            DBMS_OUTPUT.PUT_LINE('STUDENT:'||V_STUDENT||' NOT SUSPENDED IN THE FIRST PLACE!!');
        END IF;
        END LOOP;

        FOR i IN Type5delete.FIRST .. Type5delete.LAST LOOP
        -- 
        V_STEP3_COUNT := 0;
        IF Type5delete(i).Type5rowid IS NOT NULL THEN 
            DELETE FROM SZRASFN WHERE ROWID = Type5delete(i).Type5rowid;
            V_STEP3_COUNT := SQL%ROWCOUNT;
            COMMIT;
        END IF;

        --report on status of data 
        DBMS_OUTPUT.PUT_LINE(Type5delete(i).StudentLog||V_STEP3_COUNT
                                ||CASE WHEN Type5delete(i).Type5rowid
                                IS NOT NULL THEN 
                                ' ROWID:'|| Type5delete(i).Type5rowid
                                END);
        END LOOP;
        Type5delete := Type5empty;


    EXCEPTION
        WHEN OTHERS THEN
            DBMS_OUTPUT.PUT_LINE('STUDENT:'||V_STUDENT|| 'Error Occured: '||SQLERRM
                                ||CHR(10)||'['||DMBS_UTILITY.FORMAT_ERROR_BACKTRACE||']');
    END; 

    -- 





-- BUTTON CODE --   

 HTP.FORMOPEN ('goes_to_next_page', 'post');
        HTP.FORMTEXT (
                    cname        => 'search_field',
                    csize        => 25,
                    cmaxlength   => 9,
                --  cvalue       => ,
                    cattributes  => 'style="font-size:12px" placeholder="e.g. 000123456"');

        HTP.FORMSUBMIT ('', 'Unsuspend');
        HTP.FORMCLOSE;

1 个答案:

答案 0 :(得分:0)

看起来你的HTML还没有完成......你应该有像

这样的东西
 <form action="my-next-page.html">
  Student ID:
  <input type="text" name="student_id" >
  <input type="submit" value="Submit">
 </form> 

但在这里,你只是开始了。您可能需要添加更多内容,例如&#34; form&#34;上面的事情直到结束标记:

htp.BOLD ('Enter the Student ID you wish to unsuspend for the Aspire account');
htp.br;
htp.br;
htp.BOLD ('- PLEASE NOTE Student ID''s that are submitted will be pending unsuspension until the next working day');
htp.p ('<form action="my-next-page.html">');
htp.p (' Student ID: ');
htp.p ('<input type="text" name="student_id" >');
htp.br
htp.p ('<input type="submit" value="Submit">');
htp.p ('</form>');

然后应在my-next-page.html处理结果帖子。但是你真的应该在MCVE上工作,因为在这里你不清楚你在问什么。