本文介绍了如何使用pl sql提交和发布搜索字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望我的按钮被嵌入到这个游标中。因此当用户将数据输入到'search_field'并单击'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 Type5record表
INDEX BY BINARY_INTEGER;
Type5delete Type5table;
Type5empty Type5table;
Type5count INTEGER:= 0;

BEGIN
V_STUDENTS在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('学生:'|| V_STUDENT ||'不在第一个地方停留!!');
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;

- 报告数据状态
DBMS_OUTPUT.PUT_LINE(Type5delete(i).StudentLog || V_STEP3_COUNT
|| CASE当Type5delete(i).Type5rowid
IS NOT NULL THEN
'ROWID:'|| Type5delete(i).Type5rowid
END);
END LOOP;
Type5delete:= Type5empty;


例外
当其他人
DBMS_OUTPUT.PUT_LINE('学生:'|| V_STUDENT ||'错误发生时:'|| SQLERRM
| | CHR(10)|| '[' || || DMBS_UTILITY.FORMAT_ERROR_BACKTRACE ']');
END;

-





- 按钮代码 -

HTP。 FORMOPEN('goes_to_next_page','post');
HTP.FORMTEXT(
cname =>'search_field',
csize => 25,
cmaxlength => 9,
- cvalue => ,
cattributes =>'style =font-size:12pxplaceholder =eg 000123456');

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


解决方案

它看起来像您的HTML不完整.. 。你应该有类似于

 < form action =my-next-page.html> 
学生识别码:
< input type =textname =student_id>
< input type =submitvalue =提交>
< / form>

但是在这里你只是生成了开始。

  htp.BOLD('')你可能需要添加一些,比如上面的表单输入您希望为Aspire帐户取消暂停的学生ID'); 
htp.br;
htp.br;
htp.BOLD(' - 请注意,提交的学生证'将在下一个工作日之前等待取消暂停');
htp.p('< form action =my-next-page.html>');
htp.p('学号:');
htp.p('< input type =textname =student_id>');
htp.br
htp.p('< input type =submitvalue =Submit>');
htp.p('< / form>');

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


i would like my button to be embedded within this cursor. so when a user inputs data onto the 'search_field' and clicks the button 'Unsuspend', the Process SCRIPT should run and post 3 different information (Student_no, Suspend_account, and Student_name ) onto my next page.

is there any java script i have to include if so please help. if not what can i do to run the process script.

--Process 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;
解决方案

It looks like your HTML isn't complete... you should have something like

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

But here you're only generating the beginning. You probably need to add a little more, like the "form" thing above until the closing tag:

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>');

And then resulting post should be processed in my-next-page.html. But you really should work on an MCVE, because here it's very unclear what you're asking.

这篇关于如何使用pl sql提交和发布搜索字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 22:01