The elements and the SQL Types

I just started learning apex and I'm confused about the application and page elements. Since they can serve as a kind of variables in the SQL and PL/SQL (for example, by using the syntax variables bind), at some point they should be prescribed a type, since SQL and PL/SQL are two strongly typed languages.

It seems that the items have types, see the documentation (http://docs.oracle.com/cd/E11882_01/appdev.112/e11947/bldapp.htm#BCEDCGGH), but I don't know how they correspond to the SQL types.

For example, I saw that to_date is always used with items of type date picker, implying that it is a string of SQL type.

So the question. What have SQL type apex page/application parts, is what type conversion do I need to use when dealing with items in SQL and PL/SQL?

They are all VARCHAR2 (4000) as far as I know - anything application are the same and the page elements is adjustable in number or date more. Put date or number will include only internal validation, check whether the format is match the parameters of globalization of applications.

Denes Kubicek
-------------------------------------------------------------------
http://deneskubicek.blogspot.com/
http://www.Apress.com/9781430235125
http://Apex.Oracle.com/pls/Apex/f?p=31517:1
http://www.Amazon.de/Oracle-Apex-XE-Praxis/DP/3826655494
-------------------------------------------------------------------

Tags: Database

Similar Questions

  • How to detect the SQL type to avoid SQL injection

    Hello

    I work in a company of gsm and we develop a program for analysis of trends. Users of this program can write SQL statements. I want to write sql statements specific as my program input statement (SELECT... from...). Instructions to SELECT most. I have dynamic SQL and PL/SQL blocks in my program. I get user-defined SQL statements and execute dynamic Sql code.

    Here's the problem: I need to understant what type of SQL, they give as my program input parameter to avoid wrong operations (DELETE, TRUNCATE, DROP...)

    First of all I thought to the RegExp to understant if a SELECT SQL or SQL DELETE...

    Is there a recommended on this problem? Oracle has any procedure to detect?

    Thank you

    Hi a_yavuz,

    We had to solve the same problem while we work a project that receives user sql statements, we check the sql as follows:

    lb_bool: = regexp_like (upper (pv_sql),'^ (-() * *(SELECT|))) (WITH)');

  • grant the privilege on the SQL types to another schema

    I created two SQL types under the APP_OWNER scheme as follows:

    CREATE or REPLACE TYPE t_instr_info as an OBJECT
    (NUMBER IMNT_KY)

    CREATE or REPLACE TYPE t_tab_instr_info
    AS THE t_instr_info TABLE

    The privilege on these two types as follows:

    Grant execute on t_tab_instr_info to vprods_app2

    Grant execute on t_instr_info to vprods_app2

    The stored procedures must be developed in the scheme of the APP. In the scheme of the APP, I need to call this type to declare the array as follows:

    v_tab_output app_owner.t_tab_instr_info: = app_owner.t_tab_instr_info ();

    I get a PLS-00905: object owner.t_tab_instr_info is not valid

    I tried giving EVERYTHING instead of run, but the problem persists.

    Help, please. As a policy of all objects including tables, types etc. must be app_owner and the app schema privileges

    Thank you in advance.

    One thing I forgot to mention (since you do not explicitly specify how you are granting things) is that you need to issue DIRECT subsidies (as in my example above), you cannot compile the code if you have subsidies via a role (but you can execute anonymous blocks).

    This is an example

    create user APP_OWNER identified by APP_OWNER default tablespace users temporary tablespace temp;
    grant connect, resource, create role to APP_OWNER;
    
    create user APP_SCHEMA identified by APP_SCHEMA default tablespace users temporary tablespace temp;
    grant connect, resource to APP_SCHEMA;
    
    connect APP_OWNER/APP_OWNER@xe
    
    create role for_apps;
    
    CREATE OR REPLACE TYPE t_instr_info as OBJECT
    (IMNT_KY NUMBER);
    / 
    
    CREATE OR REPLACE TYPE t_tab_instr_info
    AS TABLE OF t_instr_info;
    / 
    
    grant execute on t_instr_info to for_apps;
    grant execute on t_tab_instr_info to for_apps;
    
    grant for_apps to app_schema;
    
    connect APP_SCHEMA/APP_SCHEMA@xe
    APP_SCHEMA_XE?create or replace procedure test
      2  as
      3     v_tab_output app_owner.t_tab_instr_info := app_owner.t_tab_instr_info();
      4  begin
      5     null;
      6  end;
      7  /
    
    Warning: Procedure created with compilation errors.
    
    Elapsed: 00:00:01.17
    APP_SCHEMA_XE?show err
    Errors for PROCEDURE TEST:
    
    LINE/COL ERROR
    -------- -----------------------------------------------------------------
    3/17     PL/SQL: Item ignored
    3/17     PLS-00201: identifier 'APP_OWNER.T_TAB_INSTR_INFO' must be
             declared
    
    APP_SCHEMA_XE?declare
      2     v_tab_output app_owner.t_tab_instr_info := app_owner.t_tab_instr_info();
      3  begin
      4     null;
      5  end;
      6  /
    
    PL/SQL procedure successfully completed.
    
    Elapsed: 00:00:01.17
    
  • How to return the value of the SQL in the text element

    Hi friends

    I need you to guide me how I can print the return value of the SQL in a text element

    Suppose it's your function
    create or replace function get_value
    return number
    is
    begin
    return 3*2;
    end;
    /
    any help that I enjoyed

    Thank you

    >

    http://i46.Tinypic.com/11l0s5h.jpg

    This is ORA-06502: PL/SQL: digital error or value.

    Check the data type and size for items of text or any other variables or fields in the service.

  • How to change a property of all the elements of the specific type?

    Hello
    This should be quite simple:
    tableA (id, flag)

    There are 2 pages:
    Page 1: allows the user to select P1_ID based on the result set from TableA
    Page 2: there are a lot of items on this page - text fields, areas of text, radio and checkboxes, reports, etc.. He values in these elements are based on the following logic:
    Select < bunch of columns correspond to the page elements >
    from View1, view2...
    where < where clause >
    and
    some_column =: P1_ID

    Question:
    I need to not allow users to change the values in items of type text in page 2, if the value of P1_ID (TableA.id) has a flag value.

    How this can be done?

    The ideal solution would be if I have a routine that requires no coding hard element names.
    Thank you
    Andrew

    Published by: andrey on January 31, 2009 12:51

    Published by: andrey on January 31, 2009 12:52

    Andrew:

    The property that you set is the 'Read only' property for the page element. This is done from the page 'Edit Item'
    The conditions in which this property is set to true can be determined dynamically (no hard coding). Take a look at the list of possible Types of Conidtion. "So if you want the condition to focus on the table you could choose the ' Exists (SQL query returns at least one row)" and the SQL query may be something like
    "Select 1 from where id =: p1_id '.

    CITY

  • Is it possible to get the data type of element of a queue to itself?

    Hello world

    I have a Q which has a cluster as data type of element.

    now when I want to enqueue

    I will use bundle-default-

    and for this I have to have my current data type

    (long cable as (perhaps after where I got the Q).

    My question is,

    If there is a method/property-node/something that allows me to

    the queue of wire inside Refnum and receive the data element type.

    If I can get into the top of bundle-default?

    (I really want to have this cable in all directions)

    is this the reason why I'm asking here

    aid for the Refnum of outgoing queue to get a queue, the method

    indicates the data type of element and so I hope that there could be a solution.

    thx for your time

    and soon

    j

    Get queue status must be output with the type of data (more precisely an array of the data type and an array of clusters if the data is itself a table). If you do not set the items back to entry to T, this should not even cost anything.

    That said, I agree with others that it is better to what actually a typedef.

  • objects and the record type

    Hello experts.

    create type emp2_obj is object
    (
    objno number
    ,
    objname varchar2
    (20),
    objdept number
    );

    create type emp2_objarr is table of emp2_obj;

    and

    type emp2_rec is record
    (
    recno number
    ,
    recname varchar2
    (20),
    recdept number
    );

    create type emp2_recarr is table of emp2_rec ;

    Objects and types of records are created similar and have the same similar object.  Is it only advisable to use registration type if you use a collection in PL/SQL type... Please advice

    user13328581 wrote:

    the only reason why I ask is because he asked during an interview

    -Objects and the types of records are created similar and have the same similar object.  Is it only advisable to use registration type if you use a collection in PL/SQL type... Please advice

    Not at all.  You can use record types used with collection types outside.  They are a group concept.  If you want to group a set of values together (including fields), you can use a record.  It may be convenient.  You can send documents around proc and functions.

    Be aware that the record types are limited to procedures, functions, anonymous blocks and packages (i.e. PL/SQL), while the types of objects are stored in the dictionary of data as a separate Oracle objects (they can also have methods, the records may not).  Object types can be used in SQL, as said sol.beach types of records (outside of the intelligent pipeline situations) is for PL/SQL.

  • table col name get the details of the table column and inserting of values depending on the data type of the column

    Hello

    I am train to write a procedure where I would spend the table as a parameter name and then the code would determine it is column names, and then he would insert records in each column depending on the data type. could someone help me with this.

    Thank you

    SM

    Hello

    Perhaps you need to dummy data just for the table.

    Here is my exercise

    create or replace
    procedure generate_rows(p_table_name varchar2, p_count number)
    is
      --
      function insert_statement(p_table_name varchar2) return clob
      is
        l_columns clob;
        l_expressions clob;
        l_sql clob default
          'insert into p_table_name (l_columns) select l_expressions from dual connect by level <= :p_count';
      begin
        select
          -- l_columns
          listagg(lower(column_name), ',') within group (order by column_id),
          -- l_expressions
          listagg(
            case
            when data_type = 'DATE'
              then  'sysdate'
            when data_type like 'TIMESTAMP%'
              then  'systimestamp'
            when data_type = 'NUMBER'
              then  replace('dbms_random.value(1,max)',
                      'max', nvl(data_precision - data_scale, data_length)
                    )
            when data_type = 'VARCHAR2'
              then  replace(q'|dbms_random.string('a',data_length)|',
                      'data_length', data_length
                    )
            else
                    'NULL'
            end, ',') within group (order by column_id)
        into
          l_columns,
          l_expressions
        from user_tab_columns
        where table_name = upper(p_table_name);
        --
        l_sql := replace(replace(replace(l_sql,
          'p_table_name', p_table_name),
          'l_columns', l_columns),
          'l_expressions', l_expressions);
        -- debug
        dbms_output.put_line(l_sql);
        --
        return l_sql;
      end;
    begin
      execute immediate insert_statement(p_table_name) using p_count;
    end;
    /
    
    -- test
    create table mytable(
      id number(4,0),
      txt varchar2(10),
      tstz timestamp with time zone,
      dt date,
      xml clob
    )
    ;
    set serveroutput on
    exec generate_rows('mytable', 10);
    select id, txt from mytable
    ;
    drop procedure generate_rows
    ;
    drop table mytable purge
    ;
    
    Procedure GENERATE_ROWS compiled
    Table MYTABLE created.
    PL/SQL procedure successfully completed.
    
    insert into mytable (id,txt,tstz,dt,xml) select dbms_random.value(1,4),dbms_random.string('a',10),systimestamp,sysdate,NULL from dual connect by level <= :p_count
            ID TXT
    ---------- ----------
             3 WnSbyiZRkC
             2 UddzkhktLf
             1 zwfWigHxUp
             2 VlUMPHHotN
             3 adGCKDeokj
             3 CKAHGfuHAY
             2 pqsHrVeHwF
             3 FypZMVshxs
             3 WtbsJPHMDC
             3 TlxYoKbuWp
    
    10 rows selected
    
    Procedure GENERATE_ROWS dropped.
    Table MYTABLE dropped.
    

    and here is the vision of Tom Kyte for the same https://asktom.oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:2151576678914

    Edit: to improve my code, it must use p_count as bind as Tom.

  • You cannot change the output type and format in the page requests system - PeopleSoft process

    Hi all

    When I navigate to the PeopleSoft process scheduler page and try to run a process I see the output type and format web and txt only. I am unable to change the output type and format. All formats and types of output are marked as active in the system settings page. I'm super user of the system as well. I have as well the role of Admin ProcessScheduler. I would like to know if someone has already faced similar problems.

    Thank you

    Vimal

    Run the following SQL query to your OPRID:

    SELECT A.CLASSID, PSPRCSPRFL A.OVRDOUTDEST, PSOPRDEFN B WHERE B.PRCSPRFLCLS = A.CLASSID AND B.OPRID = '';

    Make sure that OVRDOUTDEST = 1.

    If it's 0 then you have to fix your configuration profile of the process as follows:

    -Main menu > PeopleTools > Security > list permission > CLASSID research (white list) back to top query

    -Go to the process tab

    -Click on "process the profile permissions

    S ' ensure that 'substitute an output Destination' is checked. Click OK, and then save.

    This should solve your problem.

  • ORA-06502: PL/SQL: digital error or the value in the conversion for a long TIME on the CLOB type

    Hello

    I have an EA of RDBMS Oracle 11.2.0.4.

    I ger the following error when I try to convert a data type LONG to type CLOB data thanks to a PL/SQL procedure:

    declare
    v_prefix varchar2 (20): = null;
    v_text_view_clob clob: = null;
    long v_text_view_long: = null;

    cursor c_v
    is
    Select
    a.view_name as view_name
    Of
    USER_VIEWS one;

    Start
    for r_v in c_v
    loop
    Start
    v_text_view_clob: = null;
    v_text_view_long: = null;

    -Do the SQL code of the view
    Select
    a.Text text
    in
    v_text_view_long
    Of
    USER_VIEWS one
    where
    a.view_name = r_v.view_name;

    v_text_view_clob: = v_text_view_long;

    update of ohibo_views one
    set
    a.view_text = v_text_view_clob
    where
    a.view_name = r_v.view_name;
    exception
    while others then
    dbms_output.put_line ('View =' | r_v.view_name |) "kan niet worden geconverteerd!");
    dbms_output.put_line (substr (sqlerrm, 1, 60));
    end;
    end loop;
    -commit;
    exception
    while others then
    lift;
    end;
    /

    I get the error a specific record:

    View = VER_POLISMUTATIES_VW kan niet worden geconverteerd!

    ORA-06502: PL/SQL: digital error or value

    At looked the origina; Value of type LONG and it is indeed a "long" piece of text.

    However, CLOB has a restriction about 4G * db_block_size and LONG 2 G - 1 according to the documentation.

    I should be able with the method above to convert a LONG in CLOB.

    Anyone had a similar situation?

    Thanks in advance for advice how to solve.

    Kind regards

    PS: my apologies, I didn't know which group to post this discussion: database or PL/SQL.

    Good indeed, a link with the right explanation.

    I didn't know that there was such a function.

    Thank you!

    Kind regards

  • Hello friends, I want to know what the data type can be declared in pl/sql, but cannot be declared in sql?

    Hello friends, I want to know what the data type can be declared in pl/sql, but cannot be declared in sql?

    Hello friends, I want to know what the data type can be declared in pl/sql, but cannot be declared in sql?

    That question is ambiguous: there is NOT a SINGLE type of data that can be declared in pl/sql, but not in sql.

    The Oracle documentaton is your friend.

    The doc of the SQL language treats the SQL data types.

    http://docs.Oracle.com/CD/B28359_01/server.111/b28318/datatype.htm

    The doc PL/SQL does PL/SQL data types. Because PL/SQL is a language of proceedings (and sql is NOT) there are several types of data, as shown in this doc, PL/SQL-specific:

    PL/SQL scalar data types are:

    • SQL data types
    • BOOLEAN
    • PLS_INTEGER
    • BINARY_INTEGER
    • REFCURSORexplained in "Cursor Variables"
    • User-defined subtypes

    ALWAYS start with the Oracle documentation for these fundamental questions.

    Several times, as with this question, the question is too general to give a simple answer.

  • Want to migrate the database (4node RAC) size of 4 TB of 10.2.0.5 at 11.2.0.4 on the new servers where the new type servers Primary (4 nodes) and Eve (4 nodes).

    Want to migrate the database (4node RAC) 4 TB size of 10.2.0.5(8 rompt = 4 prim/4 veille) to 11.2.0.4 on the new servers where the new type servers Primary (4 nodes) and Eve (4 nodes).  So with minimum downtime I have restore and recover again on 11.2.0.4 server must then clone that to create the day before.   Here, my question is can I take 0 backupp level before hand and restore on target (new) then primary at the time to leave the downtime take backup of level 1 of 10g and then retrieve it on 11g (new server) after successful recovery I'll perform clone to form eve of database on the new server. does this strategy work? If it works, can someone suggest me steps how can I need recover with backup after restoring the backup of level 0 on 11g. Like should I upgrade before you retrieve it with level 1 backup or I can update and then recover with the level 1 backup from the old server to the new server.

    Here is former servers of RHEL 5 version and new servers are RHEL 6 release.

    Post edited by: Umair_ali

    1 backup L0

    2 restore L0

    3. L1 and ArchiveLogs database backup

    4. copy BackupPieces L1 and ArchiveLog BackupPieces on new server

    5 CATALOGUE START WITH... to catalog the BackupPieces

    6. TOGETHER until lastavailable SNA / Archivelog + 1

    7 RECOVER DATABASE (should automatically identify the L1s and to apply ArchiveLogs)

    8 STOP

    9 START UPGRADE

    10. run catupgrd.sql

    You should also take care on the locations of the data file, dump, instance settings destinations, all link database from the database, connectivity application etc.

    Hemant K Collette

  • ORA-06504: PL/SQL: return variables of the game results or the query types do not match

    Hello!

    I have a simple object type and a proecdure in which I am trying to use it to insert into another table

    -object

    CREATE ORREPLACETYPEmt_mtg ASOBJECT

    (

    ACOL NUMBER ,

    BCOL NVARCHAR2 (100)

    );

    CREATE ORREPLACETYPEREF_MTG ASTABLEOFMt_MTG ;

    -same structure as the use of sampletbl target table in the cursor query

    create table tbl_MT_MTG

    (

    ACOL NUMBER ,

    BCOL NVARCHAR2 (100)

    );

    -procedure

    CREATE ORREPLACEINTERIORTEST_PROCEDURE1

    AS

    ref_cur sys_refcursor ;

    REFR ref_mtg ;

    BEGIN

    OPEN ref_cur FOR

    Select acol,

    BCOL

    DE sampletbl rownum<10;

    Fetch ref_cur in bulk collectintorefr;

    Insert intotbl_MT_MTG(acol,bcol)selectacol,bcol fromtable(refr);

    commit;

    CLOSE Ref_cur;

    END;

    /

    When I run this procedure fails with

    ORA-06504: PL/SQL: return variables of the game results or the query types do not match

    ORA-06512: at "TEST_PROCEDURE1", line 10

    ORA-06512: at line 2

    Any help on this please...

    Thanks to an OLD POST below

    so perfect helped me! Thank you

    Tubby

    After 5 years of more :-)

    How to store refcursor in collection How to store refcursor in collection

  • The attributes of the element list empty when adding attribute #FROM_ROLE to the message (Type CREATEPO element)

    I'm customizing item type CREATEPO adding a new notification with the corresponding message and I am facing a problem with the workflow designer (using the v2.6.3.5.0 Oracle workflow Builder).

    This notification must have a specific sender, which is already stored in a custom element attribute.

    According to the developer's Guide, I add a new message attribute with the internal name = "#FROM_ROLE" for the new custom message.

    I put all the remaining data, according to the instructions of the Manual: Type = role, source = send, full name and description = ' role', default = attribute Item type.

    But when I try to set the default value, the list is empty and I can't choose any attribute of the element.

    I tried to define a new message in other Types of items, such as REQAPPRV, and in this case, the list of attributes is displayed correctly.

    Any idea or solution?

    Thanks in advance,

    David

    I already solved the problem.

    So that the attributes of the element to appear as default values for the attribute Message #FROM_ROLE, they must also be of type role.

  • How to the return type of function from PL/SQL

    Hello

    I need to create a function that returns a list of ID, which is stored in a type T_IDs, something like:

    search function (searchstring in varchar2) return to T_IDs

    I have a little problem with the type within the body of the function using a select statement and filling

    Select the id of the table where the text as searchstring.

    which is to select a list of IDS corresponding to the where clause. Is it possible to use select in or should I go for another mechanism?

    Thanks for all the ideas.

    Bulk Collect works for me...

    SQL> create type t_ids as table of number;
      2  /
    
    Type created.
    
    SQL> ed
    Wrote file afiedt.buf
    
      1  create or replace function get_ids(deptno in number) return t_ids is
      2    ids t_ids;
      3  begin
      4    select empno
      5    bulk collect into ids
      6    from   emp
      7    where  deptno = get_ids.deptno;
      8    return ids;
      9* end;
    SQL> /
    
    Function created.
    
    SQL> select * from table(get_ids(10));
    
    COLUMN_VALUE
    ------------
            7782
            7839
            7934
    

    However, I would rarely use such a data collection, as it fills with PGA in memory and passing a lot of data between SQL and PL/SQL. I must have a just cause and justified in wanting to do things this way.

Maybe you are looking for