1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

For exam 1z0-141: How define a data block based on a query that is dependent on SQL

Discussion in 'Oracle Forms and Reports' started by mliviu, Jul 9, 2011.

?

Choose one option

Poll closed Jul 18, 2011.
  1. A.Define a data block based on RefCursor

    1 vote(s)
    100.0%
  2. B.Define a data block based on a TableofRecords

    0 vote(s)
    0.0%
  3. C.Define a data block based on a FromClause query

    0 vote(s)
    0.0%
  4. D.Define a data block based on a combination of a RefCursor and a TableofRecords

    0 vote(s)
    0.0%
  5. E.Define a data block based on a FromClause query and define Transactional triggers DML statements.

    0 vote(s)
    0.0%
  1. mliviu

    mliviu Guest

    Question:You have been asked to define a data block based on a query that is dependent on SQL only. The data will not be updated by the user. Selection of the tables to be queried will be decided by the user's at run time.
    How should you define the appropriate data source?
    Choose one

    A. Define a data block based on Ref Cursor.
    B. Define a data block based on a Table of Records.
    C. Define a data block based on a From Clause query.
    D. Define a data block based on a combination of a Ref Cursor and a Table of Records.
    E. Define a data block based on a From Clause query and define Transactional triggers for controlling DML statements.


    I've found on internet that the correct answer is "A. Define a data block based on Ref Cursor.", but I think this is not correct because a Ref Cursor is not based only on PL/SQL.
     
  2. zargon

    zargon Community Moderator Forum Guru

    Messages:
    2,347
    Likes Received:
    348
    Trophy Points:
    1,430
    Location:
    Aurora, CO
    Re: For exam 1z0-141: How define a data block based on a query that is dependent on

    "You have been asked to define a data block based on a query that is dependent on SQL only."

    Nothing is stated in that problem definition that states PL/SQL only; the Ref cursor is the correct answer as it can be populated by a dynamic sql statement:

    Code (SQL):
    SQL> CREATE OR REPLACE FUNCTION get_tab_data(tabname IN varchar2)
      2  RETURN sys_refcursor AS
      3
      4          mycur sys_refcursor;
      5
      6          sqlstr varchar2(4000);
      7
      8  BEGIN
      9          sqlstr := 'select * from '||tabname;
     10
     11          OPEN mycur FOR sqlstr;
     12
     13          RETURN mycur;
     14
     15  END;
     16  /
    FUNCTION created.
    SQL>
    SQL> SHOW errors FUNCTION get_tab_data
    No errors.
    SQL>
    SQL> SELECT get_tab_data('EMP') FROM dual;
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
    ---------- ---------- --------- ---------- --------- ---------- ---------- ----------
          7369 SMITH      CLERK           7902 17-DEC-80        800                    20
          7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
          7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
          7566 JONES      MANAGER         7839 02-APR-81       2975                    20
          7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
          7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
          7782 CLARK      MANAGER         7839 09-JUN-81       2450                    10
          7788 SCOTT      ANALYST         7566 09-DEC-82       3000                    20
          7839 KING       PRESIDENT            17-NOV-81       5000                    10
          7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
          7876 ADAMS      CLERK           7788 12-JAN-83       1100                    20
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
    ---------- ---------- --------- ---------- --------- ---------- ---------- ----------
          7900 JAMES      CLERK           7698 03-DEC-81        950                    30
          7902 FORD       ANALYST         7566 03-DEC-81       3000                    20
          7934 MILLER     CLERK           7782 23-JAN-82       1300                    10
    14 ROWS selected.

    SQL>
     
  3. mliviu

    mliviu Guest

    Re: For exam 1z0-141: How define a data block based on a query that is dependent on

    For "zargon":
    But you've used PL/SQL... The problem say to use just SQL not PL/SQL.
    I'am right?
     
  4. zargon

    zargon Community Moderator Forum Guru

    Messages:
    2,347
    Likes Received:
    348
    Trophy Points:
    1,430
    Location:
    Aurora, CO
    Re: For exam 1z0-141: How define a data block based on a query that is dependent on

    This is an Oracle Forms exam, such forms are written in PL/SQL; the data SOURCE for the form block is a dynamic query (SQL):

    "Question:You have been asked to define a data block based on a query that is dependent on SQL only."

    Thus is stands to reason this will be a basic PL/SQL block utilizing a reference cursor to return the data. I have followed the instructions; possibly you need a better understanding of what Oracle forms is before you attempt any more of this exam.
     
  5. mliviu

    mliviu Guest

    Re: For exam 1z0-141: How define a data block based on a query that is dependent on

    Hi!
    I appreciate your answer.
    But my opinion it that the answer :"C. Define a data block based on a From Clause query." is the correct answer,because it uses just SQL, jusst how is requested by question. The structure that you've userd is a pure PL/SQL construct.
     
  6. zargon

    zargon Community Moderator Forum Guru

    Messages:
    2,347
    Likes Received:
    348
    Trophy Points:
    1,430
    Location:
    Aurora, CO
    Re: For exam 1z0-141: How define a data block based on a query that is dependent on

    You're not reading the problem definition correctly in my opinion. The general consensus on the web agrees with my answer, however you're free to choose whichever answer you like best.