Creating Folders

The elements created in Virtual DataPort can be organized in folders. These are: data sources, stored procedures, wrappers, views, Web services and widgets.

Although these elements can be organized in folders, you cannot create two elements with the same name in a database, even if they are located different folders.

To create a folder use the statement CREATE FOLDER.

To manage an existing folder, use ALTER FOLDER.

To delete a folder, use DROP FOLDER.


Syntax of the CREATE FOLDER statement
CREATE [ OR REPLACE ] FOLDER <folder_name:literal>
[ DESCRIPTION <description> ]

folder_name is the full path of the new folder. That means that this parameter has to start with the character /. For example, CREATE FOLDER '/folder1'.

To create a subfolder /folderA/subfolderA, create the folder folderA first and then, the subfolderA:

Creating a subfolder
CREATE FOLDER '/folderA'
CREATE FOLDER '/folderA/subfolderA'

To manage an existing folder and its contents, use the statement ALTER FOLDER. That is, to do the following actions:

  • Change the description of a folder.

  • Rename a folder.

  • Move a folder into another folder.

  • Move or copy an element (data source, view, etc.) to a folder.

Syntax of the statement ALTER FOLDER
ALTER FOLDER <source folder name:literal> <operation>

<operation> ::=
    RENAME <target folder name:literal> [ DESCRIPTION <description:literal> ]
  | DESCRIPTION <description:literal>
  | MOVE <element> <name:identifier>
  | COPY <element> <element old name:identifier> AS <element new name:identifier>

<element> ::=
    DATASOURCE <data source type>
  | WRAPPER <wrapper type>
  | TABLE
  | VIEW
  | PROCEDURE
  | WEBSERVICE
  | WIDGET

<data source type> ::=
    CUSTOM
  | DF
  | ESSBASE
  | JDBC
  | JSON
  | LDAP
  | ODBC
  | OLAP
  | SALESFORCE
  | SAPBWBAPI
  | SAPERP
  | WS
  | XML

<wrapper type> ::=
    <data source type>
  | ITP

To delete a folder, use the statement DROP FOLDER.

Syntax of the statement DROP FOLDER
DROP FOLDER <folder path and name:literal> [ CASCADE ]

If a folder has elements, DROP FOLDER without the CASCADE clause will fail.

If you add the clause CASCADE, the command will delete the folder, its subfolders and its contents.

Examples

  • Changing the description of a folder:

    Changing the description of the folder “/Data sources”
    ALTER FOLDER '/Data sources'
        DESCRIPTION 'This folder will contain data sources';
    
  • Renaming a folder:

    Renaming the folder “data sources” to “JDBC data sources”
    ALTER FOLDER '/data sources'
        RENAME '/JDBC data sources';
    
  • Moving a folder to another folder:

    Moving the folder “JDBC data sources” into “Data sources”
    ALTER FOLDER '/JDBC data sources'
        RENAME '/Data sources/JDBC data sources';
    

    The target folder has to exist.

  • Moving an element to another folder:

    Moving the JDBC data source “ds_jdbc_oracle” to the folder “/Data sources”
    ALTER FOLDER '/Data sources'
       MOVE DATASOURCE JDBC ds_jdbc_oracle;
    
    Moving the view “customer360” to the folder “/Final views”
    ALTER FOLDER '/Final views'
       MOVE VIEW customer360;
    

    The target folder has to exist.

  • Copying an element

    Copying the view “customer360”. The name of the copy is “customer360_final”
    ALTER FOLDER '/Final views'
       COPY VIEW customer360 AS customer360_final;
    
    Copying the DF data source “web_container_access_log”
    ALTER FOLDER '/Data sources'
       COPY DATASOURCE DF web_container_access_log AS ds_df_web_access_log;
    
  • Dropping a folder and its elements:

    DROP FOLDER '/Data sources' CASCADE;