Skip Headers
Oracle® OLAP DML Reference
10g Release 2 (10.2)

Part Number B14346-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Feedback

Go to previous page
Previous
Go to next page
Next
View PDF

AW command

The syntax of the AW command varies depending on the task that you want to perform.


AW ALIASLIST
AW ATTACH
AW CREATE
AW DELETE
AW DETACH
AW LIST
AW SEGMENTSIZE
AW TRUNCATE

Notes

Triggering Program Execution When an AW Statement Executes

When a program named TRIGGER_AW exists in the analytic workspace, the execution of any AW ATTACH, AW CREATE, AW DELETE, or AW DETACH statement automatically executes that program. See "Trigger Programs" and TRIGGER_AW, for more information.

When an AW ATTACH statement executes Oracle OLAP checks for other programs as well. See "Programs Executed When Attaching Analytic Workspaces" for more information.

Options Related to the AW Statement

Table A-3, "Options Related to Working with Analytic Workspaces" lists the options that you might want to reset before you either create or attach an analytic workspace.

EXPRESS Workspace

When your database is installed with the OLAP option, the EXPRESS workspace is always attached in read-only mode in your session. It never automatically becomes the current workspace, even when it is the first or only workspace in your workspace list, because it is for internal use by Oracle OLAP. You can make the EXPRESS workspace the current workspace by explicitly attaching it, but this is not recommended. You cannot detach the EXPRESS workspace.


AW ALIASLIST

The AW ALIASLIST command assigns or deletes one or more workspace alias for the specified attached workspace or, when no workspace is specified, for the current workspace. ALIAS indicates that the alias or aliases should be assigned, and UNALIAS indicates that the alias or aliases should be deleted. All aliases for a given workspace are automatically deleted when you detach a workspace.

Syntax

AW ALIASLIST [workspace] {ALIAS|UNALIAS} alias1, alias2, ...

Arguments

workspace

The name of the analytic workspace. You can specify either a workspace name or a workspace alias, depending on the keywords you are using.

ALIAS

Assigns one or more workspace alias for the specified attached workspace or, when no workspace is specified, for the current workspace. ALIAS indicates that the alias or aliases should be assigned, and UNALIAS indicates that the alias or aliases should be deleted.

All aliases for a given workspace are automatically deleted when you detach a workspace. Therefore, each time you attach an unattached workspace, you must reassign its aliases.

UNALIAS

Deletes one or more workspace alias for the specified attached workspace or, when no workspace is specified, for the current workspace.

alias1
alias2

The alias name for the analytic workspace. Alias names:

  • Can be from 1 - 26 characters in length. All characters must come from the database character set and must be letters, numerals, or underscores.

  • Cannot begin with a numeral and cannot be reserved words in the DML. (Use RESERVED to identify reserved words.)

Examples

Example 8-13 Assigning an Alias

The following statement assigns sdemo as an alias for the demo workspace, which was created by a user named scott. The full name of the workspace is specified because the current user is not scott.

AW ALIASLIST scott.demo ALIAS sdemo

In the following statement, the user named scott assigns mydemo as an alias for the same workspace.

AW ALIASLIST demo ALIAS mydemo

AW ATTACH

The AW ATTACH command attaches a workspace to your session. Oracle OLAP makes the specified workspace the current one. Previously attached workspaces move down in the list of attached workspaces to make room for the new current one at the top of the list.

When you attach more than one workspace, the code and data in all the attached workspaces are available during your session. The current workspace is first on the workspace list, which Oracle OLAP keeps for your session.


Note:

When an AW ATTACH statement executes, it can trigger the execution of several other programs. See "Programs Executed When Attaching Analytic Workspaces" for more information.

Syntax

AW ATTACH workspace  -

     [ONATTACH [progname]|NOONATTACH] -

     [RO|RW|RWX|MULTI] [WAIT|NOWAIT] -

     [AUTOGO [progname]|NOAUTOGO] -

     [AFTER workspace|BEFORE workspace|LAST|FIRST] -

     [PASSWORD password]

Arguments

workspace

The name of the analytic workspace. When you use the ATTACH keyword to attach a workspace that is not already attached, you must specify the workspace name. Again this is because no alias has been assigned using AW ALIASLIST. However, when you use the ATTACH keyword on an already attached workspace (for example, in order to change its position in the workspace list), you can assign an alias using AW ALIASLIST and then use that assigned alias.

ONATTACH [progname]

An Onattach program automatically executes when the workspace is started:

  • When you specify the ONATTACH keyword without following it with a program name, Oracle OLAP looks in the workspace for a program named ONATTACH and executes it if it exists. This syntax is provided for clarity in your programs. You can get the same results by not specifying ONATTACH.

  • When you specify the ONATTACH keyword and you follow it with a program name, Oracle OLAP looks in the workspace for a program of that name. When it exists, Oracle OLAP executes that program, even when a program named ONATTACH exists in the workspace. See "Programs Executed When Attaching Analytic Workspaces" for more information.

NOONATTACH

Specifying NOONATTACH indicates that when a program named ONATTACH exists in the workspace, Oracle OLAP should not execute that program.

AUTOGO progname

When you do not specify progname, the AUTOGO clause automatically runs a program named AUTOGO if one exists in the attached workspace. When you do specify progname, the AUTOGO clause automatically runs the specified program in the attached program. See "Programs Executed When Attaching Analytic Workspaces" for more information.

NOAUTOGO

(Default) Specifying NOAUTOGO indicates that there is no Autogo program. This syntax is provided for clarity in your programs. You can get the same results by not specifying AUTOGO progname.

RO

(Default) Specifies that the workspace is attached in read-only access mode. Users can make private changes to the data in the workspace to perform what-if analysis but cannot commit any of these changes.

A workspace that is attached read-only can be accessed simultaneously by several sessions. The read-only attach mode is compatible with the read/write and multiwriter access mode. A user can attach an analytic workspace in read-only mode when other users have the workspace attached in either read/write and multiwriter access mode. Likewise, a user cannot attach an analytic workspace in read/write exclusive mode when another user has it attached in read-only mode. When you attach a workspace with read-only access, Oracle OLAP executes a program called PERMIT_READ, when it finds one in the workspace.

RW

Specifies that the workspace is attached in read/write access mode. Only one user can have an analytic workspace open in read/write at a time. The user has to commit either all or none of the changes made to the workspace.

A workspace that is attached read/write non-exclusive can be accessed simultaneously by several sessions. The read/write non-exclusive attach mode is only compatible with the read-only access mode. A user can attach an analytic workspace in read/write mode when other users have the workspace attached in read-only mode; however, a user cannot attach an analytic workspace in read/write mode when another user has it attached in any other mode. Likewise, a user cannot attach an analytic workspace in any mode other than read-only when another user has it attached in read/write non-exclusive mode. When you attach a workspace with read/write access, Oracle OLAP executes a program called PERMIT_WRITE, when it finds one in the workspace.

RWX

Specifies that the workspace is attached in read/write exclusive access mode. Only one user can have an analytic workspace open in read/write exclusive at a time. The user has to commit either all or none of the changes made to the workspace.

A workspace that is attached read/write exclusive cannot be accessed by any other sessions.  The read/write exclusive attach mode is not compatible with any other access modes. A user cannot attach an analytic workspace in read/write exclusive mode when another user has it attached in any mode. Likewise, a user cannot attach an analytic workspace in any other mode when another user has it attached in read/write exclusive mode. When you attach a workspace with read/write access, Oracle OLAP executes a program called PERMIT_WRITE, when it finds one in the workspace.

MULTI

Specifies that the workspace is attached in multiwriter access mode. A workspace that is attached in multiwriter mode can be accessed simultaneously by several sessions. In multiwriter mode, users can simultaneously modify the same analytic workspace in a controlled manner by specifying specify the attachment mode (read-only or read/write) for individual variables, relations, valuesets, and dimensions.


See:

Table A-23, "Statements for Managing Objects When Attached in Multiwriter Mode" for a list of the OLAP DML statements that you use to manipulate objects in an analytic workspace that is attached in multiwriter mode.

The multiwriter attach mode is only compatible with read-only and multiwriter modes. A user cannot attach an analytic workspace in multiwriter mode when another user has it attached in read/write or exclusive modes. Likewise, a user cannot attach an analytic workspace in read/write or exclusive mode when another user has it attached in multiwriter mode.

WAIT
NOWAIT

Specifies whether Oracle OLAP waits for a workspace to become available for access when you request access to a workspace that is being used with read/write exclusive access or when you request read/write access to a workspace that is already being used with read/write non-exclusive access. NOWAIT (the default) causes Oracle OLAP to produce an error message indicating that the workspace is unavailable. When you specify WAIT, Oracle OLAP will wait for the workspace to become available for access. The number of seconds that Oracle OLAP will wait for access depends on the value of the Oracle OLAP AWWAITTIME option.

FIRST

(Default) Makes the workspace you are attaching the current workspace in the workspace list.

LAST

Puts the workspace after the current workspace in the workspace list and before the EXPRESS workspace. When there are other workspaces attached before the EXPRESS workspace, the specified workspace is attached after them. When there are no workspaces before the EXPRESS workspace, LAST makes the specified workspace the current one. LAST ignores any workspaces after the EXPRESS workspace.

AFTER workspace
BEFORE workspace

Let you specify the position in the workspace list of the newly attached workspace relative to a workspace that is already attached. Use AFTER, rather than LAST, to attach a workspace after the EXPRESS workspace. When specifying BEFORE puts the workspace first, the workspace becomes the current one.

The order of the workspace list determines the order in which workspaces will be searched when Oracle OLAP looks for programs or objects named in programs.

PASSWORD password

Specifies a password to be checked in a startup program in order to give or deny access to the workspace being attached. See "Startup Programs".

Notes

Programs Executed When Attaching Analytic Workspaces

When you attach a workspace, Oracle OLAP looks for and executes the following programs in the order indicated:

  1. Permission programs. Programs that Oracle OLAP looks for and executes varies depending on the attachment mode specified in the AW ATTACH statement:

    • When you request that an analytic workspace be attached in read-only mode, Oracle OLAP checks for a program named PERMIT_READ.

    • When you request that an analytic workspace be attached in multiwriter or read/write mode, Oracle OLAP checks for a program named PERMIT_WRITE.

  2. Onattach program. A program that Oracle OLAP looks for and executes when you attach an analytic workspace using an AW ATTACH statement in either of the following situations:

    • When you attach an analytic workspace that contains a program named ONATTACH and you do not include the NOONATTACH keyword in the AW statement or when the AW statement includes an ONATTACH clause that does not specify a program name, Oracle OLAP executes the ONATTACH program.

    • When the AW statement includes an ONATTACH clause that specifies a program name, Oracle OLAP looks in the workspace for a program of that name. When it exists, Oracle OLAP executes that program.

  3. Autogo program. A program that Oracle OLAP looks for and executes when you attach an analytic workspace using an AW ATTACH statement with the AUTOGO clause.

  4. TRIGGER_AW program. A trigger program that you create and that Oracle OLAP checks for by name when an AW command executes.

Using ATTACH on an Already-Attached Workspace

Reattaching an attached workspace with a AW ATTACH workspace statement does not cause Oracle OLAP to bring a new copy of the workspace into working memory. Instead, Oracle OLAP takes the following actions:

  1. Makes the workspace the current workspace.

  2. Runs an Autogo program, when you specify the AUTOGO keyword

However, when you have made any changes to data during the session, they are not discarded when you reattach an active workspace. Furthermore, current aliases for the workspace are not changed.

Conflicts between Workspace Names and Aliases

You cannot attach a workspace that is in your schema and whose name is the same as an assigned alias. Similarly, you cannot assign an alias that duplicates the name of an attached workspace that is in your schema. Furthermore, you cannot assign the same alias to two attached workspaces.

In an AW DELETE statement, when you specify a workspace name (for a workspace that is not attached) and the name is the same as an assigned alias, Oracle OLAP interprets the name as an alias and reports an error.

Examples

Example 8-14 Startup Programs

Assume that you have created an analytic workspace named awtest that contains five programs named PERMIT_READ, PERMIT_WRITE, ONATTACH, MYATTACH, and AUTOGO that have the following definitions.

DEFINE PERMIT_READ PROGRAM BOOLEAN
PROGRAM
SHOW 'permit_read program executing'
AW LIST
RETURN YES
END
 
DEFINE PERMIT_WRITE PROGRAM BOOLEAN
PROGRAM
SHOW 'permit_write program executing'
AW LIST
RETURN YES
END
 
DEFINE ONATTACH PROGRAM BOOLEAN
PROGRAM
SHOW 'onattach program executing'
AW LIST
RETURN YES
END
 
DEFINE MYATTACH PROGRAM BOOLEAN
PROGRAM
SHOW 'myattach program executing'
AW LIST
RETURN YES
END
 
DEFINE AUTOGO PROGRAM 
PROGRAM
SHOW 'autogo program executing'
AW LIST
END
 

The programs that execute when you attach awtest vary depending on the attachment mode and keywords in the AW ATTACH statement:

  • When you attach awtest in read/write mode using the following statements.

    AW DETACH awtest
    AW ATTACH awtest RW
    
    

    First the PERMIT_WRITE program executes, and then the ONATTACH program executes.

  • When you attach awtest in read-only mode using the following statements.

    AW DETACH axuserwtest
    AW ATTACH awtest NOONATTACH RO
    
    

    Only the PERMIT_READ program executes.

  • When you attach awtest in read-only mode using the following statements.

    AW DETACH awtest
    AW ATTACH awtest RO
    
    

    First the PERMIT_READ program executes, and then the ONATTACH program executes.

  • When you attach awtest in read-only mode using the following statements.

    AW DETACH awtest
    AW ATTACH awtest ONATTACH myattach RO
    
    

    First the PERMIT_READ program executes, and then the MYATTACH program executes.

  • When you attach awtest in multi mode using the following statements.

    AW DETACH awtest
    AW ATTACH awtest MULTI
    
    

    First the PERMIT_WRITE program executes, and then the ONATTACH program executes.

  • When you attach awtest in read-only mode using the following statements.l

    AW DETACH awtest
    AW ATTACH awtest AUTOGO
    
    

    First the PERMIT_WRITE program executes. Secondly, the ONATTACH program executes. Finally, the AUTOGO program executes.

Example 8-15 Attaching an Analytic Workspace Using an ONATTACH Program

Suppose you have two workspaces of sales data, one for expenses and one for revenue. You have a third workspace called analysis contains programs to analyze the data. Your analysis workspace has the following ONATTACH program to attach the other two.

DEFINE onattach PROGRAM
PROGRAM
AW ATTACH expenses RW AFTER analysis 
AW ATTACH revenues RW AFTER analysis 
END

To run the ONATTACH program, attach the analysis workspace with the following statement.

AW ATTACH analysis 

When you issue an AW LIST statement, you can see from the following output, that all three of your analytic workspaces are attached.

ANALYSIS  R/W CHANGED   XUSER.ANALYSIS
REVENUE   R/W UNCHANGED XUSER.REVENUES
EXPENSES  R/W UNCHANGED XUSER.EXPENSES
EXPRESS   R/O UNCHANGED SYS.EXPRESS

AW CREATE

The AW CREATE command creates a new workspace and make it the current workspace in your session.


Note:

Oracle OLAP automatically executes a COMMIT as part of its procedure for creating a workspace. Previously attached workspaces move down in the list of attached workspaces to make room for the new one at the top of the list. Also, when a program named TRIGGER_AW exists in the analytic workspace, the execution of an AW CREATE statement automatically executes that program.

Syntax

AW CREATE workspace [position] [UNPARTITIONED|PARTITIONS n] -

     [SEGMENTSIZE n [K, M, or G]] [TABLESPACE tblspname]

where position specifies the workspace's position in the workspace list and is one of the following values. (FIRST is the default.)

AFTER workspace
BEFORE workspace
LAST
FIRST

Arguments

workspace

The name of the analytic workspace. Workspace names:

  • Can be from 1 - 26 characters in length. All characters must come from the database character set and must be letters, numerals, or underscores.

  • Cannot begin with a numeral and cannot be reserved words in the DML. (Use RESERVED to identify reserved words.)

FIRST

(Default) Makes the workspace you are attaching the current workspace.

LAST

Puts the workspace after the current workspace and before the EXPRESS workspace. When there are other workspaces attached before the EXPRESS workspace, the specified workspace is attached after them. When there are no workspaces before the EXPRESS workspace, LAST makes the specified workspace the current one. LAST ignores any workspaces after the EXPRESS workspace.

AFTER
BEFORE

Specify the position of the newly attached workspace relative to a workspace that is already attached. Use AFTER, rather than LAST, to attach a workspace after the EXPRESS workspace. When specifying BEFORE puts the workspace first, the workspace becomes the current one.

The order of the workspace list determines the order in which workspaces will be searched when Oracle OLAP looks for programs or objects named in programs.

UNPARTITIONED

Specifies that the relational table that is the analytic workspace is not a partitioned table.

PARTITIONS n

Specifies that the relational table that is the analytic workspace is a hash partitioned table with n partitions. Specifying a value of 0 (zero) for n is the same as specifying UNPARTITIONED. The default value of n is 8.

SEGMENTSIZE n [K, M, or G]

With the CREATE keyword, this argument sets the maximum size of each segment for the workspace being created. When you do not specify K, M, or G, the value you specify for n is interpreted as bytes. When you specify K, M, or G after the value n, the value is interpreted as kilobytes, megabytes, or gigabytes, respectively.

TABLESPACE  tblspname

Specifies the name of an Oracle Database tablespace in which the analytic workspace is created.


Tip:

Oracle suggests that you use the TABLESPACE argument to create your workspace in a tablespace that has been prepared for this purpose. Ask your DBA which tablespace you should use.

Notes

Analytic Workspace Security and Permissions

You can add security to analytic workspaces at several levels:

Examples

Example 8-16 Creating and Starting a Workspace

You can use the AW command with the CREATE keyword to create and start a new workspace.

AW CREATE mywork

AW DELETE

The AW DELETE command deletes the specified workspace from the database. It is important to note that Oracle OLAP automatically executes a COMMIT as part of its procedure for deleting a workspace. The DELETE keyword executes successfully only when no user has the workspace attached.


Note:

When a program named TRIGGER_AW exists in the analytic workspace, the execution of an AW DELETE statement automatically executes that program.


See also:

AW DETACH, AW TRUNCATE

Syntax

AW DELETE workspace

Arguments

workspace

The name of the analytic workspace. You must specify the name; you cannot specify an alias.

Notes

Deleting an Unattached Workspace

When you attempt to delete an unattached workspace and the name is the same as an assigned alias, Oracle OLAP interprets the name as an alias and reports an error.

Examples

Example 8-17 Deleting a Workspace

You can use the AW command with the DELETE keyword to delete a workspace.

AW DELETE mywork

AW DETACH

The AW DETACH command removes a workspace from the workspace list. When you remove the first workspace, the second workspace becomes the current workspace (unless it is the EXPRESS workspace). When you detach a workspace, changes that were made before an UPDATE was issued remain in the database and become permanent with the next COMMIT. When changes were made after the UPDATE was issued, they are discarded.


Note:

When a program named TRIGGER_AW exists in the analytic workspace, the execution of an AW DETACH statement automatically executes that program.

Syntax

AW DETACH workspace

Arguments

workspace

The name of the analytic workspace. You can specify either a workspace name or a workspace alias, depending on the keywords you are using.

Examples

Example 8-18 Detaching a Workspace

You can use the AW command with the DETACH keyword to detach a workspace.

AW DETACH expense 

AW LIST

The AW LIST command sends to the current outfile a list of the active workspaces, along with their update status.

Syntax

AW LIST

Notes

Output Produced by AW LIST

The first workspace in the list is the current workspace, unless you do not have a current workspace. The meaning of the update status, CHANGED or UNCHANGED, depends on whether the workspace is attached with read/write or read-only access and whether or not the workspace is being shared with other users. The update status displayed by AW LIST is as follows:

Current Workspace

The name of the current workspace is first on the workspace list and is the name returned by the AW(NAME) function. (See AW function for details.) The NAME dimension includes only the objects in the current workspace. Programs such as AWDESCRIBE and LISTBY list only objects in the current workspace. When a workspace is active but not current, you can change and update its data, edit and run its programs, and modify its objects.

Examples

Assume that you have just connected to Oracle OLAP using the OLAP Worksheet. You issue an AW LIST statement that returns a value showing that the only attached analytic workspace is EXPRESS.

AW LIST
EXPRESS   R/O UNCHANGED SYS.EXPRESS
 

Now you create a new analytic workspace and issue another AW LIST statement. You can see that both the EXPRESS analytic workspace and the newly created analytic workspace are attached.

AW CREATE myaw
AW LIST
MYAW      R/W UNCHANGED MYNAME.MYAW
EXPRESS   R/O UNCHANGED SYS.EXPRESS
 

AW SEGMENTSIZE

The AW SEGMENTSIZE command sets up a workspace for multiple segments.

Syntax

AW SEGMENTSIZE [K, M, or G] [workspace]

Arguments

workspace

The name of the analytic workspace. You can specify either a workspace name or a workspace alias, depending on the keywords you are using.

SEGMENTSIZE [K, M, or G] [workspace]

Sets the maximum size of each segment for a specified workspace or, when no workspace is specified, for the current workspace.

When the current workspace already has several segments, setting SEGMENTSIZE affects only the most recent one and has no effect on previous ones. Previous segments may have various sizes, determined by the SEGMENTSIZE setting at the time each one was created. When you do not specify K, M, or G, the value you specify for n is interpreted as bytes. When you specify K, M, or G after the value n, the value is interpreted as kilobytes, megabytes, or gigabytes, respectively.


AW TRUNCATE

Deletes all of the objects and data from an existing analytic workspace. Oracle also deallocates all of the table space used by the analytic workspace.Removing data using AW TRUNCATE can be more efficient and less "destructive" than deleting an analytic workspace using AW DELETE. For example, when you remove data using AW TRUNCATE, all of the object privileges that were previously granted remain. For more information on truncating a table, see the TRUNCATE statement in Oracle Database SQL Reference.

Syntax

AW TRUNCATE workspace

Arguments

workspace

The name of the analytic workspace. You must specify the name; you cannot specify an alias.

Examples

Example 8-19 Removing all Data from a Workspace

You can use the AW command with the TRUNCATE keyword to delete all of the objects and data in a workspace.

AW TRUNCATE mywork