Create directory issue in Store Procedure

Hi Guys,
can any one help?
I am using XP, Oracle 10g, sql developer and Sql Plus.
I am trying to create directory in storeprocedure, but it not let me to do that thing. below is the statement i am using
create or replace directory public_access as '/tmp/public_access';
please let me know hoe can i initialize my dir object in store procedure.
Thanks

user13012136 wrote:
Hi Guys,
can any one help?
I am using XP, Oracle 10g, sql developer and Sql Plus.
I am trying to create directory in storeprocedure, but it not let me to do that thing. below is the statement i am using
create or replace directory public_access as '/tmp/public_access';
please let me know hoe can i initialize my dir object in store procedure.
ThanksTypically best NOT to do something like this in a procedure, but there are cases where it's needed.
In those cases, you need to use Native Dynamic SQL.
execute immediate 'create or replace directory public_access as ''/tmp/public_access''';  Assuming your syntax was correct before (i just copied and pasted what you had, adding quotes where needed).

Similar Messages

  • IOS4 and create directory issues

    Hi everyone,
    I just upgraded the iOS to version 4.
    Using the new 3.2.3 xcode.
    Existing application could create a new directory at...
    /var/mobile/Media/DCIM/xxx
    now the new OS will not allow files to be created there.
    Did the virtual location change for the camera pictures?
    Or has apple closed the exploit?
    thanks
    tony

    Apple killed the option of writing to any place other than the sandbox.
    dead horse.

  • HOW TO EXECUTE A STORE PROCEDURE THAT RETURN MULTIPLE ROWS FROM A QUERY

    I NEED TO CREATE AND USE A STORE PROCEDURE THAT IS GOING TO DO A SELECT STATEMENT AN THE RESULT OF THE SELECT STATEMENT IS RETURN IN SOME WAY TO THE REQUESTER.
    THIS CALL IS MADE BY AN EXTERNAL LANGUAGE, NOT PL/SQL OR FORMS APPLICATION. USING FOR EXAMPLE ODBC AND VISUAL BASIC. WHAT I NEED TO DO IS ADD A DATA ACCESS LAYER TO MY APPLICATION AND I ALREADY HAVE IT DONE FOR MS SQL SERVER, BUT I NEED THE SAME FUNCTIONALITY ACCESSING AN ORACLE DATABASE.
    FLOW:
    1. VB CREATE A ODBC CONNECTION TO A ORACLE DATABASE
    2. VB EXECUTE A STORE PROCEDURE
    3. THE STORE PROCEDURE RETURNS TO THE VB APPLICATION THE RESULT OF THE QUERY THAT IS INSIDE OF THE STORE PROCEDURE.(I.E. THE STORE PROCEDURE IS A BASIC SELECT, NOTHING COMPLEX)
    4. VB DISPLAY THE RESULT IN A GRID
    FOR SURE I CAN DO THE SELECT DIRECTLY TO ORACLE, BUT FOR PERFORMANCE REASONS AND SCALABILITY, I'LL LIKE IT TO DO IT USING A STORE PROCUDURES
    IS THIS POSIBLE?, HOW?
    THANKS

    Certainly, it's possible. First, define a stored procedure that includes an OUT parameter which is a REF CURSOR. Then, call the stored procedure via ODBC omitting the OUT parameter from the list of parameters. IT will automatically be returned as a result set. Syntax for both is below...
    CREATE PROCEDURE foo (inParam in varchar2, resultSet OUT REF CURSOR )
    In ODBC:
    {call foo( 'someData' )}
    Justin

  • Problem with Pie chart, Store Procedure and Category Axis

    Hi All,
    I'm having a problem when i try to use a Pie Chart with a store procedure
    when Category Axis - Field value is "none", the chart appears, but the description say Undefined
    but when i put any field from store procedure, the chart doesn't show.
    when I try the same with a normal SQL statement, all data was displayed
    my store procedure only have 2 columns
    n - numeric
    state - text
    The Store Procedure and the SQL, returns the same data in the same order
    Thanks in advance
    Cristian

    Hi guys,
    I need guide on creating a system using store procedure, referring to this thread: JDBC System Connection VS BI JDBC System Connection
    Hope you can help me out.
    Thanks a lot,
    Sarah

  • I want to create stored procedure which will give output rows from "values that are passed as one parameter (comma seperated) to store procedure".

    Hello,
    I want to create stored procedure which will give output rows from "values that are passed as one parameter (comma seperated) to store procedure".
    Suppose , 
    Parameter value : person 1,person2,person3 
    table structure : 
    Project Name | officers 1 | officers 2
    here, officers 1 or officers 2 may contain names of multiple people.
    expected OUTPUT : distinct list(rows) of projects where person 1 or person 2 or person 3 is either officer1 or officer 2. 
    please explain or provide solution in detail 
    - Thanks

    Hi Visakh,
    Thanks for reply.
    But the solution you provided giving me right output only if officer 1 or officer 2 contains single value , not with comma seperated value.
    Your solution is working fine for following scenario : 
    Project 
    Officers 1
    Officers 2
    p1
    of11
    off21
    p2
    of12
    off22
    with parameter : of11,off22 : it will give expected output
    And its not working in case of :
    Project 
    Officers 1
    Officers 2
    p1
    of11,of12
    off21,off23
    p2
    of12,of13
    off22,off24
    with parameter : of11,off22 : it will not give any row in output
    I need patten matching not exact match :) 
    ok
    if thats the case use this modified logic
    CREATE PROC GetProjectDetails
    @PersonList varchar(5000)
    AS
    SELECT p.*
    FROM ProjectTable p
    INNER JOIN dbo.ParseValues(@PersonList,',')f
    ON ',' + p.[officers 1] + ',' LIKE '%,' + f.val + ',%'
    OR ',' + p.[officers 2] + ',' LIKE '%,' + f.val + ',%'
    GO
    Keep in mind that what you've done is a wrong design approach
    You should not be storing multiples values like this as comma separated list in a single column. Learn about normalization . This is in violation of 1st Normal Form
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • BODS cannot create store procedure at DB2 at Unix

    Hi,
    I run BODS X3.1 and it can't create, drop store procedures at DB2 at unix. It recommends to authorize the user to do so. However, I have checked DB2 online doc, it mentioned need to set CREATE PROCEDURE authority. However, I can't find any command to do it.
    Does anyone using DB2 that can provide help?
    Thank you.

    I think I got found the bug. It is select from a regular table to load another regular table using Auto correct load method. If only normal loading, no create procedure sql is generated and no warning message.
    For using Auto correct load method:
    (1) first, it got to perform drop procedure as:
    DROP PROCEDURE "BODSOWN".di1125368_1FOOTE; .
    Note:
    (a) I run this command at db2 and it contain syntax error, saying:
    SQL0104N  An unexpected token ";" was found following "WN".di1125368_1FOOTE".
    (b) which mean the semicolon ; is not needed. If I delete this ; away, it can go through but still will complain the stored procedure "BODSOWN.di1125368_1FOOTE" doesn't exist. But that is another issue which is expected.
    (2) secondly, It will generate a CREATE PROCEDURE as such:
    CREATE PROCEDURE
    "BODSOWN".di1125368_1FOOTE ( IN before_c1  VARCHAR (100)  , IN after_c1  VARCHAR (1) , IN after_c2  VARCHAR (40) , IN after_c3
    INTEGER , IN after_c4  VARCHAR (100)  )
    LANGUAGE SQL
    BEGIN
    DECLARE local_var INT DEFAULT 0;
    SELECT COUNT(*) INTO local_var
    FROM "BODSOWN"."FOOTER_RECORD"
    WHERE "DI_FILENAME" = before_c1 ;
    IF local_var = 0 THEN
    INSERT INTO "BODSOWN"."FOOTER_RECORD" ("RECORD_TYPE", "SRCSYS_OR_COUNTER", "ROW_COUNTER", "DI_FILENAME")
    VALUES (after_c1, after_c2, after_c3, after_c4 );
    ELSE
    UPDATE "BODSOWN"."FOOTER_RECORD"
    SET "RECORD_TYPE" = after_c1 ,
    "SRCSYS_OR_COUNTER" = after_c2 ,
    "ROW_COUNTER" = after_c3 ,
    WHERE "DI_FILENAME" = before_c1 ;
    END IF;
    END
    Note:
    (a) this create procedure contains syntax error, the line "ROW_COUNTER" = after_c3 , a comma shouldn't be inserted which afterward is the WHERE clause. Meaning is should be "ROW_COUNTER" = after_c3  without comma.
    (b) if i run this create procedure at db2 without the comma error, it will be successful, if not if will give error saying:
    SQL0104N  An unexpected token ""DI_FILENAME"" was found following "" =
    after_c3 , WHERE".

  • Error message when issuing a COMMIT in a store procedure

    Hello experts,
    Please help.
    I have a problem where i cannot specify a COMMIT in a store
    procedure. I have the following error message:
    =================================================================
    00034, 00000, "cannot %s in current PL/SQL session"
    // *Cause:  An attempt was made to issue a commit or rollback
    from a PL/SQL
    // object (procedure, function, package) in a session
    which has this
    // disabled (by 'alter session disable commit in
    procedure')
    // *Action: enable commits from PL/SQL in this session, or don't
    attempt
    // to use commit or rollback in PL/SQL when they are
    disabled
    // in the current session.
    =================================================================
    Thanks very much for a reply
    Kind regards
    Yogeeraj

    The solution is to issue the statement
    alter session enable commit in procedure;
    However, I'd think carefully about doing this. Procedures are
    often called as part of a wider transaction. If the procedure
    issues a commit ALL the preceding work is also commited. If
    there is something subsequent in the transaction that fails and
    issues a rollback, it will onlt rollback the work done after the
    procedure. This may lead to your database being in an
    inconsistent state.
    rgds, APC

  • How to create a schema and assign roles with store procedure or function?

    Hi All,
    I am creating a webpage that will call oracle store procedure or function to create a schema and add roles. Please let me know if there a method to do that.
    Thank you

    Hi CristiBoboc,
    Thank you very much for your help. Here is my code to create a user:
    create or replace
    FUNCTION user_create (user_name IN nvarchar2, user_pw IN nvarchar2)
    RETURN number
    IS
    sql_stmt varchar2(200);
    sql_stmt2 varchar2(200);
    var_temp_count NUMBER(2);
    un varchar2(30) := user_name;
    up varchar2(30) := user_pw;
    BEGIN
    sql_stmt := 'create user :1 identified by :2
    default tablespace users
    temporary tablespace temp
    quota 5m on users';
    sql_stmt2 := 'grant developers to :1';
    EXECUTE IMMEDIATE sql_stmt USING un,up;
    EXECUTE IMMEDIATE sql_stmt2 USING un;
    select count(*) into var_temp_count from dba_users where username = UPPER(user_name);
    return var_temp_count;
    END;
    When I run, I get following error:
    exec :myvar :=user_create('aaa','12345');
    BEGIN :myvar :=user_create('aaa','12345'); END;
    ERROR at line 1:
    ORA-01935: missing user or role name
    ORA-06512: at "CSDBA.USER_CREATE", line 15
    ORA-06512: at line 1

  • Help On create Store Procedure

    I need to Create a Store Procedure under a different from the once I am connected.
    Thanks

    If you have the DB rights to do it, use
    create procedure owner.proc_name as ...

  • Create Directory in Procedure

    Hi Guys,
    Any one please help i am getting an error during creating directory in procedure. Below is the code and error
    I am using windows XP, oracle 10g, sql developer and sql plus.
    code: -
    create or replace
    procedure checking as
    filing UTL_File.File_Type;
    create or replace directory dir as 'c:\temp';
    begin
    filing := UTL_File.Fopen(dir,'check.txt','w');
    UTL_File.put_line(filing, 'Test');
    UTL_File.FClose(filing);
    End;
    error
    Error(5,1): PLS-00103: Encountered the symbol "CREATE" when expecting one of the following: begin function package pragma procedure subtype type use <an identifier> <a double-quoted delimited-identifier> form current cursor
    Thanks

    SQL> create or replace procedure myproc1
      2  as
      3  begin
      4  execute immediate 'create or replace directory MYDIR as ' || '''' || '/oracle/arch' || '''';
      5  end;
      6  /
    Warning: Procedure created with compilation errors.
    SQL> show error
    Errors for PROCEDURE MYPROC1:
    LINE/COL ERROR
    4/1      PLS-00103: Encountered the symbol "CREATE" when expecting one of
             the following:
             begin case declare exit for goto if loop mod null pragma
             raise return select update while with <an identifier>
             <a double-quoted delimited-identifier> <a bind variable> <<
             close current delete fetch lock insert open rollback
             savepoint set sql execute commit forall merge
             <a single-quoted SQL string> pipe
    SQL> create or replace procedure myproc1
      2  as
      3  begin
      4  execute immediate 'create or replace directory MYDIR as ' || '''' || '/oracle/arch' || '''';
      5  end;
      6  /
    Procedure created.
    SQL> exec myproc1;
    PL/SQL procedure successfully completed.
    SQL>

  • Create Store Procedure to Count Number of records in Database for each table

    Hello,
    I have created the code which counts the number of records for each table in database. However, I want create store procedure for this code this code that when ever use execute the Store Procedure can provide the database name to execute it and as a result
    table will display number of records in each table.
    Below you will find the code its working:
    CREATE
    TABLE #TEMPCOUNT
    (TABLENAME
    NVARCHAR(128),
    RECORD_COUNT BIGINT)
    -- Creating a TEMP table
    EXEC
    sp_msforeachtable
    'insert #tempcount select ''?'', count(*) from ? with (nolock)'
    SELECT
    * FROM
    #TEMPCOUNT
    ORDER
    BY TABLENAME
    DROP
    TABLE #TEMPCOUNT
    This code need to be convert in store procedure and user can give database name when execute the procedure in order to count the records.
    Looking forward for your support.
    Thanks.
    SharePoint_Consultant_EMEA

    Something like:
    set quoted_identifier off
    go
    create procedure usp_TableCounts
    @DBName as varchar(1000)
    as
    set nocount on
    declare @SQLToExecute varchar(1000)
    CREATE TABLE #TEMPCOUNT (TABLENAME NVARCHAR(128), RECORD_COUNT BIGINT) -- Creating a TEMP table
    set @SQLToExecute = @DBName + ".dbo.sp_msforeachtable 'insert into #tempcount select ''?'', count(*) from ? with (nolock)'"
    print @SQLToExecute
    exec (@SQLToExecute)
    SELECT * FROM #TEMPCOUNT
    ORDER BY TABLENAME
    DROP TABLE #TEMPCOUNT
    GO
    Satish Kartan www.sqlfood.com

  • Create oData service using oracle Store procedure

    Hello Experts,
    I need to create oData service from oracle store procedure,
    what are the steps to do it.
    We are using SMP Integration gateway.
    Please Suggest.
    Regards
    Manish

    Hello Experts,
    Here is my code to join 2 tables , in debug it does not give error, but it gives on only one table output not merged output.
    Please suggest.
    function processRequestSQL(message) {
      //Import statements
      importPackage(com.sap.gateway.ip.core.customdev.util);
      importPackage(java.util);
      importPackage(org.apache.olingo.odata2.api.edm);
      importPackage(com.sap.gateway.core.ip.component.commons);
      importPackage(org.apache.olingo.odata2.api.uri);
      importPackage(com.sap.gateway.ip.core.customdev.logging);
      //Get the SQL statement contained in message body
      var sqlStatement = message.getBody();
      var uriInfo = message.getHeaders().get(ODataExchangeHeaderProperty.UriInfo.toString());
      var map = new HashMap();
      map = uriInfo.getCustomQueryOptions();
      //Create the query and sub query
      var JOIN_WO_WHERE = "INNER JOIN ZONE ON AREA.AREA_ID = ZONE.AREA_ID ";
      var WHERE = " WHERE ";
      var JOIN = " INNER JOIN ZONE ON AREA.AREA_ID = ZONE.AREA_ID ";
      //Modify the SQL statement
      var modifiedSqlStatement = "";
      var entitySet = uriInfo.getStartEntitySet();
      var odataMethod = message.getHeaders().get(ODataExchangeHeaderProperty.ODataMethod.toString());
      modifiedSqlStatement += sqlStatement;
      if (odataMethod.toString() == "GET_FEED") {
      entitySetName = entitySet.getName();
      if (entitySetName == "AREA") {
      if (sqlStatement.indexOf("WHERE") != -1
      || sqlStatement.indexOf("where") != -1) {
      modifiedSqlStatement += JOIN_WO_WHERE;
      } else {
      // modifiedSqlStatement += WHERE;
      modifiedSqlStatement += JOIN;
      //Set the message body back with the modified SQL statement
      message.setBody(modifiedSqlStatement);
      //Logger
      log.logErrors(LogMessage.TechnicalError, "This is first log");
      //Set the message body back with the modified SQL statement
      message.setBody(modifiedSqlStatement);
      //Logger
      log.logErrors(LogMessage.TechnicalError, "This is first log");
    -------------------End Sample Implementation---------------------------------------
      return message;

  • How to create store procedure using cursor, and looping condition with exce

    Hi,
    I am new in pl/sql development , please help me for follwoing
    1. I have select query by joining few tables which returns lets say 100 records.
    2. I want to insert records into another table(lets say table name is tbl_sale).
    3. If first record is inserted into tbl_sale,and for next record if value is same as first then update into tbl_sale else
    insert new row
    4. I want to achieve this using store procedure.
    Please help me how to do looping,how to use cursor and all other necessary thing to achieve this.

    DECLARE
       b   NUMBER;
    BEGIN
       UPDATE tbl_sale
          SET a = b
        WHERE a = 1;
       IF SQL%ROWCOUNT = 0
       THEN
          INSERT INTO tbl_sale
                      (a
               VALUES (b
       END IF;
    END;note : handle exceptions where ever needed
    Regards,
    friend
    Edited by: most wanted!!!! on Mar 18, 2013 12:06 AM

  • Error 25109 : The install program could not create the config data store. Is this a know issue with a solution?

    Hi I cant install the Management Console.
    I keep getting
    Error 25109 : The installation program could not create the configuration data store. Please see the installation log for more info.
    Has someone come across this problem before?
    I am using
    MS Server 2008 Std x86
    SQL Server 2005 SP2 Std x86
    MDOP 2008 R2
    APP-V 4.5
    Please can someone help.
    Thanks

    I'm running into the same problem myself, I have an almost identical setup.
    Trying to do a clean install of App-V Management Server 4.5 from the MDOP 2008 R2 CD.
    Server OS: Windows Server 2008 Enterprise SP1 (Has WDS and IIS installed (IIS 6 Management Compatibility too), as well as .Net 3.5 SP1 Framework)
    Database: Microsoft SQL Server 2005 Enterprise (Version 9.00.3068.00) (Note: SQL server is running on a different server than the server App-V is being installed on.)
    Installer gets to the point where it starts creating the database than dies, reporting a 25109 error.
    Checked out the logfile the installer created, here's a snip of the last few lines before is starts rolling back the install:
    1
    [2008-12-23 15:58:35] (2284:3084) SQL state: ``01000'', Native: 0, Text: ``[Microsoft][ODBC SQL Server Driver][SQL Server]<<< CREATED TRIGGER dbo.TR_U_SYSTEM_OPTIONS >>>''. 
    2
    [2008-12-23 15:58:36] (2284:3084) SQL state: ``42000'', Native: 18058, Text: ``[Microsoft][ODBC SQL Server Driver][SQL Server]Failed to load format string for error 16873, language id 1033.  Operating system error: 122(The data area passed to a system call is too small.). Check that sqlevn70.rll is installed in C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Binn\Resources\1033, where 1033 is the language ID of US English, or the appropriate folder for the locale in use. Also check memory usage.''. 
    3
    [2008-12-23 15:58:36] (2284:3084) SQL state: ``01000'', Native: 3621, Text: ``[Microsoft][ODBC SQL Server Driver][SQL Server]The statement has been terminated.''. 
    4
    [2008-12-23 15:58:36] (2284:3084) ::SQLExecDirectW error 0xffffffff. 
    5
    [2008-12-23 15:58:36] (2284:3084) Failed to execute SQL ``/* ------------------------------------------------------------------------- *\ 
    6
        Copyright (c) Microsoft Corporation.  All rights reserved. 
    7
    8
        Description: 
    9
            This script creates all user-defined messages. 
    10
    11
            The types of messages allowed (and their severities) are: 
    12
            FATAL   - SQL Server Severity = 17; ours = 1 
    13
            ERROR   - SQL Server Severity = 16; ours = 2 
    14
            WARNING - SQL Server Severity = N/A; ours = 3 
    Can anyone help me shed some light on what's going on here?

  • Select all values from Rule in Store Procedure

    Hi
    I have a rule like this
    CREATE RULE [dbo].[Rle_Currency_Lst]
    AS
    @List IN
    ('PKR','USD')
    GO
    Now i want to make simple "Currency List" report for which i need to select values from above rule in Store Procedure which i will use in SSRS to fill my report.
    Please help
    Zubair Afridi | Please mark as answered or vote helpful if this post help resolved your issue. Thanks!

    One way to get the values.
    declare @definition nvarchar(max);
    select @definition = m.definition
    from sys.objects o
    inner join sys.sql_modules m on o.object_id = m.object_id
    where schema_name(o.schema_id) = 'dbo' and o.name = 'Rle_Currency_Lst';
    set @definition = SUBSTRING(@definition, CHARINDEX('''', @definition), LEN(@definition));
    set @definition = LEFT(@definition, CHARINDEX(')', @definition) - 1);
    declare @myXML AS XML;
    set @myXML = N'<H><r>' + REPLACE(SUBSTRING(@definition, CHARINDEX('''', @definition), LEN(@definition)), ',', '</r><r>') + '</r></H>'
    declare @result table(myvalues nvarchar(100));
    insert @result(myvalues)
    SELECT Vals.id.value('.', 'NVARCHAR(100)') AS val
    FROM @myXML.nodes('/H/r') AS Vals(id)
    update @result set myvalues = REPLACE(myvalues, '''', '');
    select * from @result;
    Note that rules is a deprecated feature and will be removed in a future version of SQL Server.  The replacement for rules is CHECK CONSTRAINTS.  You may well want to consider a plan to migrate your current rules to check constraints.
    Tom

Maybe you are looking for

  • Using an external hard drive with a Mac and a PC?

    I have an external hard drive that I've used with my Windows PC/ itunes / music that I've copied to the PC. Can I use the external hard drive that I use with my Windows PC on my Mac/ itunes / music I've downloaded to my Mac?

  • Combine files into a single PDF

    I upgraded from Adobe 9 Professional to Adobe 11 professional. In version 9 I was able to select WORD and EXCEL files and drag them to combine into a single PDF. When i do that in version 11, I get an error message and i have to remove the files whic

  • Is it possible to get the main class name in a Thread context ?

    for example, i want to get the main class name (the first entry of the program). public class Test implements Runnable {      public Test() {}      public static void main(String[] args) {           new Thread(new Test()).start();      public void ru

  • How to change transparent PDF background into white background?

    Hi all, I have some text documents in PDF format and would like to edit it in photoshop CS5, but each time I open them up in photoshop, the background seems to be transparent (tiny grey and white tiles), which is very eye tiring when editing/annotati

  • Oracle Entitlement Server

    Can some body help me in understanding how the security is implemented using OES and how it is integrated with OSB.