Search This Blog

Sunday, March 4, 2018

Manually / Dynamically Make Text Item In Oracle Apex

DECLARE
v_column    VARCHAR2 (20);
v_value     VARCHAR2 (20);
CURSOR c_columns
IS
    SELECT Column_Name_To_Count
      FROM Table_Name
     WHERE Condition
  ORDER BY ROWNUM;

TYPE column_rec IS RECORD (column_name VARCHAR2 (30));
TYPE columns_table IS TABLE OF column_rec;
t_columns   columns_table;
BEGIN
OPEN c_columns;
FETCH c_columns
BULK COLLECT INTO t_columns;
CLOSE c_columns;
HTP.p ('<br/>');
HTP.p ('<table><tbody>');

FOR i IN 1 .. t_columns.COUNT
LOOP
  HTP.p ('<tr>');
  HTP.p (
        '<td><label for="P42_C'
     || LPAD (i, 3, 0)
     || '" id="P42_C'
     || LPAD (i, 3, 0)
     || '_LABEL">'
     || t_columns (i).column_name
     || ' :  &nbsp &nbsp  &nbsp &nbsp &nbsp  '
     || '</label></td>');
  HTP.p (
        '<td>'
     || APEX_ITEM.TEXT (1, p_item_id => 'P42_C' || LPAD (i, 3, 0))
     || '</td>');
  HTP.p ('</tr>');
END LOOP;
HTP.p ('</tbody></table>');

EXCEPTION
WHEN OTHERS
THEN
  IF c_columns%ISOPEN
  THEN
     CLOSE c_columns;
  END IF;
END;

No comments:

Post a Comment

Restrict File Upload by File Type in Oracle Apex

If you want to restrict file upload by file type/extension/format you can follow the below steps.  Goto File Browser Item --> Advanced --...