Create new resource in XDB using PL/SQL problem

Hi Forum,
I'm struggling with the problem of creating folders and resources automatically using PL/SQL. I'm working with Oracle 9.2
What I'd like to achieve is a proc like so:
create_folder(path in varchar2)
This proc should create the folder for me. Problem is:
1. If a subfolder is not existing, dbms_xdb.create_folder throws an error.
2. If a folder is existing, the same happens.
So my approach is:
split the path '/a/b/c/d/test.xml' into chunks like:
/a
/a/b
/a/b/c
/a/b/c/d
Now, check for each entry, whether folder exists. If not, create folder.
The way I implemented this is by a pipelined PL/SQL function split_path:
create type path_table as table of varchar2;
create or replace function split_path (path in varchar2)
return path_table pipelined
is
i number := 1;
begin
while instr(path, '/', 2, i) > 0 loop
pipe row (substr(path, 1, instr(path, '/', 2, i) - 1));
i := i + 1;
end loop;
return;
end split_path;
This function pumps out any sub-path.
Now, I create a create_folder function like so:
procedure create_folder (path in varchar2)
is
i number := 1;
-- cursor for all non-existing pathes (via pipelined function split_path)
cursor path_cur is
select column_value
from table(mds_tools.split_path(path))
where column_value not in (select any_path from resource_view);
begin
-- Create all non-existing folders
for entry in path_cur loop
result := dbms_xdb.createFolder(entry.column_value);
end loop;
-- exception handling goes here
end create_folder;
So, this way, I'm checking any sub folder against the existing cursors and try to create a folder if it's not existing.
Nice try, so far, but: It doesn't work.
Oracle gives me an "End of communication" error, when trying to run this.
It seems to bomb out as soon as the second pipe is pumped out of the function and I don't understand, why.
If this should be the wrong approach, how could I improve this?
Thanks for any help,
Jürgen

Sorry, two little mistakes:
Procedure create_folder shoule read like this:
create or replace procedure create_folder (path in varchar2)
is
i number := 1;
result boolean;
-- cursor for all non-existing pathes (via pipelined function split_path)
cursor path_cur is
select column_value
from table(split_path(path))
where column_value not in (select any_path from resource_view);
begin
-- Create all non-existing folders
for entry in path_cur loop
result := dbms_xdb.createFolder(entry.column_value);
end loop;
-- exception handling goes here
end create_folder;

Similar Messages

  • How can I create an csv/excel file using pl/sql and then sending that file

    How can I create an csv/excel file using pl/sql and then sending that file to a clients site using pl/sql?
    I know how to create the csv/excel file but I can't figure out how I would get it to the clients site.

    968776 wrote:
    How can I create an csv/excel file using pl/sql and then sending that file to a clients site using pl/sql?
    I know how to create the csv/excel file but I can't figure out how I would get it to the clients site.You are trying to do it at a wrong place..
    Whay do you want database (pl/sql) code to do these things?
    Anyhow, you may be interested in :
    {message:id=9360007}
    {message:id=9984244}

  • Instead of creating new resource, recon is updating the same resource object for a user

    Hi,
    I created a DB target recon in OIM 11g. I ran recon and it created resource object. Resource is visible in Accounts tab.Now, I added one more entry with different description in DB. I ran the recon again. This time, instead of creating new resource object, recon linked it the same user with same resource object.
    My requirement is to create as many resource object as there are entries in DB table. The recon should not link all DB entries with same resource object in IDM. For every entry in DB, recon should create that many resource objects in accounts tab of user.
    Please let me know how to achieve the same.
    Regards,
    Kalpana.

    Hint is : Verify Reconciliation Key field mapping in Process definition
    Thanks,
    Pallavi

  • BUG:  Advanced Actions duplicated when creating NEW PROJECTS FROM TEMPLATE using Adobe Captivate 8.

    Need:  CREATE NEW PROJECTS FROM TEMPLATE using Adobe Captivate 8. 
    Problem:  NEW PROJECT (.cptx) duplicates the Advanced Actions originally configured within TEMPLATE FILE (.cpt.).
    For example: Template file (.cptl) advanced action "_initializeModule" gets duplicated as "_initializeModule1", "_initializeModule2", "_initializeModule3" within NEW PROJECT.  FYI, the original "_initializeModule" advanced action still appears.
    MAJOR BUG, what the heck is going on?!?!!!  Planning to deploy this template file to use for multiple courses with multiple users, this WILL cause epic confusion across the board.

    Similar problem, think they are working on it as well: when dragging a shared action from an external library to a slide or object event, and that action is using a parameter that was already created for another shared action, there will be a new parameter created which really screws up the shared action contrary to this problem. Tip: for the moment do not drag shared actions from an external library immediately to an event, but drag them first to the Library: Reuse Shared Actions in other Projects - Captivate 7 vs. 8 - Captivate blog

  • Problem when creating new resource in CMSXDB

    We installed the CMSXDB sample succesfully.
    We can create new users, create new folders; but when adding a documnt (resource) to a folder we get following error.
    For an external document:
    oracle.otnsamples.cmsxdb.exception.CMSAccessException: IOException in FileUploadUitlsjava.io.IOException: java.sql.SQLException: Invalid argument(s) in call
         at oracle.otnsamples.cmsxdb.useraction.FileUploadUtils.(FileUploadUtils.java:89)
         at oracle.otnsamples.cmsxdb.useraction.DataUtils.resource(DataUtils.java:885)
         at NewResource.jspService(_NewResource.java:73)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
    If we try the other option (creation on the fly); we get following error:
    oracle.otnsamples.cmsxdb.exception.CMSAccessException: SQLException in createresource in resource method of DataUtils : java.sql.SQLException: SQLException in getCLOB : java.sql.SQLException: Invalid argument(s) in call
         at oracle.otnsamples.cmsxdb.useraction.DataUtils.resource(DataUtils.java:1109)
         at NewResource.jspService(_NewResource.java:73)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379) ...
    Do you have any idea what can be the cause for this error?

    Hi Mark,
    The details of the properties that you have to set in Connection.properties file
    List of properties to be altered (Mandatory)
    DBWebURL=http://incq234a.idc.oracle.com:8080
    The HTTP url where the xdb servlet engine is running
    Format : http://<hostname_where_db_is_installed>:8080
    siteRootPath=/tmp/testsite
    The absolute path under which the files will be generated, once a file is sent for externalization and approved by cmsadmin.
    The file will be generated under ConnParams.siteRoot/<resource_path>.<content_type>
    example: /tmp/testsite/cmshome/news/headlines.html
    List of properties to be altered( Optional )
    [ we recommend that the default values be used and these properties not be altered ]
    DataSourceName=jdbc/CmsdbDS
    Name of the datasource, that was entered in J2EE_HOME/config/data-sources.xml
    DBUsername=cmsadmin
    DBPassword=cmsadmin
    [ if any of the below properties are modified, then the corresponding changes have to done in xdbconfig.xml ]
    CMSServletContextRoot=/OTNCMSServlet
    The context root where the OTNCMSServlet can be accessed. It will be appended with the DBWebURL.i.e
    http://localhost:8080/OTNCMSServlet
    Once the servlet is deployed to XDB and the xdbconfig.xml file updated with the servlet entry. The Servlet can be accessed from the above URL
    TransServletContextRoot =/transformservlet
    The context root where the TransformServlet can be accessed. It will be appended with the DBWebURL.i.e
    http://localhost:8080/transformservlet
    SearchServletContextRoot =/searchservlet
    The context root where the SearchServlet can be accessed. It will be appended with the DBWebURL.i.e
    http://localhost:8080/searchservlet
    We are looking into the resource creation issue, pls update us on wheather you are using the right values for these properties. If you were using any incorrect property values, update it and try deploying and running the app again.
    Regards
    Elango.

  • Create new tab in header using badi ME_GUI_PO_CUST for tcode ME21N

    Dear all,
    i have implemented method SUBSCRIBE in ME_GUI_PO_CUST to create new tab in ME21N,
    but the tab is not coming
    following is the code snips, please tell where is the error, or some setting needs to be done
    method IF_EX_ME_GUI_PO_CUST~SUBSCRIBE.
    DATA: ls_subscriber LIKE LINE OF re_subscribers.
    if sy-tcode eq ' ME21N' OR SY-TCODE EQ 'ME22N' OR SY-TCODE EQ 'ME23N'.
      CHECK im_application = 'PO'.
      CHECK im_element     = 'HEADER'.
    CLEAR re_subscribers[].
      ls_subscriber-name = 'Customer-Data'.
      ls_subscriber-dynpro = '0101'.
      ls_subscriber-program = 'SAPLMEGUI'.
      ls_subscriber-struct_name = 'MEPO_SUBSCRIBERS'.
      ls_subscriber-label = 'Customer Data'.
      ls_subscriber-position = 10.
      ls_subscriber-height = 7.
      APPEND ls_subscriber TO re_subscribers.
    ENDIF.
    endmethod.
    Regards
    Sumodh

    Hi...I hv similar requirement.
    I need to show a custom field in the screen for the items.
    I tried using the methods "SUBSCRIBE" and "MAP_DYNPRO_FIELDS" as explained in the sample code.
    Below is my code. I have copied the sample code and changed it lil.
    Method "SUBSCRIBE":
      DATA: ls_subscriber LIKE LINE OF re_subscribers.
    we want to add a customer subscreen on the item detail tab
      CHECK im_application = 'PO'.
      CHECK im_element     = 'ITEM'.
    each line in re_subscribers generates a subscreen. We add one subscreen in this example
      CLEAR re_subscribers[].
    the name is a unique identifier for the subscreen and defined in this class definition
      ls_subscriber-name = subscreen1.
    the dynpro number to use
      ls_subscriber-dynpro = '9000'.
    the program where the dynpro can be found
      ls_subscriber-program = 'SAPLZMMPO1'.
    each subscreen needs his own DDIC-Structure
      ls_subscriber-struct_name = 'ZMM_PO_CUST_SCREEN'.
    a label can be defined
      ls_subscriber-label = text-t01.
    the position within the tabstrib can be defined
      ls_subscriber-position = 13.
    the height of the screen can be defined here. Currently we suport two screen sizes:
    value <= 7 a sevel line subscreen
    value > 7  a 16 line subscreen
      ls_subscriber-height = 7.
      APPEND ls_subscriber TO re_subscribers.
    method "MAP_DYNPRO_FIELDS":
      FIELD-SYMBOLS: <mapping> LIKE LINE OF ch_mapping.
    *- customer fields
      CONSTANTS: mmmfd_cust_01 TYPE mmpur_metafield VALUE 90000000.
      LOOP AT ch_mapping ASSIGNING <mapping>.
        CASE <mapping>-fieldname.
          WHEN 'CLMNO'. <mapping>-metafield = mmmfd_cust_01.
        ENDCASE.
      ENDLOOP.
    I created a function group - "ZMMPO1" and created the subscreen 9000 in that. I placed the custom field in that screen. Tha main program of ZMMPO1 is "SAPLZMMPO1".
    I created a structure also - "ZMM_PO_CUST_SCREEN".
    I want to know whether this is sufficient to display the tab on the screen or am I missing something.
    It is mentioned that the implementation of "ME_PROCESS_PO_CUST" is a pre-requisite.
    could you lemme know the process please.
    Thanks,
    Ram.

  • How I can create dynamically-formed requests or use native SQL in EJB?

    Hi all.
    I'm working around modify an example from NetWeaver Developer Studio (CarRental). I want to get ordered data from table and allow users to specify the ordering field, not in the code. EJB QL doesn't support dynamically-formed queries like "select object(b) from QuickBooking b where b.status like ?1 order by b.<b>?2</b>" so i can't passing field name as parameter into query. Creating a sorting method for every field is not good solution because I need a dynamically-formed requests.
    I think using native SQL will help but I don't know how I can use SQL in EJB.
    Thanks,
    Lev

    import javax.persistence.EntityManager;within class, place
    protected EntityManager  entityManager;of course make it public, private, whatever you need.
    Then, in your method
    entityManager.createNativeQuery(....);R. Grimes

  • I can no longer create new folders in Windows 7; could this problem be a result of recently reinstalling Firefox?

    I'm using Windows 7 Home premium on an HP Pavilion laptop. Maybe two weeks ago, I stopped being able to create new folders in the Windows Explorer box; I click the "New Folder" button, and nothing happens: no error message, nothing. Around two weeks ago, I also reinstalled Firefox to get rid of some adware virus (success: the adware is gone!). I do not recall the exact timing on when I did the reinstall and when I stopped being able to create new folders, but I'm wondering if the folder problem could be related to the re-install. And if so, what can I do about it?
    Thanks so much for any help you can offer.

    Hello FJasmine, no, it is not related the firefox update with that.
    see : [http://answers.microsoft.com/en-us/windows/forum/windows_7-files/cant-create-anymore-new-folders-in-windows-7/721a9129-c800-4224-8779-805dd6dfb80e Can't create anymore New Folders in Windows 7]
    [http://social.technet.microsoft.com/Forums/en-US/w7itprogeneral/thread/97de8a2a-12f2-4381-a409-a78f4ae551cf/ Cannot create new folder in Windows 7]
    thank you

  • Problem in Creating new row & inserting data using CreateInsert and Commit

    Hello All,
    I have created a page there are few input text and i want to insert the data into a database table. I have created an Application Module I am using CreateInsert and Commit operation but there is one problem.
    At first it created a row in database after that it is not creating the new row instead it is updating the same row with the new values.
    In bindings of my jspx page I have created two binding for action (1) CreateInsert for the VO of that Application Module (2) Commit operation of that Application Module.
    Here is the code snippet of my application:
    BindingContainer bindings = getBindings();
    OperationBinding operationBinding = bindings.getOperationBinding("CreateInsert");
    Object result = operationBinding.execute();
    *if (!operationBinding.getErrors().isEmpty()) {*
    return null;
    OperationBinding operationBinding1 = bindings.getOperationBinding("Commit");
    Object result1 = operationBinding1.execute();
    *if (!operationBinding1.getErrors().isEmpty()) {*
    return null;
    I have tried using Execute+Commit and Insert+Commit case also in every case it is updating the same row and not inserting a new row.
    Is there anything I am missing?
    Please Help.

    hi user,
    i dono. why are trying with codes. adf provides zero lines codes.
    a wonderful drag and drop functionality provide by the framework.
    while double click the button the codes are  registered in your bean
        public String cb6_action() {
            BindingContainer bindings = getBindings();
            OperationBinding operationBinding = bindings.getOperationBinding("CreateInsert");
            Object result = operationBinding.execute();
            if (!operationBinding.getErrors().isEmpty()) {
                return null;
            return null;
        public String cb8_action() {
            BindingContainer bindings = getBindings();
            OperationBinding operationBinding = bindings.getOperationBinding("Commit");
            Object result = operationBinding.execute();
            if (!operationBinding.getErrors().isEmpty()) {
                return null;
            return null;
        public String cb7_action() {
            BindingContainer bindings = getBindings();
            OperationBinding operationBinding = bindings.getOperationBinding("Delete");
            Object result = operationBinding.execute();
            if (!operationBinding.getErrors().isEmpty()) {
                return null;
            return null;
        public String cb14_action() {
            BindingContainer bindings = getBindings();
            OperationBinding operationBinding =
                bindings.getOperationBinding("Delete4");   // some different here. after deleting usually do commit
            OperationBinding operationBinding1 =  
                bindings.getOperationBinding("Commit");    // so here commit operation.
            Object result = operationBinding.execute();
            Object result1 = operationBinding1.execute();
            if (!operationBinding.getErrors().isEmpty()) {
                return null;
            if (!operationBinding1.getErrors().isEmpty()) {
                //add error handling here
                return null;
            return null;
        }if am not understud correctly. please some more explanation need.

  • How to create new tab in Me21N using enhancement MM06E005

    Hi All,
    Can u guys please tell me know to create a new tab at item level in purhcase order ME21N using enhancement MM06E005.
    Thanks in advance.
    Thanks,
    Jaffer Ali.S

    Please search the forum:
    addition of new tab (reasons) on me21n (item level)
    Re: Adding a new Tab - ME22n - Item Detail Level

  • Create new object in Designer using CDAPI

    Hi,
    I need to create more database objects in every of my applications (issued of a migration). I try to used the CDAPI, CIO_....ins
    , but an error occurs , ORA-06512: at "ORACASE.JR_SECONDARY_OBJECT", line 76.
    I don't find sample of insert, I have already used the same API for update, with success.
    So If someone have a sample for inserting...
    Thanks.
    Laurent

    Code for create a new user based on an existing ...
    declare
    id number := 9918494455341698066818125528522996;
    pl ciodatabase_user.data;
    rm_indicators ciodatabase_user.rm_indicators;
    begin
    rm_indicators.Id := True;
    rm_indicators.Name := True;
    rm_indicators.irid := True;
    rm_indicators.ivid := True;
    rm_indicators.changed_by := True;
    rm_indicators.created_by := True;
    rm_indicators.initial_password := True;
    ciodatabase_user.sel(id,pl);
    pl.v.Id := NULL;
    pl.v.irid := NULL;
    pl.v.ivid := NULL;
    pl.v.changed_by:= 'Donald Duck';
    pl.v.created_by:= USER;
    pl.v.initial_password:= 'TINTIN';
    pl.v.Name := 'BOB';
    dbms_output.put_line('pl.parent_ivid'||pl.v.parent_ivid);
    ciodatabase_user.ins(null,pl);
    end;

  • Create new partition VS. Use Toshiba recovery disk

    Hi
    I've bought a new Toshiba Satellite S50-A-00G. I want to create a new partition (D for my personal documents.
    Could I create a new partition (with Windows 8 built-in utilities) and use Toshiba restore disk for reformat ONLY the system partition (C?
    Thanks

    Hi skid! I'm not sure what your'e wanting to do. I can tell you what I do. I also have a 1TB external drive. I have a program called Macrium Reflect. It is a great program and there is a free version. Once a month I create a image of my drive. It will create a image of all three of my partitions. If I have some major problems. I restore that image and I'm back just like the day I created the image. I never use the Toshiba recovery media, because I don't want to start over from day one.
    I'm sure you will get better replies during the week.
    Dokie!!
    I Love my Satellite L775D-S7222 Laptop. Some days you're the windshield, Some days you're the bug. The Computer world is crazy. If you have answers to computer problems, pass them forward.

  • How to create/delete files from filesystem using PL/SQL ? UTL_FILE?

    Greetings,
    I will start by explaining what i intend to do.
    I have an application made in APEX. This application will have among other purposes the managment of pdf files which will reside in the filesystem.
    I have questioned the person in charge to keep the pdf files in the database and not in the filesystem but without success.
    So the pdf files reside in the filesystem and there is a record in a database table about them. A table keeps all info about the pdf, their location , size and name, creation date etc.
    The APEX application will have a mecanism to allow the deletion of the pdf files if an administrator decides.
    So it should be possible for an administrator to schedule the deletion of all pdf files whoe creation date is older than 2008 for example
    So, how can i achieve that?
    After some research i foudn about the UTL_FILE package which seems to have it takes to perform the task in issue.
    My idea was to have a script in the operating system which runs nightly and reads a file containing all file names of the pdf to be erased.
    The file which contains the names of the pdfs to be erased will be generated by the database a few minutes before.
    If there are no pds files to be erased than the file containing the names will simply be empty
    Are there any other viable solutions out there?
    And as for opening/creating the file withn the pdf names, i use:
    UTL_FILE.FOPEN (
    location IN VARCHAR2,
    filename IN VARCHAR2,
    open_mode IN VARCHAR2,
    max_linesize IN BINARY_INTEGER)
    RETURN file_type;
    And as for writing lines (a pdf name per line ), i use;
    UTL_FILE.PUT_LINE (
    file IN FILE_TYPE,
    buffer IN VARCHAR2,
    autoflush IN BOOLEAN DEFAULT FALSE);
    is there a better solution?
    thanks all.
    -> My Homepage <-
    Edited by: Igor Carrasco on Apr 14, 2009 3:11 PM
    Edited by: Igor Carrasco on Apr 14, 2009 3:12 PM

    Greetings,
    I have read that link above, some questions still though.
    I will provide some more information.
    -First the database is in a windows server.
    The windows server has a virtual drive mounted as z:\ <-- this points to a directory in virtual machine, i can manually access/create/delete files manually,i tested.
    -Second utl_file_dir is defined as * , in t that enough to cover mounted drives? ( i can't change the init.ora and reboot the db right now :( gotta wait.. )
    Do i explicitly have to define utfl_file_dir = z: ?
    -Third haven't had the chance to test it on linux or any other operating system, assuming a virtual unit is mounted successfully and that the issues above are solved i should be able to operate on any mounted drive whatever the os, right?
    Best regards

  • Why does my hotmail account will no longer allow me to reply, foreward or create new email when in use with the firefox browser but allow me to do those things when using IE?

    5-6 days ago my hotmail account began to say words to the effect that it could not perform the above described actions. I sent a few inquiries but have received no response. I opened a gmail with which seems to work just fine except for one aspect which I will mention later. When I opened IE(without add-ons) and accessed hotmail the above mentioned actions seem to work just fine. I have used firefox as my browser for about 6-7 years with no problems. The computer i use is still the same and i have made no changes other than to install MS updates which occur automatically. I'm puzzled. Can you assiist?
    The issue I'm having with gmail is that I cannot figure out how to force a log-in asking for username and password and how to force an explicit logout.
    Any assistance will be greatly appreciated.
    Phil Bayles

        I'm sorry you have not been able to utilize your text messaging AlaynaFHirsch. I recommend downloading the new software to your phone. It will definitely help with functionality issues. Are you using a 3rd party messaging application? Have you tried to perform a restore on your account?
    KinquanaH_VZW
    Follow us on Twitter @vzwsupport

  • Problem in creating new label in flashbuilder using script

    import  
      mx.controls.*;
    public function init():void{ 
    var Mylabel:Label=new Label; 
    Mylabel.move(10,10);
    Mylabel.text=
    "Welcome"; 
    when i use this code it shows Overrides Object.init issue wats wrong in this?can any one provide me right way?

    I pasted your code into an <fx:Script> block of a new Flex Project in Flash Builder 4 and didn't get any compilation error. If you're getting a compilation error, please post the complete code and the exact wording of the error.
    Gordon Smith
    Adobe Flex SDK Team

Maybe you are looking for