Hola tengo una tarea sobre los siguientes temas de oracle si alguien puede ayudarme por favor los necesito para realizar mi proyecto final. Los temas son GET_BLOCK_PROPERTY, GET_RECORD_PROPERTY SET_RECORD_PROPERTY, PARA QUE SIRVEN Y COMO SE UTILIZAN OJALA PUEDAN AYUDARME. GRACIAS. ERIC
rblancol 04 de Noviembre del 2004
Built-in Type: unrestricted function
Enter Query Mode: yes
Returns information about a specified block. You must issue a call to the built-in once for each property value you want to retrieve.
block_id Specifies the unique ID Oracle Forms assigns when it creates the block. The data type of the ID is Block.
block_name Specifies the CHAR name that you gave to the block when defining it. The data type of the name is CHAR.
property Specify one of the following constants to return information about the given block:
BASE_TABLE Returns the name of the base table for the indicated block or NULL if the block does not have a base table. Corresponds to the Base Table block property.
COLUMN_SECURITY Returns the CHAR value of TRUE if column security is set to True, and the character string FALSE if it is set to False.
COORDINATION_STATUS For a block that is a detail block in a master-detail block relation, this property specifies the coordination status of the block with respect to its master block(s). Returns the CHAR value COORDINATED if the block is coordinated with all of its master blocks. If it is not coordinated with all of its master blocks, the built-in returns the CHAR value NON_COORDINATED. Immediately after records are fetched to the detail block, the status of the detail block is COORDINATED. When a different record becomes the current record in the master block, the status of the detail block again becomes NON_COORDINATED.
CURRENT_RECORD Returns the number of the current record.
CURRENT_RECORD_ATTRIBUTE Returns the CHAR name of the named visual attribute of the given block.
DEFAULT_WHERE Returns the default WHERE clause in effect for the block, as indicated by the current setting of the WHERE block property.
DELETE_ALLOWED Returns the CHAR value TRUE if the Delete Allowed block property is True, FALSE if it is False. This property determines whether the operator or the application is allowed to delete records in the block.
ENTERABLE Returns the CHAR value TRUE if the block is enterable, that is, if any item in the block has its Enabled and Navigable properties set to True. Returns the character string FALSE if the block is not enterable.
FIRST_DETAIL_RELATION Returns the CHAR name of the first relation in which the given block is a detail. Returns NULL if one does not exist.
FIRST_ITEM Returns the CHAR name of the first item in the given block.
FIRST_MASTER_RELATION Returns the CHAR name of the first relation in which the given block is a master. Returns NULL if one does not exist.
INSERT_ALLOWED Returns the CHAR value TRUE if the Insert Allowed block property is True, FALSE if it is False. This property determines whether the operator or the application is allowed to insert records in the block.
KEY_MODE Returns the CHAR value that indicates the current setting of the Key Mode block property. Return values for this property are UNIQUE_KEY, UPDATEABLE_PRIMARY_KEY, or NON_UPDATEABLE_PRIMARY_KEY.
LAST_ITEM Returns the name of the last item in the given block.
LOCKING_MODE Returns the CHAR value IMMEDIATE if rows are to be locked immediately on a change to a base table item; otherwise, it returns the CHAR value DELAYED if row locks are to be attempted just prior to a commit.
NAVIGATION_STYLE Returns the CHAR value that indicates the current setting of the block's NAVIGATION_STYLE property, either SAME_RECORD, CHANGE_RECORD, or CHANGE_BLOCK.
NEXTBLOCK Returns the name of the next block. Returns NULL if the indicated block is the last block in the form. Note that the setting of the block's NEXT_NAVIGATION_BLOCK property has no effect on the value of NEXTBLOCK.
NEXT_NAVIGATION_BLOCK Returns the CHAR name of the block's next navigation block. By default, the next navigation block is the next block as defined by the order of blocks in the Object Navigator; however, the NEXT_NAVIGATION_BLOCK block property can be set to override the default block navigation sequence.
OPTIMIZER_HINT Returns a hint in the form of a character string that Oracle Forms passes on to the RDBMS optimizer when constructing queries.
ORDER_BY Returns the default ORDER BY clause in effect for the block, as indicated by the current setting of the ORDER BY block property.
PREVIOUSBLOCK Returns the name of the block that has the next lower sequence in the form, as defined by the order of blocks in the Object Navigator. Returns NULL if the indicated block is the first block in the form. Note that the setting of the block's PREVIOUS_NAVIGATION_BLOCK property has no effect on the value of PREVIOUSBLOCK.
PREVIOUS_NAVIGATION_BLOCK Returns the CHAR name of the block's previous navigation block. By default, the previous navigation block is the block with the next lower sequence, as defined by the order of blocks in the Object Navigator; however, the NEXT_NAVIGATION_BLOCK block property can be set to override the default block navigation sequence.
PRIMARY_KEY Returns the CHAR value TRUE if the Primary Key property is set to True for the block. Otherwise, if the Primary Key property is set to False, this parameter returns the CHAR value FALSE.
QUERY_ALLOWED Returns the CHAR value TRUE if the Query Allowed block property is True, FALSE if it is False. This property determines whether the operator or the application is allowed to query records in the block.
QUERY_HITS Returns the CHAR value that indicates the number of records identified by the COUNT_QUERY operation. If this value is examined while records are being retrieved from a query, QUERY_HITS specifies the number of records that have been retrieved.
QUERY_OPTIONS Returns the CHAR values VIEW, FOR_UPDATE, COUNT_QUERY, or a null value if there are no options. You can call GET_BLOCK_PROPERTY with this parameter from within a transactional trigger when your user exit needs to know what type of query operation Oracle Forms would be doing by default if you had not circumvented default processing.
RECORDS_DISPLAYED Returns the number of records that the given block can display. Corresponds to the Records Displayed block property.
RECORDS_TO_FETCH Returns the number of records Oracle Forms expects an On-Fetch trigger to fetch and create as queried records.
STATUS Returns the CHAR value NEW if the block contains only new records, CHANGED if the block contains at least one changed record, and QUERY if the block contains only valid records that have been retrieved from the database.
TOP_RECORD Returns the record number of the topmost visible record in the given block.
UPDATE_ALLOWED Returns the CHAR value TRUE if the Update Allowed block property is True, FALSE if it is False. This property determines whether the operator or the application is allowed to update records in the block.
UPDATE_CHANGED_COLUMNS Specifies that only those columns updated by an operator will be sent to the database. When Update Changed Columns is set toFalse, all columns are sent, regardless of whether they have been updated. This can result in considerable network traffic, particularly if the block contains a LONG data type.
** Built-in: GET_BLOCK_PROPERTY
** Example: Return the screen line of the current record in
** a multi-record block. Could be used to
** dynamically position LOV to a place on the
** screen above or below the current line so as to
** not obscure the current record in question.
RETURN NUMBER IS
cur_blk VARCHAR2(40) := :System.Cursor_Block;
** Get the block id since we'll be doing multiple
** Get_Block_Property operations for the same block
bk_id := Find_Block( cur_blk );
** Determine the (1) Current Record the cursor is in,
** (2) Current Record which is visible at the
** first (top) line of the multirecord
cur_rec := Get_Block_Property( bk_id, CURRENT_RECORD);
top_rec := Get_Block_Property( bk_id, TOP_RECORD);
** Determine the position on the screen the first field in
** the multirecord block
itm_lin := Get_Item_Property( Get_Block_Property
** Add the difference between the current record and the
** top record visible in the block to the screen position
** of the first item in the block to get the screen
** position of the current record:
cur_lin := itm_lin + (cur_rec - top_rec);
Returns the value for the given property for the given record number in the given block. The three parameters are required. If you do not pass the proper constants, Oracle Forms issues an error. For example, you must pass a valid record number as the argument to the record_number parameter.
record_number Specifies the record in a block for which you want property information. The number must correspond to a record number.
block_name Specifies the block containing the target record.
property Specifies the property for which you want the current state. One property constant is supported: Status.
STATUS returns NEW if the record is marked as new and there is no changed record in the block. Returns CHANGED if the record is marked as changed. Returns QUERY if the record is marked as query. Returns INSERT if the record is marked as insert.
The following table illustrates the situations which return a NEW status.
Record Status Block Status Form Status
Created record with no modified fields NEW <N|Q|C> <N|Q|C>
...and all records in current block are NEW NEW NEW <N|Q|C>
...and all blocks in current form are NEW NEW NEW NEW
The following table illustrates the effect on record, block, and form status of changes to base table items and control item in base table and control blocks.
Type of Block/Type of Item Changed Record Status Before Change Record Status After Change Block Status Form Status
In a Base Table Block: Change a Base Table Item NEW INSERT CHANGED CHANGED
In a Base Table Block:Change a Base Table Item QUERY CHANGED CHANGED CHANGED
In a Base Table Block:Change a Control Item QUERY QUERY <Q|C> <Q|C>
...and no record in current block is changed QUERY QUERY <Q|C>
...and no block in current form is changed QUERY QUERY QUERY
In a Base Table Block: Change a Control Item NEW INSERT <Q|C> <Q|C>
In a Control Block: Change a Control Item NEW INSERT <Q> <Q|C>
...and no record in current block is changed INSERT QUERY <Q|C>
...and no block in current form is changed INSERT QUERY QUERY
Note: Both GET_RECORD_PROPERTY and the system variable SYSTEM.RECORD_STATUS return the status of a record in a given block, and in most cases, they return the same status. However, there are specific cases in which the results may differ.
GET_RECORD_PROPERTY always has a value of NEW, CHANGED, QUERY, or INSERT, because GET_RECORD_PROPERTY returns the status of a specific record without regard to the processing sequence or whether the record is the current record.
SYSTEM.RECORD_STATUS, on the other hand, can in certain cases return a value of NULL, because SYSTEM.RECORD_STATUS is undefined when there is no current record in the system. For example, in a When-Clear-Block trigger, Oracle Forms is at the block level in its processing sequence, so there is no current record to report on, and the value of SYSTEM.RECORD_STATUS is NULL.
** built-in: GET_RECORD_PROPERTY
** Example: Obtain the status of a record in given block
IF Get_Record_Property(1,'orders',STATUS) = 'NEW' AND
Get_Record_Property(1,'customers',STATUS) = 'NEW' THEN
Message('You must enter a customer and order first!');
Sets the specified record property to the specified value.
record_number Specifies the number of the record whose status you want to set. The record number is the record's position in the block. Specify as a whole number.
block_name Specifies the name of the block in which the target record exists. The data type of the name is CHAR.
property Use the following property:
STATUS Specifies that you intend to change the record status. STATUS is a constant.
value Use one of the following values:
CHANGED_STATUS Specifies that the record should be marked for update and should be treated as an update when the next commit action occurs.
INSERT_STATUS Specifies that the record is to be marked as an INSERT and should be inserted into the appropriate table when the next commit action occurs.
NEW_STATUS Specifies that the record is to be treated as a NEW record, that is, a record that has not been marked for insert, update, or query.
QUERY_STATUS Specifies that the record is to be treated as a QUERY record, whether it actually is. See also the CREATE_QUERIED_RECORD built-in.
The following table illustrates the valid transition states of a record.
Current Status Target Status
NEW QUERY INSERT CHANGED
NEW yes yes1 yes2 no
QUERY yes yes no yes
INSERT yes yes3 yes no
CHANGED yes yes no yes
1. Adheres to the rules described in footnotes 2 and 3.
2. This transition is not allowed in query mode, because QUERY and INSERT are not valid in query mode.
3. If this transition is performed while Runform is running in Unique Key mode and not all of the transactional triggers exist, then you must enter a valid value in the ROWID field. Put another way, if you are connected to a non-ORACLE data source that does not support ROWID, but you are using a unique key, you must supply the key for a record that goes from Insert to Query, in one of the transactional triggers, either On-Lock, On-Update, or On-Delete. Otherwise Oracle Forms returns an error.
** Built-in: SET_RECORD_PROPERTY
** Example: Mark the third record in the EMP block as if it
** were a queried record.
Set_Record_Property( 3, 'EMP', STATUS, QUERY_STATUS);