How pass a parameter with forward slash to plsql script

Hi,
I am trying pass a parameter to plsql script from command line using sqlplus, and the parameter is a file directory and has '/'. Seems the system couldn't recognize the value.
here is my code in DECLARE:
l_FileDir VARCHAR2(200) := &&FileDir ;
I pass value '/usr/tmp' (with the single quote in the string)
Can someone tell me how I do it?
Thanks,
Kate
Edited by: user12100435 on Feb 25, 2010 8:31 AM

user12100435 wrote:
I think you are right. The issue is not file-separator character issue. because the exact same script run in another envoironment. And it's not file directory or permission issue because if I use hardcoded value, the code works fine.
The error message is invalid File directory.
Here is the related part of the code.
-- open file handler
IF UTL_FILE.IS_OPEN(l_FileHandler) THEN
UTL_FILE.FCLOSE(l_FileHandler);
ELSE
l_FileHandler := UTL_FILE.FOPEN ( location => l_FileDir,
filename => l_FileName,
open_mode => 'W',
max_linesize => 32767 );
END IF;Ok, based on your input so far, I have cooked up a simple testcase.
Make sure you are doing something similar to this -
test@XE>
test@XE> -- show the contents of the anonymous PL/SQL script
test@XE> -- You are probably passing two parameters - the file location and the file name
test@XE> --
test@XE> ! cat test5.sql
DECLARE
  l_FileHandler UTL_FILE.FILE_TYPE;
  l_FileDir     VARCHAR2(200) := '&1' ; 
  l_FileName    VARCHAR2(200) := '&2' ; 
BEGIN
  -- open file handler
  IF UTL_FILE.IS_OPEN(l_FileHandler) THEN
    UTL_FILE.FCLOSE(l_FileHandler);
  ELSE
    l_FileHandler := UTL_FILE.FOPEN ( location => l_FileDir,
                                      filename => l_FileName,
                                      open_mode => 'W',
                                      max_linesize => 32767 );
    UTL_FILE.PUT_LINE(file => l_FileHandler, buffer => 'Hello, World!');
    UTL_FILE.FCLOSE(file => l_FileHandler);
  END IF;
END;
test@XE>
test@XE> -- execute it
test@XE> @test5.sql '/usr/tmp' 'first.txt'
old   3:   l_FileDir     VARCHAR2(200) := '&1' ;
new   3:   l_FileDir     VARCHAR2(200) := '/usr/tmp' ;
old   4:   l_FileName    VARCHAR2(200) := '&2' ;
new   4:   l_FileName    VARCHAR2(200) := 'first.txt' ;
DECLARE
ERROR at line 1:
ORA-29280: invalid directory path
ORA-06512: at "SYS.UTL_FILE", line 33
ORA-06512: at "SYS.UTL_FILE", line 436
ORA-06512: at line 10
test@XE>
test@XE> -- Create a directory object that points to "/usr/tmp"
test@XE> create directory log_dir as '/usr/tmp';
Directory created.
test@XE>
test@XE> -- now invoke the script
test@XE> -- Note - I pass the value "LOG_DIR" in uppercase. That's the name of my directory object.
test@XE> --
test@XE> @test5.sql 'LOG_DIR' 'first.txt'
old   3:   l_FileDir     VARCHAR2(200) := '&1' ;
new   3:   l_FileDir     VARCHAR2(200) := 'LOG_DIR' ;
old   4:   l_FileName    VARCHAR2(200) := '&2' ;
new   4:   l_FileName    VARCHAR2(200) := 'first.txt' ;
PL/SQL procedure successfully completed.
test@XE>
test@XE> -- Since my Oracle client is on the same machine as the Oracle server, I can check
test@XE> -- this file "/usr/tmp/first.txt" quite easily
test@XE>
test@XE> ! cat /usr/tmp/first.txt
Hello, World!
test@XE>
test@XE> isotope

Similar Messages

  • ADAM, LDAPContext Container Name with Forward Slash

    Hi,
    I am having trouble writing some Java code, which will create a container/folder in ADAM, where the container name and distinughed name contain a forward slash.
    e.g.
    cn=test/test
    dn=CN=test/test,CN=TestStore,DC=MyCompany,DC=COM
    LdapContext _ctx = getNewContext(valid_userName, valid_userName, valid_userName);
      // uses InitialLdapContext under the hood
    String containerDN = "dn=CN=test/test,CN=TestStore,DC=MyCompany,DC=COM"
    _ctx.createSubcontext(containerDN, attrs); // assume attrs is valid javax.naming.directory.AttributesI am struggling to escpae the forward slash from the Java String object, and yet allow the InitialLdapContext to create the container with the name.
    From the ADAM Adsi Edit application, I can create folders with forward slashes, so I presume the process can be done from code as well.
    Many thanks in advance ...

    Create a Name rather than passing a String.

  • Folders with forward slashes in the name not appearing in Mail.app Exchange

    Has anybody else seen this? For folders with forward slashes in the name, such as "Meetings/Events", the folder shows up in Outlook Web Access and over Exchange in Entourage 2008, but not Exchange over IMAP with Mail.app in Snow Leopard. The folder shows up once I remove the forward slashes, such as "Meetings Events" or "Meetings-Events" or "Meetings and Events".
    Is this a known issue, and is there a fix besides renaming the folders?

    In Unix the forward slash is an illegal character for a filename. In general you should avoid using it as the forward slash is used in path names such as /Folder/File. Avoid using the colon as well because it's commonly used as part of a disk identifier in OS X.
    This is not any different than avoiding the backslash in Windows filenames.

  • How to create parameter with multiple selection in a query (SQ02) ?

    Hi Exports
    Do you know how to create parameter with multiple selection in a query (transaction SQ02)?
    thanks.

    Hi
    i know how to create user parameter at SQ02,
    the question is how to create multiple selection parameter?

  • How to pass a parameter with more than one value to a report? (urgent)

    Hi, all
    I try to pass a parameter from a search form to a report in
    which I would like to print out my search result. My problem is
    I can pass the parameter to report but only one value which my
    cursor points to. could anyone tell me how to pass a list of
    value to the report? my trigger in form like this:
    declare
    PL_ID PARAMLIST;
    sc_no books.c_no%type;
    begin
    PL_ID := GET_PARAMETER_LIST('parametername');
    IF NOT ID_NULL(PL_ID) THEN
    DESTROY_PARAMETER_LIST(PL_ID);
    END IF;
    PL_ID := CREATE_PARAMETER_LIST('parametername');
    IF ID_NULL(PL_ID) THEN
    MESSAGE('PL/SQL held against Button failed to execute');
    RAISE FORM_TRIGGER_FAILURE;
    END IF;
    ADD_PARAMETER(PL_ID, 'PARAMFORM', TEXT_PARAMETER,'NO');
    sc_no := :searchlist.c_no; --(c_no is the value I want to pass
    but not only one.)
    ADD_PARAMETER(PL_ID, 'pamametername', TEXT_PARAMETER, sc_no);
    RUN_PRODUCT(REPORTS, 'reportpathname.rep', SYNCHRONOUS, RUNTIME,
    FILESYSTEM, PL_ID, NULL);
    end;
    Thank you in advance
    Diana

    Is it your values in parameter NO separated by coma? And is it
    parameter in where clause?
    Do you want something like :
    from table
    where s_no in (NO) ?
    If is answer "yes" you can create lexical parameter in report.
    You can write in report sowething like:
    select a.field1, a.field2,.....
    from table a
    &COND /* this is if is condition only one line after "from".
    if you have more lien after where then you will put this &COND
    in line where you want to have your multivalue.
    Then in your trigger in form you should write:
    sc_no := 'where a.sc_no in ('||:searchlist.c_no||')';
    ADD_PARAMETER(PL_ID, 'pamametername', TEXT_PARAMETER, sc_no);
    /* again this is if you have only one line with WHERE ili
    conditions */
    or you will write:
    sc_no := 'and a.sc_no in ('||:searchlist.c_no||')';
    ADD_PARAMETER(PL_ID, 'pamametername', TEXT_PARAMETER, sc_no);
    It will substitute line in which is your conditions with
    multivalue.

  • Applescript: How to reference to a filename with forward slash character?

    Hi,
    I have this script line:
    do shell script "lpadmin -p CIN-East-Copier -E -v lpd://192.168.51.78 -P '/Library/Printers/PPDs/Contents/Resources/LANIER MP C5501/LD655C'"
    The filename is "LANIER MP C5501/LD655C", the forward slash in the name is a character, not a folder structure.
    The script above works perfectly for drivers without the forward character.  Can anyone help me how to make it work?  I tried replacing the forward slash with URL encoded character, changing the structure to colon delimited (i.e. Macintosh HD:Library:Printers....etc), none work.
    Thanks!

    Since the / is the standard directory delimiter, it is not usually valid in a filename. It's extremely unusual to find such a character in a filename. However, all is not lost... there is a trick.
    Since the standard Mac OS paths used colon-delimited paths, and UNIX uses slash-delimited, there is a kind of hybrid solution... you can use the colon in the shell and it interprets as a slash, e.g.:
    do shell script "lpadmin -p CIN-East-Copier -E -v lpd://192.168.51.78 -P '/Library/Printers/PPDs/Contents/Resources/LANIER MP C5501:LD655C'"
    I haven't tried it, but you might need to escape (with a backslash) the colon:
    do shell script "lpadmin -p CIN-East-Copier -E -v lpd://192.168.51.78 -P '/Library/Printers/PPDs/Contents/Resources/LANIER MP C5501\\:LD655C'"

  • Pass Input Parameter With Blank To SSIS Get Strange Result

    Hi! I stuck for a while when executing SSIS from stored procedure with input parameter. My input value is not consistent with output one. If I pass value with blank , SSIS seems gets second part. For example , if I pass "CALL FROM SP", SSIS get
    "FROM" only. 
    I use Execute SQL Task to store input parameter. Here is the SSIS snapshot.
    And here is the sp snippet
    DECLARE @Path VARCHAR(200),
    @Cmd VARCHAR(4000),
    @ReturnCode INT,
    @QUERY_STRING VARCHAR(70),
    @BATCH_NO VARCHAR(14)
    SELECT @Path = 'xxxxxx'
    SELECT @QUERY_STRING = 'CALL FROM SP'
    --BatchNo = YYYYMMDDHHMMSS
    SELECT @BATCH_NO = CONVERT(VARCHAR(10),GETDATE(),112) + REPLACE(CONVERT(VARCHAR(8),GETDATE(),108),':','')
    SELECT @Cmd = 'DTexec /FILE "' + @Path + 'Package1.dtsx" /MAXCONCURRENT 1 /CHECKPOINTING OFF /REPORTING EW ' + '/Decrypt ALCM '
    + ' /SET \Package.Variables[User::BATCH_NO].Properties[Value];' + @BATCH_NO
    + ' /SET \Package.Variables[User::QUERY_STRING].Properties[Value];' + @QUERY_STRING
    My test are
      input parameter
     write to TESTTB correctly ? 
    any error?  
     execute SSIS in design mode
     CALL FROM SSIS
     YES
     execute SSIS by sp
     CALL FROM SP
     NO
     Option "FROM" is not valid.
     execute SSIS by sp
     CALL_FROM_SP
     YES
    Anyone could give me some hint ? 
    Thank you so much!!

    Hi Nick,
    It occurs because an argument of the DTExec commands must be enclosed in quotation marks if it contains a space. From the dtexe (SSIS Tool): Syntax Rules section of the
    dtexec Utility (SSIS Tool) document, we can see:
    All options must start with a slash (/) or a minus sign (-). The options that are shown here start with a slash (/), but the minus sign (-) can be substituted.
    An argument must be enclosed in quotation marks if it contains a space. If the argument is not enclosed in quotation marks, the argument cannot contain white space.
    Doubled quotation marks within quoted strings represent escaped single quotation marks.
    Options and arguments are not case-sensitive, except for passwords.
    So, you need to make the value of the variable @QUERY_STRING within double quotes in the value of the variable @Cmd or remove the space within the @QUERY_STRING value.
    Regards,
    Mike Yin
    TechNet Community Support

  • File Sharing - Shared folder with forward slash in name

    I have a shared folder that has a forward slash in the name:   Test/Folder
    I can't remove it.
    Any suggestions on how to delete this from the File Sharing?

    Try this:
    sudo sharing -r name
    where name is the name of the sharepoint you want to delete.

  • Problem importing a CSV file with forward slashes in a column

    I have an Excel csv file of a product database (contains about 6500 products) that contains product codes with forward slahes such as 499/1, 499/3, 499/5.
    These are different sizes of a product and as such have different prices etc.
    When I import the file into Numbers these numbers appear as 499, 166 1/3, and 99 4/5 respectively.
    What seems to be happening is that Numbers is interpreting the forward slash (/) as a divide by command and subsequently performing a calculation on that number on import and hence totally changing the value of the cell so that it is impossible to look up the price related to a product as the product code no longer exists.
    Excel can import these files with no problems, why can't Numbers treat each cell as text and leave it alone on import.
    Is there any way round this or do I have to revert to using Excel for the import of csv files.
    Thanks
    Steve

    I know I'm a bit(!) late (a year) coming to this party, but there is a simple solution, that worked for me, enclose the field in double quotes, and add a single quote before the number:
    Instead of
    499/1,"Super Widget 3",12.34
    do
    "'499/1","Super Widget 3",12.34
    In fact the single (unclosed) quote without double-quotes works as well:
    '499/1,"Super Widget 3",12.34
    I've always found it better to enclose strings with double quotes. This works on loading the file into Mac Numbers and should work with Excel too if that helps. It opens with OpenOffice 4 on the Mac too - if you select "comma" in the "Separated by" checkbox
    I can't remember where I picked this info up....
    Hope this helps someone, albeit late.
    Andy

  • Passing Enum Parameter , with More than one value ?

    Hi, Good day
    in the fallowing example ,should I replace the enum Parameter with what ? how can i make that work ?
    Module Module1
    Enum Tables as integer
    Table1 = 0
    Table2 = 2
    Table3 = 4
    Table4 = 6
    End Enum
    Public Sub CallTables(byval Tbl as Tables)
    if tbl = Tables.Table1 then msgbox ("Table1")
    if tbl = Tables.Table2 then msgbox ("Table2")
    if tbl = Tables.Table3 then msgbox ("Table3")
    if tbl = Tables.Table4 then msgbox ("Table4")
    end sub
    end module
    Class myClass1
    private sub mySub()
    CallTables(Tables.Table1 and Tables.Table2)
    CallTables(Tables.Table1 and Tables.Table2 and Tables.Table3)
    end sub
    end class
    since the Tbl parameter will take one value only , so one statement only will execute , how can I make it work with Enum Parameter ?
    Thanks

    Thanks guys for you reply , [Cor Ligthert] I post this in Visual basic section, I appreciate your solution [dbasnett],
    Thanks for that idea of attribute <Flags> [Blackwood] ,
    Dictionary will not work in IF Statement as I want it , also ParamArray tbl() , thanks guys.
    Here is the code
    Module myModule
    <Flags()>
    Enum Table As Integer
    Table1 = 2
    Table2 = 4
    Table3 = 8
    Table4 = 16
    Table5 = 32
    End Enum
    Public Sub MySub(ByVal Table As Table)
    If (Table And Table.Table1) = Table.Table1 Then
    MsgBox((Table And Table.Table1))
    End If
    If (Table And Table.Table2) = Table.Table2 Then
    MsgBox((Table And Table.Table2))
    End If
    If (Table And Table.Table3) = Table.Table3 Then
    MsgBox((Table And Table.Table3))
    End If
    If (Table And Table.Table4) = Table.Table4 Then
    MsgBox((Table And Table.Table4))
    End If
    If (Table And Table.Table5) = Table.Table5 Then
    MsgBox((Table And Table.Table5))
    End If
    End Sub
    End Module
    Class Myclass
    Private sub CallTables()
    MySub(Table.Table1 Or Table.Table2)
    MySub(Table.Table2 Or Table.Table3 Or Table.Table4)
    MySub(Table.Table1 Or Table.Table4 Or Table.Table5)
    MySub(Table.Table1 Or Table.Table2 Or Table.Table4 Or Table.Table5)
    MySub(Table.Table1 Or Table.Table2 Or Table.Table3 Or Table.Table4 Or Table.Table5)
    end sub
    end Class

  • Passing text parameter with spaces to oracle forms function

    Hi,
    I have a personalized link in R12.1.3 from OAF to a custom form, which is working fine:
    Item Style = Link
    Destination URI = form:PO:XXPO:STANDARD:XXXABC03:VENDOR_ID={@VendorID} QUERY_MODE=No
    View Instance = SupplierVO
    XXPO is the responsibility key, and PO the responsibility application
    XXXABC03 is the function name
    VENDOR_ID and QUERY_MODE are the form parameters
    This link works as expected.
    I have a problem passing a text parameter containing spaces. The Oracle Application Framework Developer's Guide
    Release 12.1.3 states the following
    Note: If you wish to send varchar2 parameter values that contain spaces, use \" to enclose the string value. For example, to pass in something of the form:
    TXN_NUMBER=LT INVOICE 1
    Use:
    TXN_NUMBER=\"LT INVOICE 1\"
    So my personalization becomes
    Item Style = Link
    Destination URI = form:PO:XXPO:STANDARD:XXXABC03:VENDOR_ID={@VendorID} VENDOR_NAME=\"{@VendorName}\" QUERY_MODE=No
    View Instance = SupplierVO
    But the problem is that the spaces in the vendor name parameter are replaced with %20 when the form opens, e.g. EXAMPLE%20SUPPLIER%20LTD instead of EXAMPLE SUPPLIER LTD
    Has anybody got this type of personalization working? Thanks in advance, Ruth
    Additional Note:
    In real life I have created a workaround for this example. I just pass vendor_id and have modified the XXXABC03 form to derive vendor_name from vendor_id. But I now have another requirement where the parameter WILL have spaces.
    In desperation I may add a function to the form to replace %20 with a space in text parameters.
    But it would be nice if Oracle worked how it is explained in the manual......

    Hi,
    I'm not sure if there is a built in function. Else, Javascript code would be necessary.
    Using the technique in the link below will do.
    http://www.java2s.com/Code/JavaScript/Form-Control/Jumptothenextfield.htm
    Unfortunately, it doesn't seem like that tabIndex attribute is supported in ADF Faces. Link below.
    ADF Faces setting the tab order between fields
    They are suggestions to use the <h:inputText> component instead but not sure if that is supported and if other problem may occur.
    Regards,
    Chan Kelwin

  • How to pass a file with parameters to a shell script from java

    I have a sh script running on linux. This script prompts when started prompts for 4 questions, for which the answers are 1, 1, 1, Y. So now I need to invoke this from a java program and pass the parameters in a file from jave to the script. Can anyone tell me how to code this in java. The script works fine from command line.
    Thanks in advance.

    Here is the standard answer to all questions involving Runtime.exec(), enjoy:
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html

  • Passing fragment parameter with in a javascript function

    How can I pass the current node to a function I tried this but it
    didn't work.please advice
    <script language="javascript">
    nvh_mainnavigation_display(g_navNode_Path, Node ,
    "<!--$HttpRelativeFragmentsRoot-->AlfarisMainNavigation", false);
    </script>
    Note:
    I'm trying to create a menu that shows the subnodes of the current
    section or node that im standing on.

    Hello,
    So that really should work. Are you getting back a blank or seeing <!--$HttpRelativeFragmentsRoot--> in the result?
    David

  • How to append parameter with URL for each record in table control?

    Hi,
    I have one table control which contains 5 columns.
    (tripno, startdate, destination, reason, activities)
    In 5th column, i need to display URL for each record.
    for ex:
    www.abc.com/test?tripno=1
    www.abc.com/test?tripno=2
    www.abc.com/test?tripno=3
    when user clicks a particular hyperlink, it navigates to another page/component thru URL with one key field(tripno) to retrieve related records in next page.
    1) i am not able to assign tripno to each record. when i assign tripno, its taking the last value which i assigned. ie. tripno=3 only.
    How to assign URL to Reference field of LINK_TO_URL element at run time?
    OR
    2) we can do like this.
    Simply assign url to reach record without key field.
    www.abc.com/test
    www.abc.com/test
    www.abc.com/test
    when user clicks a particular link, we can assign corresponding key field to the URL.
    Where should i write this event? Bcoz, LINK_TO_URL doesnot have event.
    how to do?

    Hi MOg.
    Not sure whether I understand you .. but in the 5th column you want to have the reference URL. Is this the activities columen from you example?
    Nevertheless, you need a attribute (String) in your context node which contains the URL. Bind this to the reference filed of linktourl. If you can not extend the structure you can create a sub node (cardinality 1:1)  which contains the refernce attribute.
    Then loop over all elements and concatenate www.abc.com/test?tripno= with the tripno of the current element into the reference field.
    Hope tis helps,
    Sascha.
    Bind the

  • Pass session parameter with javascript

    H� all?
    I have strange problem...
    I connect some database and take some data in JSP page and after I set these data to session values and I open anothewr JSP page by using javascript window.open() method. By the way I lost session parameter in second JSP page opened by window.open();
    // Here the codes...
    there is a button in my first JSP on Click event : calling Talep_Read1() Javascript function.. This function is below.... Bu I heard about: JSP and javascript works different times...
    function talep_Read1(){
    deg = "<%=abr_kd%>";
    if( deg== "0" || deg == "9"){
    var URL = "/METSIS/talep_read.jsp;jsessionid=<%=session.getId()%>";
    newWin = window.open(URL,'SelWnd','menubar=no,toolbar=no,location=no,status=no,scrollbars=yes,resizable=no,width=800,height=600');
    newWin.focus();
    }else{
    var URL = "/METSIS/Detay_Read2.jsp;jsessionid=<%=session.getId()%>";
    newWin = window.open(URL,'SelWnd','menubar=no,toolbar=no,location=no,status=no,scrollbars=yes,resizable=no,width=800,height=600');
    newWin.focus();
    HOw can solve this prob...?
    Open the second page I lost session parameter but I refresh the this page session parameter is seeen
    What is the problem please helpp::
    Thanks.

    Should be:
    var URL = "/METSIS/Detay_Read2.jsp?jsessionid=<%=session.getId()%>";

Maybe you are looking for

  • Adding field in PA30

    Hi Friends, I want to add communication column in pa30 initian screen in basic personal data. After adding the Communication column, In communication screen I want to add one more field E-Mail field. Please help me to complete the above task.

  • InternalCatalogException in Reporting Services 2008 - no reports rendering

    Hi all, We've had an unexpected outage on two of our reporting services server overnight and we're hoping someone can point us in the right direction.  We have a Windows Server 2008 machine running about 5 instances of reporting services in standalon

  • ISight problem for a MacBook5,1 (2009)

    I have a MacBook5,1 (2009) and all of a sudden the camera does not work.  help!

  • Nano3rd: album artwork does not transfer

    my album artwork is not transferring...when i click on "display album artwork" and click "apply", it optomizies halfway through and then i receive an error message. it reads "ipod cannot be synchronized"...some of the artwork is from songs i have pur

  • Call a procedure in the application. Frank kindly check this

    Hi, I hv downloaded the login screen from the following site. Now I am trying to connect the same with my database. i hv introduced the password field in the application as earlier only username is available in the UI. [http://blogs.oracle.com/shay/s