Support\APEX\APEX_CheatSheet.md
Oracle Application Express (APEX) Cheat Sheet
BEGIN
apex_application.stop_apex_engine();
END;
BEGIN
apex_session.create_session(
p_app_id=>498,
p_page_id=>200,
p_username=>'KZHANG');
END;
BEGIN
apex_session.detach;
END;
BEGIN
c_log_level_error CONSTANT t_log_level := 1; -- critical error
c_log_level_warn CONSTANT t_log_level := 2; -- less critical error
c_log_level_info CONSTANT t_log_level := 4; -- default level if debugging is enabled (e.g. used by apex_application.debug)
c_log_level_app_enter CONSTANT t_log_level := 5; -- application: messages when procedures/functions are entered
c_log_level_app_trace CONSTANT t_log_level := 6; -- application: other messages within procedures/functions
c_log_level_engine_enter CONSTANT t_log_level := 8; -- apex engine: messages when procedures/functions are entered
c_log_level_engine_trace CONSTANT t_log_level := 9; -- apex engine: other messages within procedures/functions
-- https://dgielis.blogspot.com/2019/06/see-apex-debug-info-in-plsql-and-sql.html
apex_debug.enable(
p_level => apex_debug.c_log_level_info
);
apex_debug.message(p_message => 'Debug enabled.');
END;
SELECT
*
FROM
apex_debug_messages
WHERE
session_id = 16458652970080
ORDER BY message_timestamp;
apex_util.redirect_url(p_url => apex_page.get_url(p_page => 1));
-- Warning: redirect_url raises the exception ORA-20876: Stop APEX Engine, so it’s probably preferable to avoid combining this with other PL/SQL code that might need to be committed first.
BEGIN
-- you need manually call apex_application.stop_apex_engine()
owa_util.redirect_url('https://apex.oracle.com/pls/apex/f?p=42:100', true);
apex_application.stop_apex_engine();
END;
apex_page.get_url(
p_page => 4,
p_items => 'P4_UNIQUE_ID,P4_REVISION',
p_values => unique_id||','||revision
) car_number_link
SELECT
apex_util.get_build_option_status(122, 'KEVIN_DEV_ONLY')
FROM dual;
BEGIN
-- https://blog.longacre.ch/2019/06/setting-http-response-status-code-301.html
owa_util.status_line(
nstatus => 301,
bclose_header => false);
var $ = apex.jQuery;
// Need to refresh whole page after alter EEE Engr action given authority is impacted
if (this.data.dialogPageId === X){
apex.submit();
}
$('#P3_CAPEX_START_DATE option:selected').text();
$('#P3_CAPEX_START_DATE option:selected').val();
apex
.item("PX_TYPED")
.setValue(
apex.item("PX_TYPED").getValue() +
String.fromCharCode(this.browserEvent.which)
);
apex
.jQuery(
'<div style="margin:4px; padding: 4px;">Please enter your name and email to receive weekly news letter</div>'
)
.dialog({
modal: true,
resizable: false,
height: 200px,
width: 300px,
title: "Sign Up",
buttons: {
"OK": function () {
apex.jQuery(this).dialog("close");
},
"Cancel": function () {
apex.jQuery(this).dialog("close");
}
}
});
// https://stackoverflow.com/questions/46370725/how-to-do-email-validation-using-regular-expression-in-typescript
var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))
@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/);
var email = apex.item("PX_EMAIL").getValue();
if (re.test(email)){
console.log("this is a valid email address");
} else {
apex
.jQuery(
'<div style="margin:4px; padding: 4px;">' + email + 'is not valid</div>'
)
.dialog({
modal: true,
resizable: false,
height: 200px,
width: 300px,
title: "Invalid Email",
buttons: {
"OK": function () {
apex.jQuery(this).dialog("close");
}
}
});
}
"x: " + this.browserEvent.clientX + "y: " + this.browserEvent.clientY;
// left button
this.browserEvent.button == 0;
// middle button
this.browserEvent.button == 1;
// right button
this.browserEvent.button == 2;
Support\APEX\APEX_CheatSheet.md
Oracle Application Express (APEX) Cheat Sheet
BEGIN
apex_application.stop_apex_engine();
END;
BEGIN
apex_session.create_session(
p_app_id=>498,
p_page_id=>200,
p_username=>'KZHANG');
END;
BEGIN
apex_session.detach;
END;
BEGIN
c_log_level_error CONSTANT t_log_level := 1; -- critical error
c_log_level_warn CONSTANT t_log_level := 2; -- less critical error
c_log_level_info CONSTANT t_log_level := 4; -- default level if debugging is enabled (e.g. used by apex_application.debug)
c_log_level_app_enter CONSTANT t_log_level := 5; -- application: messages when procedures/functions are entered
c_log_level_app_trace CONSTANT t_log_level := 6; -- application: other messages within procedures/functions
c_log_level_engine_enter CONSTANT t_log_level := 8; -- apex engine: messages when procedures/functions are entered
c_log_level_engine_trace CONSTANT t_log_level := 9; -- apex engine: other messages within procedures/functions
-- https://dgielis.blogspot.com/2019/06/see-apex-debug-info-in-plsql-and-sql.html
apex_debug.enable(
p_level => apex_debug.c_log_level_info
);
apex_debug.message(p_message => 'Debug enabled.');
END;
SELECT
*
FROM
apex_debug_messages
WHERE
session_id = 16458652970080
ORDER BY message_timestamp;
apex_util.redirect_url(p_url => apex_page.get_url(p_page => 1));
-- Warning: redirect_url raises the exception ORA-20876: Stop APEX Engine, so it’s probably preferable to avoid combining this with other PL/SQL code that might need to be committed first.
BEGIN
-- you need manually call apex_application.stop_apex_engine()
owa_util.redirect_url('https://apex.oracle.com/pls/apex/f?p=42:100', true);
apex_application.stop_apex_engine();
END;
-- f?p=4500:4:17166624244700::NO::P4_UNIQUE_ID,P4_REVISION:12345,A
SELECT
apex_page.get_url(
p_page => 4,
p_items => 'P4_UNIQUE_ID,P4_REVISION',
p_values => unique_id||','||revision
) car_number_link
FROM dual;
-- f?p=4500:4:17166624244700:::RP:P4_UNIQUE_ID:12345
SELECT
apex_util.prepare_url('f?p=&APP_ID.:4:&APP_SESSION.:::RP:P4_UNIQUE_ID:'||entity_id)
FROM dual;
SELECT
apex_util.get_build_option_status(122, 'KEVIN_DEV_ONLY')
FROM dual;
BEGIN
-- https://blog.longacre.ch/2019/06/setting-http-response-status-code-301.html
owa_util.status_line(
nstatus => 301,
bclose_header => false);
-- https://jeffkemponoracle.com/2019/07/conditionally-required-floating-item/
var item = $("#P1_COST_CENTRE");
item.prop("required",true);
item.closest(".t-Form-fieldContainer").addClass("is-required");
var $ = apex.jQuery;
// Need to refresh whole page after alter EEE Engr action given authority is impacted
if (this.data.dialogPageId === X){
apex.submit();
}
$('#P3_CAPEX_START_DATE option:selected').text();
$('#P3_CAPEX_START_DATE option:selected').val();
apex
.item("PX_TYPED")
.setValue(
apex.item("PX_TYPED").getValue() +
String.fromCharCode(this.browserEvent.which)
);
$(this.affectedElements[0])
.closet('.apex-item-wrapper')
.fadeOut();
apex
.jQuery(
'<div style="margin:4px; padding: 4px;">Please enter your name and email to receive weekly news letter</div>'
)
.dialog({
modal: true,
resizable: false,
height: 200px,
width: 300px,
title: "Sign Up",
buttons: {
"OK": function () {
apex.jQuery(this).dialog("close");
},
"Cancel": function () {
apex.jQuery(this).dialog("close");
}
}
});
// https://stackoverflow.com/questions/46370725/how-to-do-email-validation-using-regular-expression-in-typescript
var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))
@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/);
var email = apex.item("PX_EMAIL").getValue();
if (re.test(email)){
console.log("this is a valid email address");
} else {
apex
.jQuery(
'<div style="margin:4px; padding: 4px;">' + email + 'is not valid</div>'
)
.dialog({
modal: true,
resizable: false,
height: 200px,
width: 300px,
title: "Invalid Email",
buttons: {
"OK": function () {
apex.jQuery(this).dialog("close");
}
}
});
}
"x: " + this.browserEvent.clientX + "y: " + this.browserEvent.clientY;
// left button
this.browserEvent.button == 0;
// middle button
this.browserEvent.button == 1;
// right button
this.browserEvent.button == 2;