create a txt file in the client machine

Hi all

I have


Oracle9i Enterprise Edition Release 9.2.0.6.0 - Production
PL/SQL Release 9.2.0.6.0 - Production
CORE 9.2.0.6.0 Production
AMT for Linux: release 9.2.0.6.0 - Production
NLSRTL Version 9.2.0.6.0 - Production


I want to create a file in my pc with utl_file for example

{

CREATE OR REPLACE PROCEDURE HELLOFLE IS
v_MyFileHandle UTL_FILE. TYPE_DE_FICHIER;
BEGIN
v_MyFileHandle: = UTL_FILE. FOPEN ("C:------',' myfile.") TXT', 'w');
UTL_FILE. Put_line (v_MyFileHandle, "something must printed");

UTL_FILE. FCLOSE (v_MyFileHandle);
EXCEPTION
WHILE OTHERS THEN
DBMS_OUTPUT. PUT_LINE ('ERROR' |) TO_CHAR (SQLCODE) | SQLERRM);
NULL;
END;


}

could you please help me, I'm new.


Thank you

Hitesh

Your code looks OK and also fine requirement. You can create a text file on your PC, if you are working on the server or client.
It works fine without any problems abs. The only thing to be supported is the path of directory and file mode.

1 directory path - it must be created on the Oracle server, pointing to the location of the target file you. If target is the customer, you must use the name of the computer and the relative path to create the directory as below. If your machine name is CLIENT001 and the target location is C:\Test, then your directory must be on the server (as sysdba)

conn uname/pass as sysdba
create directory mydir as '\\CLIENT001\TEST\'

Because file access operations are supported by the server, so the server must have read/write access on the directory path. In the direct words, target your path on the cleint must be shared for access to the R/W server.
Also grant read, write on directory access to the user who executes the procedure UTL_FILE.

2. If you want to create a new file on the location of the target file, it must be open in write mode (w) only. You have already done, which is correct.

That thing you can change is the directory in your code and move forward. It should work properly

CREATE OR REPLACE PROCEDURE HELLOFLE IS
v_MyFileHandle UTL_FILE.FILE_TYPE;
BEGIN
v_MyFileHandle := UTL_FILE.FOPEN('C:\','myfile.TXT','w');
UTL_FILE.PUT_LINE(v_MyFileHandle,'some thing should printed ');

UTL_FILE.FCLOSE(v_MyFileHandle);
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('ERROR ' || TO_CHAR(SQLCODE) || SQLERRM);
NULL;
END; 

Tags: Database

Similar Questions

  • How to remove the file from the client machine

    Hi all
    We use the database: oracle: 10 g,.
    and forms/States 10g (developer suite 10g - 10.1.2.2).

    can someone help me how to remove the file from the client computer in the location specified using webutil or everything
    (I tried with webutil_host & client_host but this only works for the application server)
    Thank you.

    Hello

    Checkbox not tested.

    PROCEDURE OPEN_FILE (V_ID_DOC IN VARCHAR2)
    IS
    
    --------------------------------------------------------------------------------
    -- Open a stored document --
    
    --------------------------------------------------------------------------------
    LC$Cmd Varchar2(1280) ;
    LC$Nom Varchar2(1000) ;
    LC$Fic Varchar2(1280);
    LC$Path Varchar2(1280);
    LC$Sep Varchar2(1) ;
    LN$But Pls_Integer ;
    LB$Ok Boolean ;
    -- Current Process ID --
    ret WEBUTIL_HOST.PROCESS_ID ;
    V_FICHERO VARCHAR2(500);
    COMILLA VARCHAR2(4) := '''';
    BOTON NUMBER;
    MODO VARCHAR2(50);
    URL VARCHAR2(500);
    
    Begin
    
    V_FICHERO := V_ID_DOC;
    
    LC$Sep := '\';--WEBUTIL_FILE.Get_File_Separator ; -- 10g
    LC$Nom := V_FICHERO;--Substr( V_FICHERO, instr( V_FICHERO, LC$Sep, -1 ) + 1, 100 ) ;
    --LC$Path := CLIENT_WIN_API_ENVIRONMENT.Get_Temp_Directory ;
    LC$Path := 'C:';
    LC$Fic := LC$Path || LC$Sep || LC$Nom ;
    
    If Not webutil_file_transfer.DB_To_Client
    (
    LC$Fic,
    'TABLE_NAME',
    'ITEM_NAME',
    'WHERE'
    ) Then
    
    Raise Form_trigger_Failure ;
    
    End if ;
    
    LC$Cmd := 'cmd /c start "" /MAX /WAIT "' || LC$Fic || '"' ;
    Ret := WEBUTIL_HOST.blocking( LC$Cmd ) ;
    LN$But := WEBUTIL_HOST.Get_return_Code( Ret ) ;
    If LN$But 0 Then
    Set_Alert_Property( 'ALER_STOP_1', TITLE, 'Host() command' ) ;
    Set_Alert_Property( 'ALER_STOP_1', ALERT_MESSAGE_TEXT, 'Host() command error : ' || To_Char( LN$But ) ) ;
    LN$But := Show_Alert( 'ALER_STOP_1' ) ;
    LB$Ok := WEBUTIL_FILE.DELETE_FILE( LC$Fic ) ;
    Raise Form_Trigger_Failure ;
    End if ;
    
    If Not webutil_file_transfer.Client_To_DB
    (
    LC$Fic,
    'TABLE_NAME',
    'ITEM_NAME',
    'WHERE'
    ) Then
    NULL;
    Else
    Commit ;
    End if ;
    LB$Ok := WEBUTIL_FILE.DELETE_FILE( LC$Fic ) ;
    
    Exception
    When Form_Trigger_Failure Then
    Raise ;
    End ;
    

    Sarah

  • Create the file in the client computer


    Hello

    I want to create a file to the client computer. I, also, you want to save data in this file and be able to save the file to the client computer (my computer, c: |) I have this data block of data in oracle forms (which I get it from the base).

    Thank you

    Elad

    Hi Elad

    For the 11g version, you only need these files Jacob you mentioned, but you also need to configure these files and other files.

    The explanation of the link is for Linux too, just the validation when you expand you does not follow when using Linux.

    The ORACLE_HOME is an environment variable pointing to the directory where the Oracle software is installed, in your case if you leave the default options when you were editing your ORACLE_HOME must be the directory named "as_1".

    Concerning

    Carlos

  • How to copy a file from the client to the DB using WebUtil machine.

    We convert our forms 10g R1 forms 11g (Forms [64-Bit] Version 11.1.2.0.0).

    Or 10g R1 forms that we use a bean called oracle.forms.demos.uploadclient.FileUploader to download files from our machines of client DB machine and sometimes the application server. Select the file (using the open dialog box file which is also part of FileUploader) and then give the directory of destination (from DB machine) using the IP address.

    Problem is this bean File Upload does not work in forms 11g. So we need to use WebUtil.

    Problem is, WebUtil has only a utility to copy the files to the client computer on machine App Server (Client_To_AS). Documentation, says 'download target directory.
    must be in the transfer.appsrv.write list. Can we put any directory beginning with an IP address in the present name and use this Client_to_AS function to copy files from client to DB machine?

    Or if not how transfer us files from the client computer to any machine in the network form 11 g?

    Published by: user12240205 on June 8, 2012 03:58

    Probably, if the upload form, it is important that a "commit" be properly executed. It was actually a problem we have seen with the demo of original webutil too, which has now been fixed. We were not making a commit and so, data were only available in the session as a result of the post, but not available outside the current session of forms.

  • The client Machine Info

    How can I get these last applications opened in the client using the form 10 g machine

    You can use welutil pacakge to get the files to the client directory % RECENTLY.
    then analyze each file in the directory.
    each file is recently open files on the client computer

  • Path to the file on the virtual machine

    Hi people

    I am aware of VMRUN and would use call programs on the virtual computer and move files between the host and the guest.  I don't know exactly what it does good, nor how these virtual machines are actually structured, so I would like someone to clarify for me if it is even possible to have a host path to a file on the client VM.

    For example, I use scripts from my Mac that do a lot of editing on the side of the virtual Windows machine - is there is a way, I can use to refer to and modify a file on the virtual machine without using VMRUN.

    Thank you very much!

    Mirroing is a little difficult, I don't think that anything that is either duplicated with shared folders.  What happens is the Windows to the Documents, music, path is set to a UNC path (vmware-host\), which is served by the VMware HGFS file system, a mechanism for sharing private with OS X.  In OS X, just the files live in any directory is shared.  But that's what you say, a place with several shared paths.

    For SMB sharing, sharing so once mounted on your Mac, OS X uses a SMB client to Yes go on the network to access files in your guest VM files standard Windows.  All traffic is host only, unless the virtual machine is filled and you use the Wifi connection, in which case the traffic can "bounce" the point of wireless as a jump.  There are ways to optimize the network path, so all traffic is strictly host only.

    I have not benchmarked HGFS v. SMB, but there is a "tax" anyway compared to the opening of the VM file on its file system local.  For your use case, it is probably useful to check the two options.

  • I have created a new domain with win2012r2 and created users. Add after the client in my area so that the newspaper with the user I get error below.

    Hello

    I have created a new domain with win2012r2 and created users. Add after the client in my area so that the newspaper with the user I get error below.

    "You cannot connect because the logon method, you use is not allowed on this computer, please, see your ad min for more information network"

    Please help me with that and I don't want to give permission to admin for all users group...

    Hello

    Post your question in the TechNet Server Forums, as your question kindly is beyond the scope of these Forums.

    http://social.technet.Microsoft.com/forums/WindowsServer/en-us/home?category=WindowsServer

    See you soon.

  • Impossible to replace and update a file in the client computers through Group Policy preferences

    Hello

    I am unable to replace and update a file in the client computers through Group Policy preferences.

    For example,.

    I am trying to replace and update a custom calendar file (c:\Program Files\Microsoft Office\Office12\1033\outlook.hol)to client computers through Group Policy ptreferences (political group: computer configuration\group policy setting \file preference\windows).) But it is not updated and replaced in client computers.

    Could you please help me on this?

    THnaks

    Srinivasan

    Hello

    Your question of Windows 7 is more complex than what is generally answered in the Microsoft Answers forums. It is better suited for the public on the TechNet site. Please post your question in the following link for assistance:

    http://social.technet.Microsoft.com/forums/en/winserverGP/threads

  • I found a .txt file in the directory "DriverCure" that says "Called destructive Backend." What is c?

    I am running XP SP3 and I found a .txt file in the directory "DriverCure" that says "Called destructive Backend." What is c?

    ParetoLogic DriverCure is a computer program that scans all the drivers on your hard drive and compiles a list of those that are available updates.

    Checks the internet for the DriverCure files removal tools.

    Thank you

  • Cannot create a .db file in the assets folder

    I am trying to create a quizz.db file in the current folder by creating first a temporary quizz.db in the folder data and then creating tables inside and then copy it in the current folder. By debugging code, it shows that the folder is created. But I can't find it in the current folder. Here is the code

    #include 
    #include 
    #include 
    #include 
    
    using namespace bb::cascades;
    using namespace bb::data;
    
    SQLTest::SQLTest(bb::cascades::Application *app): QObject(app)
    {
        const QString fileName = QString("quizz.db");
        QString dataFolder = QDir::homePath();
        QString newFileName = dataFolder + "/" + fileName;
        QTemporaryFile file(newFileName);
    
        // Open the file that was created
        if (file.open())
        {
            // Create an SqlDataAccess object
            SqlDataAccess sda(newFileName);
    
            // Create a table called Employee in the database file
            sda.execute("CREATE TABLE Employee( firstName VARCHAR(50),lastName VARCHAR(50), salary INT);");
    
            // Insert employee records into the table
            sda.execute("INSERT INTO Employee (firstName, lastName, salary) VALUES (\"Mike\", \"Chepesky\", 42000);");
            sda.execute("INSERT INTO Employee (firstName, lastName, salary) VALUES (\"Westlee\", \"Barichak\", 55000);");
            sda.execute("INSERT INTO Employee (firstName, lastName, salary) VALUES (\"Ian\", \"Dundas\", 47000);");
            if(sda.hasError())
            {
    
            }
            else
                copyFileToAssetsFolder("quizz.db");
        }
    }
    void SQLTest::copyFileToAssetsFolder(const QString fileName)
    {
        QString appFolder(QDir::homePath());
        appFolder.chop(4);
        QString originalFileName = appFolder + "app/native/assets/" + fileName;
        QFile newFile(originalFileName);
    // If I enable this `if` condition the code satisfies it and removes the quizz.db file and then it satisfies the next `if` condition and successfully copies the quizz.db file from `data` folder to `assets` folder.
        /*if(newFile.exists())
            QDir().remove(originalFileName);*/
        // this `if` condition is not satisfied. Which should mean the quizz.db file has been created on assets folder.
        if (!newFile.exists())
        {
            // If the file is not already in the assets folder, we copy it from the
            // data folder (read and write) to the assets folder (read only).
    
            QString dataFolder = QDir::homePath();
            QString newFileName = dataFolder + "/" + fileName;
            QFile originalFile(newFileName);
    
            if (originalFile.exists())
            {
                // Create sub folders if any creates the SQL folder for a file path like e.g. sql/quotesdb
                QFileInfo fileInfo(originalFileName);
                QDir().mkpath (fileInfo.dir().path());
    
                if(!originalFile.copy(originalFileName)) {
                    qDebug() << "Failed to copy file to path: " << originalFileName;
                }
            } else {
                qDebug() << "Failed to copy file data base file does not exists.";
            }
        }
    
       // mSourceInDataFolder = newFileName;
    }
    

    If activate the commented "If" condition of "copyFileToAssetsFolder" int he removes already created quizz.db file in the current folder (that Im unable to find) and goes inside the next ' if' and copy the quizz.db created on the folder "data" of active fodler. But in any case I don't find the quizz.db in the current folder. I really need help with this quickly. Thank you.

    Thanks to read this to learn why you can have an application change the assets folder: https://developer.blackberry.com/native/documentation/bb10/com.qnx.doc.native_sdk.devguide/com.qnx.d...

  • Cannot save settings: unable to create a configuration file for the required configuration object

    When I try to open the application in the administrator account it say - could not save the settings: unable to create a configuration file for the required configuration object

    Thanks for the reply.i think that a virus changed I scan my computer and discovered C:\users\jason\AppData\local\temp\low\temporary internet files\content. IE5\TLIFXGRH\ why is Task Manager disabled people [1]

  • Is it necessary that the guest OS to support SSD if the file of the virtual machine is placed on an SSD?

    Dear,

    I have a plan to set up a file of the virtual machine on an SSD. The host system is windows 10 (on an other SSD, I'll use 2 SSD), it should support the SSD very well.  Then comes the question: should I also install an OS that needs support also guest SSD?

    My opinion is it does not matter since the disk i/o operation is made by host operating system, it is the host operating system which finally determin whick block data will be published (optimization of the disk).

    Am I wrong? Thank you.

    Sorry for the enigmatic answer...

    In your case, the answer is Yes: he cares about the type of media, while the virtual disk is a vmdk (virtual material treaty) and placed in an SSD.

    There are a few cases where you might use a physical disk directly to the virtual machine (called peripheral raw disk or RDM in vSphere environment).

    Concerning

  • load the file into the virtual machine

    How can I load any file to the virtual machine using java api

    How to download the file in the guest on VMware operating system:How to transfer the file to the operating system guest on VMware | DoubleCloud = & gt; Private cloud and Public Cloud

    How to download files from GOS on VMware:How to download a file from the operating system guest on VMware | DoubleCloud = & gt; Private cloud and Public Cloud

    If you have any question/problem related to this, please post on above blog

  • How to create a PDF file from the Clipboard in Adobe Acrobat Reader ms?

    Is it possible to create a PDF file from the Clipboard in Adobe Acrobat Reader ms?

    No, Acrobat Reader cannot create PDF files.

  • Is it possible to download a file from the client flex on the server?

    In my plugin I would ask the user to provide me with a local of files I need to upload to the server (server blank when my Java code is running). Since flex is launched in the sandbox inside the browser, they provide an API for downloading files the from/to the URL of the server built-in. Is it possible to define my own servlet (or something like that) inside the Virgo vSphere server to listen for the event upload? Y at - it another possibility to upload a file from the client flex on the server?

    Thank you

    Valeria

    Yes it is possible, but it is not recommended to download the large amount of data to the client Web server.  Don't forget that your java plugin is just a transmission in your own background when real business logic and/or data sources are provided.  You might as well send the file directly to your back-end, there is no reason to keep it on the server of the Web client.

Maybe you are looking for

  • Need to permanently remove an iCloud and Apple ID

    Hello- Recently, I realized a change of name and want to permanently delete my ID Apple and iCloud account associated with my old name.   (I started with my new name).   I pulled them out of my devices, but wish them erased with Apple for security re

  • Satellite A200 does not illuminate

    Hello! I have a Toshiba satellite a200, it lights, it gives me a black screen and 1 long and 2 short beeps, the only lights that light up are the witness of load and the light of the HARD drive, what's the problem? I emptied the power from the mother

  • I get cannot load the icloud preferences panel and cannot access the photos

    I upgraded to Yosemite and now my photos do not recognize my icloud shared photos.  I tried to open the icloud preferences to ensure that pictures are always enabled but I get "unable to load the icloud preferences panel" every time. Suggestions?

  • Microsoft impostor scammed

    I was contacted by phone by someone who said that they were Microsoft and told me that my computer was in danger and they could solve the problem. I hope Microsoft, so I leave them in my computer. Now I find that I am accused for two lifetimes of the

  • Typing questions - cursor jump

    Is there a 'solution' to the problem of cursor jumping reported in Vista over a year ago and I now see in my new machine Windows 7 with Office 2007?