How can i identify the environment name or database name in the PL/SQL code

Hi,
I am using UTL_FILE to genearate the files.,
My problem is, I have to design the common sql file , which can be executed in 2 diffrent environments ( Say QA & DEV ) , with no parameters. It has to identify the environment and based on the environment , it has to generate the concern files.,
The only change needs to be incorporated is , file names , which will change based on the environment.,
can nay one tell me , how can i identify the environment name or database name in the PL/SQL code ??
Raja

In this case, USEC_GI_DEV.NA.XXXNET.NET is a TNS alias. That alias exists only on the client machine. There is no way to access that information on the database server.
You would have to find something in the v$database or v$instance table that uniquely identifies the database (and you may need some help from the DBAs to do this because you need to ensure that the data element you choose is compatible with whatever refresh process(es) are used in your environment).
Now, if you are writing a stand-alone SQL*Plus script, SQL*Plus, as a client tool, does have access to the TNS alias in later versions. But that is a client-side determination, not a server-side determination.
Justin

Similar Messages

  • How can one  read a Excel File and Upload into Table using Pl/SQL Code.

    How can one read a Excel File and Upload into Table using Pl/SQL Code.
    1. Excel File is on My PC.
    2. And I want to write a Stored Procedure or Package to do that.
    3. DataBase is on Other Server. Client-Server Environment.
    4. I am Using Toad or PlSql developer tool.

    If you would like to create a package/procedure in order to solve this problem consider using the UTL_FILE in built package, here are a few steps to get you going:
    1. Get your DBA to create directory object in oracle using the following command:
    create directory TEST_DIR as ‘directory_path’;
    Note: This directory is on the server.
    2. Grant read,write on directory directory_object_name to username;
    You can find out the directory_object_name value from dba_directories view if you are using the system user account.
    3. Logon as the user as mentioned above.
    Sample code read plain text file code, you can modify this code to suit your need (i.e. read a csv file)
    function getData(p_filename in varchar2,
    p_filepath in varchar2
    ) RETURN VARCHAR2 is
    input_file utl_file.file_type;
    --declare a buffer to read text data
    input_buffer varchar2(4000);
    begin
    --using the UTL_FILE in built package
    input_file := utl_file.fopen(p_filepath, p_filename, 'R');
    utl_file.get_line(input_file, input_buffer);
    --debug
    --dbms_output.put_line(input_buffer);
    utl_file.fclose(input_file);
    --return data
    return input_buffer;
    end;
    Hope this helps.

  • How can I identify "unrequested" downloads which arrive without appearing in the Downloads window

    Frequently during quiet periods while online, data downloads occur as can be observed by the data transfer indicator flashing on the modem. They have not been preceded by requests for updates, requests for specific downloads, or by announcements from any source. They usually resume if the modem is switched off for a while, and then switched on again. 50 MB has come down over the last half hour. There is usually no warning from my firewall and other security software, which does not mean that the downloads are definitely safe. This interferes with sensitive connections to banks, for instance. I have found no obvious clues while browsing folders, and there are many hidden folders in Windows 7. How can I identify the data online, preferably, or on my harddrive later ? Opening the Downloads window after the start of a session of mystery files does not help.

    See [[Firefox makes unrequested connections]]

  • So how can I identify if my Mac is original?

    So how can I identify if my Mac is original?

    By the seriel number.
    Check out the following link:
    http://support.apple.com/kb/ht1559

  • I have very little space left on the hard drive on my macbook, on my storage report it says "other" is taking up more than two thirds of the space on the hardrive. How can I identify what these files are?

    I have very little space left on the hard drive on my macbook, on my storage report it says "other" is taking up more than two thirds of the space on the hardrive. How can I identify what these files are?

    Hello,
    There is free software you can download that gives you a graphical image of what files are used on your hard drive. http://www.derlien.com/
    This may help you clean down your hard drive for more space.
    Best of luck

  • How can I identify and delete duplicates on the latest version of itunes?

    How can I identify and delete duplicates on the lastest version of iTunes?

    The show duplicates/show exact duplicates features have been left out of iTunes 11. Rumor suggests they will be restored in the next build. In the meantime I have written two Windows scripts to make playlists of Duplicates and Exact Duplicates, either from a selection of tracks or the entire library. Note that, as with the iTunes feature, this list makes no distinction between "originals" and "dupes", you have to decide which is which.
    There is also my DeDuper script for automatically removing duplicate copies but keeping one remaining copy of each set. This can preserve ratings, play counts, playlist membership, etc. which are lost in a manual clean up. Please take note of the warning to backup your library before deduping. See this thread for background on deduping and the script.
    If you want to manually remove duplicate tracks use shift-delete to remove selected tracks from the library as well as the playlist. Keep one of each repeated group of files and don't send the others to the recycle bin unless you are sure that there are multiple files on the disc as opposed to multiple entries to the same file. Same advice to backup applies.
    tt2

  • How can L identify what are the not null fields of a table in a stored procedure ?

    How can L identify what are the not null fields of a table in a stored procedure ?

    You could query the data dictionary:
    SELECT column_name
    FROM all_tab_columns
    WHERE owner = '...'
    AND table_name = '...'
    AND nullable = 'N'

  • In Credit Management how can we identify the credit customers

    Hi SD Gurus,
    Could you please tell me, In Credit Management how can we identify the credit customers?
    and what are accounting entries?
    Thanks & Regards,
    Nivas

    You can refer Table KNKK with reference to Credit Control Area, you will get all the Customers maintained for Credit Management.
    There is no such Accounting Entries especially for Credit Management.It would be the same as comes while creating Invoice.
    Best Regards,
    Ankur

  • How can I identify and remove duplicate file (audio & photo)

    How can I identify and remove duplicate file (audio & photo)?  I have quite a few libraries created as backup files.

    Terence,
    Yes, the duplicates appear in the iPhoto window. I have folders with same name occuring two or even three times sometimes with exactly the same set of photos (ie photos with the same ID) and sometimes with a limited set of photos. Other  folders appear only once.
    I normally take my MacBook with me if I'm shooting a lot of photos, such as on holiday, and then want to transfer them to my iMac when i get home. Other times I transfer the camera's memory stick directly to my iMac.
    I have great difficulty transferring the photos from my MacBook to my iMac. I don't want to store my photos on my iDisk due to the length of time it takes to upload them.
    Thanks again.
    Simon

  • How can we identify what are all user exits are there for sales orders,deli

    Dear All,
    How can we identify what are all user exits are there for sales orders,deliverys and invoices
    thanks
    nitchel v

    Hi Nitchel
    There are many ways to find out the user exits..
    For example for VA01.
    Goto Transaction ie VA01:
    goto System-- Status
    doubleclick on the program name ie SAPMV45A
    SE38 -> Enter the program name and in the program( SAPMV45A) goto -- attributes
    get the package name from here ie VA
    note the package(VA) and get back to main screen
    goto SMOD tcode  and click on find button in the package spec giv the package name ie VA and execute it
    you will find list of exits available
    check out the exit that suits ur requirement
    goto cmod and create a new project and implement in that user exit.
    You will get the following exits in SMOD..
    SDTRM001  Reschedule schedule lines without a new ATP check
    V45A0001  Determine alternative materials for product selection
    V45A0002  Predefine sold-to party in sales document
    V45A0003  Collector for customer function modulpool MV45A
    V45A0004  Copy packing proposal
    V45E0001  Update the purchase order from the sales order
    V45E0002  Data transfer in procurement elements (PRreq., assembly
    V45L0001  SD component supplier processing (customer enhancements
    V45P0001  SD customer function for cross-company code sales
    V45S0001  Update sales document from configuration
    V45S0003  MRP-relevance for incomplete configuration
    V45S0004  Effectivity type in sales order
    V45W0001  SD Service Management: Forward Contract Data to Item
    V46H0001  SD Customer functions for resource-related billing
    V60F0001  SD Billing plan (customer enhancement) diff. to billing
    For Delivery you will get .. here the package name will be VL.
    V02V0001  Sales area determination for stock transport order
    V02V0002  User exit for storage location determination
    V02V0003  User exit for gate + matl staging area determination (h
    V02V0004  User Exit for Staging Area Determination (Item)
    V50PSTAT  Delivery: Item Status Calculation
    V50Q0001  Delivery Monitor: User Exits for Filling Display Fields
    V50R0001  Collective processing for delivery creation
    V50R0002  Collective processing for delivery creation
    V50R0004  Calculation of Stock for POs for Shipping Due Date List
    V50S0001  User Exits for Delivery Processing
    V53C0001  Rough workload calculation in time per item
    V53C0002  W&S: RWE enhancement - shipping material type/time slot
    V53W0001  User exits for creating picking waves
    VMDE0001  Shipping Interface: Error Handling - Inbound IDoc
    VMDE0002  Shipping Interface: Message PICKSD (Picking, Outbound)
    VMDE0003  Shipping Interface: Message SDPICK (Picking, Inbound)
    VMDE0004  Shipping Interface: Message SDPACK (Packing, Inbound)
    For Billing VF01..Package is VF..
    SDVFX007  User exit: Billing plan during transfer to Accounting
    SDVFX008  User exit: Processing of transfer structures SD-FI
    SDVFX009  Billing doc. processing KIDONO (payment reference numbe
    SDVFX010  User exit item table for the customer lines
    SDVFX011  Userexit for the komkcv- and kompcv-structures
    V05I0001  User exits for billing index
    V05N0001  User Exits for Printing Billing Docs. using POR Procedu
    V60A0001  Customer functions in the billing document
    V60P0001  Data provision for additional fields for display in lis
    V61A0001  Customer enhancement: Pricing
    Or another way is ..
    - Get the program name for that T-Code
    - Go to that program
    - In that program, search for word 'EXIT' or 'CUSTOMER-FUNCTION' by using where-used list which will give u the list of user exits for that program
    And also you can check in the tables in SE16 for user exits..
    MODSAP - Stores SAP Enhancements
    MODSAPT - Stores SAP Enhancements - Short Texts
    MODACT - Stores Modifications
    And there are other ways as well , pls check the forum for this ,
    Regards,
    Vvieks
    Note : If you have any specific requirement then pls let us know , we will guide you

  • I redirected iTunes to an external drive and moved my iTunes library and folder, but my hard drive is still low on space.  How can I be sure that my music is all on the external HD ONLY, especially with the new iCloud technology?

    I redirected iTunes to an external drive and moved my iTunes library and folder, but my hard drive is still low on space.  How can I be sure that my music is all on the external HD ONLY, especially with the new iCloud technology?  It doesn't look like I created any more space by doing this, AND I totally lost all my iTunes playlists.  I'm not sure if because I added old library materials manually if this messed up my playlists, or if the new location is just not reading my moved library.  In any case, I followed step by step instructions and found a few holes and thought I'd just "figure it out" but I guess I'm not as smart as I thought since I'm still scratching my head many hours later.
    Thanks for any support ;-)
    Eaglerocker

    Quick answer if you use iTunes' default preferences settings:  Copy the entire iTunes folder (and in doing so all its subfolders and files) intact to the other drive.  Open iTunes and immediately hold down the option (alt) key (shift on Windows) so you get a prompt to select a library, then guide it to the 'iTunes Library.itl' file in the moved iTunes folder.
    If this is to a new computer and you put the copied iTunes folder in the default location of Macintosh HD > Users > *User Name* > Music  then you don't even need to start with the option key held down, iTunes will automatically look for it there.  (Make sure there isn't anything already in the iTunes folder there that you want to keep since you will be replacing it with the one you are moving.)
    iTunes: How to move [or copy] your music [library] to a new computer [or another drive] - http://support.apple.com/kb/HT4527 - a somewhat bewildering and not always easily understandable set of options.

  • How can I sort files in a folder by name?

    How can I sort files in a folder by name? iFS first sort files that starts with upper-case letter and then files with lower-case letter.
    Like:
    A_file
    B_file
    a_file
    b_file
    I want:
    A-file
    a_file
    B_file
    b_file
    This doesn't help:
    String[] sort_attributes = {"NAME"};
    boolean [] sort_orders = {true};
    SortSpecification sort = new SortSpecification(sort_attributes, sort_orders);
    currentFolder.setSortSpecification(sort);
    Do I have to get all items in a folder and then sort them?
    /Elin

    I do not think there is a way to do that without add-ons
    There are a couple of workarounds I am aware of
    * Add the bookmarks manually in the bookmarks library and choose the position. That is using Show all bookmarks -> open required folder -> select a position and right click -> add new bookmark <br />Rather a slow and clumsy process
    * Sort a folder and copy it. If you sort the folder contents then copy and paste them they remain in that order when pasted.
    There are add-ons but I have not tried them. For example
    * https://addons.mozilla.org/firefox/addon/simplesort-bookmarks/
    * https://addons.mozilla.org/firefox/addon/auto-sort-bookmarks/
    There will be others available and take note of the advice to backup bookmarks manaully.
    * [[Restore bookmarks from backup or move them to another computer#w_manual-backup]]_manual-backup

  • HT1660 how can I use one single library for all users on the same laptop?

    how can I use one single library for all users on the same laptop?

    You are most of the way there. Each user having access to hard drive is the key. If users are limited in file privileges this is harder.
    Any files you add to your library and any files she adds to her library are available to the other. Just not automatically. Each user must add the files to their own library using the add file or add folder option from menu bar.
    What I have done is set library location to a location outside of My Documents\My Music. On my network storage I have a folder names s:\itunes. Both accounts iTunes are set to use this location for the library.

  • How Can I print Oracle Report 9i directly To Printer on the local network?

    Dear All;
    How Can I print Oracle Report 9i directly To Printer on the local network?
    or to any other computer ? or to my default printer without prevoiues know the printer name i mean found it in my connected printer?
    plear help me?
    Best Wishes

    1. Check documentation for DESNAME and DESTYPE
    2. See 1 as long as they are a shared resource
    3. Think you must know the name, but please check or documentation
    Regards,
    Martin
    PS. There's a Reports Forum here which would be a better option for posting this question

  • How can i open a DOC or TXT file and insert the data into table?

    How can i open a DOC or TXT file and insert the data into table?
    I have a doc file . the doc include some columns and some rows.(for example 'ID,Name,Date,...').
    I'd like open DOC file and I'd like insert them into the table with same columns.
    Thanks.

    Use the SQL*Loader utility or the UTL_FILE package.

Maybe you are looking for

  • Error code 11 when trying to open .indd file

    Im having a small issue opening certain .indd  files, they were working fine when i tried to view them earlier in the week. When i double clicked to open them today, i got a small box saying " configuration error, uninstall and reinstall and it shows

  • Vista UAC - handle privileges elevation

    Hi guys, I've been having some trouble with one of the application I have to maintain. Some things that might be needed in order to understand my needs: - it is a java web start application - it embbeds a few Windows applications that we did not deve

  • Problem inserting data into database (increment problem)

    I have a servlet page that gets various data from a bean and executes multiple SQL statements to store this data. Beacuase i want to insert data into a number of tables that are related with a one to many relationship I am not using the auto incremen

  • PSE9 & Win 8 - Get download failed messages when I update

    I deinstalled PSE9 from my Win XP,installed in Win 8 and get download failed messages when I update (to 9.0.3 & Camera Raw 6.5). Pressing the error message i get to a screen 'Error "This serial number is not for a qualifying product..." when installi

  • PPM 5.0 - Navigation

    Hi,           I created a new Launchpad in the IMG activity Setup New Launchpad. The role I used is RPM_RIH, Instance is "Workcenter". I created a new application and associated it to a URL. In the workcenter for Portfolio items, I was able to see th