问题
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;
回答1:
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.
来源:https://stackoverflow.com/questions/42068391/how-to-submit-and-post-a-search-field-using-pl-sql