Fixed writing the length of records from flat file

Hi all
I have a program to write the table data to a file. The sql for this code might look as below:

for r in select * from tablexx partition (partn_nm)
loop
UTL_FILE. PUT_LINE (V_FILE, V_BUFFER);
end loop;

The problem is with the name of patition. This is not a fixed value, and continues to change.
How can I change the name of the partition on the fly. Something like

v_part_nm: = 'JAN2008;
for r in select * from tablexx partition (v_part_nm)
loop
UTL_FILE. PUT_LINE (V_FILE, V_BUFFER);
end loop;

Please give suggestions...

Thank you

Published by: user627047 on March 23, 2010 01:16

user627047 wrote:
I fight to keep away the comma in the data file. My code is as below

open SQL_CUR for q'X SELECT rpad(C_GRP_PROD,3)||','|| rpad(N_ACCT,23)||','||rpad(to_char(N_CUST)            from TRMD501_BAK partition( X'||V_DROP_PARTN_NM||')'    ;
loop
fetch SQL_CUR into V_BUFFER;
exit when SQL_CUR%notfound;
utl_file.put_line(V_FILE, V_BUFFER);
V_LINES := V_LINES + 1;
end loop;

Can someone tell me please how to write a record length of fiixed without commas.

Thank you

UH... maybe try to take the commas out of it?  :|

 open SQL_CUR for q'X SELECT rpad(C_GRP_PROD,3,' ')||rpad(N_ACCT,23,' ')||rpad(to_char(N_CUST),10,'') from TRMD501_BAK partition( X'||V_DROP_PARTN_NM||')'    ;
                loop
                        fetch SQL_CUR into V_BUFFER;
                        exit when SQL_CUR%notfound;
                        utl_file.put_line(V_FILE, V_BUFFER);
                        V_LINES := V_LINES + 1;
                end loop;

Tags: Database

Similar Questions

  • How to move data from flat file to the repository of execution

    Hi all

    We have 2 instances

    1. development - we are able to move the data from flat file to target the DB using scenario1.

    The files are in 04 who's ODI installation box


    2. enforcement Repo

    to scenario1 execution repo installed in ODI 07 which is ODI installation box
    but not able to move the data from flat file to target DB.

    We get an error - file not found.

    File is located in the box 04.

    My question is that what is the best process to make scenario1 course migrated to work.

    Appreciate your help.

    I wanted to say that in view of the dev and prod in the Prod repository agent is not a good idea.

    Ideally, in repo Prod, you must have prod 07 agent.

    In Dev Repo, you shouldn't have dev 04 agent

    makes sense

  • Remove the read-only attribute from all files in a folder

    How to remove the read-only attribute from all files in a folder. I tried to use the properties and used the attrib command, but all I see is when I right click on the folder, selecting Properties, it shows once again

    I followed the forums, but I'm really confused. Can someone help me with this. Thanks in advance

    I would like to start by finding which file is read-only again. This is probably a file as well as a miniature file desktop.ini.  An easy way to find it is to go to the details view, turn on the column heading "Attributes" and search for all files with the attribute value "R":

    In this example, the key of SB file is read-only:

  • How to change the number of records from the 25 to the different number?

    Hi friends...
    Generally, table 25 records at a time, and if registration exceeds the number there is a next button appears below the table. I need to change the number of records? Help, please.

    Thank you

    Hello...

    Try this, in the instanceconfig.xml file,



    50

    It works...

    Thank you & best regards
    Kishore Guggilla

  • Create scripts to populate tables from flat files

    Hello

    How can I create scripts to complete the flat files using pl/sql tables.

    Kindly help me.

    Kind regards

    Prasad K T,.

    9840021070

    Hi PrasadKT,

    As Tsharma pointed out just save the .xls (or xlsx) file in the .csv file.

    Please see steps that I show below...

    My XLS file looks like this... (I wish I could paste pictures here :-()

    1 AAA JJJ QQQ 23.2
    2 BBB ASDA QQQ 12.111
    3 CCBC ERTE WER 10
    4 FFFFFFF ASDA GODSWILL 0
    5 YY DDD SNOW DEPOSITS 12

    Once saved as CSV (separator: semicolon) (*.csv) the contents of the file in Notepad looks like this...

    1, AAA, DDD, QQQ, 23.2

    2, BBB, ASDA, QQQ, 12.111

    3, FCCC, ERTE, wer, 10

    4, FFFFFFF, ASDA, GODSWILL, 0

    5, YY, DDD, MALDINI, 12

    Create a directory in Oracle... (This must be SYSDBA user)

    > create or replace directory xtern_data_dir as 'C:\TEMP '.

    Created XTERN_DATA_DIR directory.

    > grant read, write on directory xtern_data_dir to HR

    Grant succeeded.

    Log in HR (or normal user) and create an external table... If you are running on ODCIEXTTABLEOPEN error, please make sure that the user of the OS which launched the Oracle process has READ/write permission on the directory of the OS

    > left autotrace

    People with disabilities autotrace

    > drop table xtern_table

    table deleted XTERN_TABLE.

    Elapsed time: 00:00:00.052

    > create table xtern_table

    (varchar2 (10) c1,)

    C2 varchar2 (10),

    C3 varchar2 (10),

    C4 varchar2 (5).

    C5 varchar2 (10)

    )

    external organization

    (type ORACLE_LOADER default directory xtern_data_dir

    access settings

    (fields ended by ',')

    MISSING FIELD VALUES ARE NULL

    REJECT ROWS WITH ALL FIELDS are NULL (c1, c2, c3, c4, c5)

    )

    location ("mycsv.csv")

    )

    table created XTERN_TABLE.

    Elapsed time: 00:00:00.013

    > proprietary format of col A10

    > col format a20 directory_name

    > select master, SYS.all_directories directory_name

    OWNER NOM_REPERTOIRE

    ---------- ----------------------------------------

    SYS EXT_INPUT

    SYS XTERN_DATA_DIR

    Elapsed time: 00:00:00.014

    > select * from xtern_table

    C1 C2 C3 C4 C5

    ---------- ---------- ---------- ----- ----------

    1 DDD AAA QQQ 23.2

    2 BBB ASDA QQQ 12.111

    CCBC ERTE wer 10 3

    FFFFFFF ASDA GODSWILL 4 0

    5 AA JJJ SDFS 12

    Elapsed time: 00:00:34.419

    I hope this helps.

    VR

    Sudhakar

  • Error compiling FPGA-61332: the length of a line to < "file.vhdl" > is too long for xilinx 10.1. Length: < length > Max Length: 4150

    Hello

    When compiling a fairly basic FPGA VI, I get the following error:

    61332 error occurred in niFpgaCompileWorker_ProcessStatusPipe.vi:1<><>

    Possible reasons:

    LabVIEW FPGA: An unexpected error occurred with the build tools. You try to compile the FPGA VI again could solve the problem.

    The length of a line in "NiFpgaAG_0000002e_WhileLoop.vhd" is too long for xilinx 10.1. Length: 32845 Max length: 4150

    Departure time: 17:22:06
    End time: 17:22:12
    Total time: 00:00:06

    Apparently, the vhdl code generator OR forgot to add some CR + LF in the intermediate files. How to work around this bug?

    Kind regards

    Lukas

    Hi Lukas.

    When LabVIEW compiles a VI, the VI is converted into virtual hard disk to be compiled into a file bit by Xilinx.  As you have already understood, this error indicates that a line of code vhd had a length of 32 845 characters, which exceeds the maximum length of 4150 characters for the Xilinx 10.1.

    Although 32 845 characters is very long, it is possible that this is due to the codification of LabVIEW rather than a bug. Some common causes of this problem include large enums, a matrix, or clusters in the code.  Please check in your code.  If you have no luck, please attach a screenshot of the code.  I hope this helps!

    Kind regards

    Dayna P.

    Technical sales engineer

    National Instruments

  • How to export data from flat file with ODI DB?

    We want to export flat files DB2 tables.
    Who can tell me how to do it with ODI?
    Please give me a simple example or steps.
    Thank you.

    There are two ways

    Either use IKM Sql to add files

    (or)

    OdiSqlUnload
    For OdiSqlUnload, you can use this technique to provide the connection parameters - http://odiexperts.com/?p=1985

  • How can I add a background to a video of the screen I recorded from my iPhone in iMovie?

    I recorded a record on my iPhone using my macbook and quicktime on the screen. When you change this video in iMovie how can I add a background on the left and right sides. I want the prettier for downloading Youtube video.

    Thank you

    Brandon

    Have you tried the image of image in iMovie?

    You could add the background element you want the main video track, then drag your recording on the screen the second piece with overlays. Select the effect of the image in the image, and then drag the corners resize to adjust the size of your video clip:

  • Satellite A500 PSAR9E: webcame did not save the length of recorded videos

    I have a big problem with the webcam of Toshiba. 4 important videos I recorded with my laptop have duration of 10 hours, but when I try to play the video, it's playing 6 minutes, or in the game 7: 00 another - it is
    instead of ten?

    How is this possible, please help! Other 10 videos that have duration of 13hrs are very well and when he plays everything is OK, but I don't understand what's happened with these 4 videos?

    My laptop drivers are all up to date, Windows 7 original...

    Please help, it is very urgent and important :(
    Is it possible to restore these videos somehow?

    Post edited by: anaa0405

    > I have other video files recorded (35) in the same way, and there is no problem with them... Only with this 4 which are very important...

    Sorry, but don t think someone could help you in this case, it seems that the registration process has been closed and disabled but who knows why maybe that the software does not more while recording, it seems that it was a software related issue

  • I'm having a difficult time to audio from the videos I recorded from my camera

    I have recorded 4 videos using my camera Sony Cybershot DSC - P71 yesterday. I tried EVERYTHING to hear the sound that was recorded with my video. Can you help me with this?

    Well, after some research on the camera, I came to realize that it has no audio capabilities! Boo I say! Laughing out loud.

  • reading the images and icons from jar file

    Hello
    I applied the tutorial in the corner of the adf
    [read the image of the jar file | http://www.oracle.com/technetwork/developer-tools/adf/learnmore/86-images-from-jar-427953.pdf]
    and deploy it in logical built-in web server
    my version 11.1.2.3 Jdeveloper

    but the images did not appear
    For example: when I drag the button and try to specify icon for this button no image for the library referance

    How can I fix this problem or missing steps in the application of the link above?
    Thank you

    I just ran this tutorial recently, took a few tries but everything worked according to the instructions in the article. You should check your steps on. set install to the top of the jar, add it to the project lib reference and use "/ adf/images / ' as the value of the icon. That should be all you need to do at the moment of the conception of the image displayed when running, you need to install the pot to your embedded wls and also change your weblogic - application.Xml.

  • How to extract more than a records from xml file

    I want to extract several records in the xml file

    Now, I'm able to extract only one record at a time
    using the

    Select xmltype(transaction_document).extract('//IrcPostingContentsVlEORow/CreationDate/text()').getStringVal (CreationDate)
    of hr_api_transactions
    where transaction_ref_table = 'PER_ALL_VACANCIES. '
    and transaction_ref_id = 4693;
    How can I find or retrieve multiple records?

    Hello

    and appear in several places in the document, please be specific.
    Ideally give the full path to access the data.

    It goes the same for : want you PerRequisitionsEORow or PerAllVacanciesEORow?

    Here's an overview of what you can do, assuming that you want the data from the PerAllVacanciesEORow element:

    select x.*
    from hr_api_transactions t,
         xmltable('//PerAllVacanciesEORow'
                  passing xmltype(transaction_document)
                  columns requisition_id  number        path 'RequisitionId',
                          organization_id number        path 'OrganizationId',
                          name            varchar2(100) path 'Name',
                          creation_date   varchar2(30)  path 'CreationDate'
                 ) x
    where t.transaction_ref_table = 'PER_ALL_VACANCIES'
    and t.transaction_ref_id = 4693
    ;
    
    REQUISITION_ID ORGANIZATION_ID NAME                 CREATION_DATE
    -------------- --------------- -------------------- -----------------------
              7471                 yogesh               2011-01-29 20:01:57.0
    
  • In the project manager, records under HTML files are duplicated in the Images, multimedia, records of luggage and Style sheets. -What happened? Duplicate folders and subfolders are empty, but cannot be deleted.

    I am using HR 11.0.4.291. Everyone knows that before (see screen capture)? I want to solve this problem, if I leave it for the writers of the future tech. Any suggestions are appreciated.

    Oh, and it occurs to me that article I have driven you is old enough (but still relevant).

    The "fix" for it is click on the icon below to toggle the display of the project manager.

    See you soon... Rick

  • unification of withdrawal and the volume of noise from multiple files

    Hello

    Say that I have recorded 5 conferences for a speaker in the same room but different days and now I want to combine 5 conferences into one large audio file.

    1. do you recommend I noise removal for each conference separately then I sting in one big file, or I join them all in one big file, and noise removal on the large file that result?
    2. According to my relevant place to the speaker registration for the day 1 for example was stronger than day 2 so when I join the 5 conferences that do to unify the "volume"and make sure that it appears as if it were a long conference with consistency in the voice.

    Note: it is the same speaker in this same room days 5

    My apologies for the long questions and I thank you all in advance for your kind help

    If you have moved against the speaker, then probably noise is not quite the same thing. So, I would take a sample of distinct noise for each lesson and do them individually. When you have done that, it should be a simple matter to standardize each file for the same peak level (by example, - 1 dB) and then the content of each will be substantially the same, although the conditions of a room can make a small difference to this. Not so many things that it must be a problem however.

    After that, you can attach files, using open > add and save the result.

  • How to load the date and time from text file to oracle using sqlloader table

    Hi friends

    I need you to show me what I miss loading date and time text file in a table oracle using sqlloader

    It's my data in this way (c:\external\my_data.txt)
    7369,SMITH,17-NOV-81,09:14:04,CLERK,20
    7499,ALLEN,01-MAY-81,17:06:08,SALESMAN,30
    7521,WARD,09-JUN-81,17:06:30,SALESMAN,30
    7566,JONES,02-APR-81,09:24:10,MANAGER,20
    7654,MARTIN,28-SEP-81,17:24:10,SALESMAN,30
    my table in the database emp2
    create table emp2 (empno number,
                      ename varchar2(20),
                      hiredate date,
                      etime date,
                      ejob varchar2(20),
                      deptno number);
    the code for the control in this path (c:\external\ctrl.ctl) file
    load data
     infile 'C:\external\my_data.txt'
     into table emp2
     fields terminated by ','
     (empno, ename, hiredate, etime, ejob, deptno)
    This is the error:
    C:\>sqlldr scott/tiger control=C:\external\ctrl.ctl
    
    SQL*Loader: Release 10.2.0.1.0 - Production on Mon May 31 09:45:10 2010
    
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    
    Commit point reached - logical record count 5
    
    C:\>
    any help that I enjoyed

    Thank you

    Published by: user10947262 on May 31, 2010 09:47

    load data
    INFILE 'C:\external\my_data.txt '.
    in the table emp2
    fields completed by «,»
    (empno, ename, hiredate, etime, Elysa, deptno)

    Try

    load data
     infile 'C:\external\my_data.txt'
     into table emp2
     fields terminated by ','
     (empno, ename, hiredate, etime "to_date(:etime,'hh24:mi:ss')", ejob, deptno)
    

    This is the error:

    C:\>sqlldr scott/tiger control=C:\external\ctrl.ctl
    
    SQL*Loader: Release 10.2.0.1.0 - Production on Mon May 31 09:45:10 2010
    
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    
    Commit point reached - logical record count 5
    
    C:\>
    

    This isn't a mistake, you can see errors in the log file and bad.

Maybe you are looking for

  • App opens each time I have unlock my phone

    I have an iPhone running iOS 10 6 and I have dealt with this problem since I have updated my phone last week. Whenever I have unlock my phone, it automatically opens the Drive app on my home screen. I replaced Google Reader with the Linkedin app for

  • Ask me if I want to really close when I download something

    HelloI used to download large files (up to 2-3 GB) in time while I'm browsing the internet, and sometimes I just forget that I am downloading and close Firefox. 3 months ago at the time when I was using Windows 7 I didn't have the problem of losing m

  • My photos have disappeared from iPhoto

    I worked with my photos in iPhoto, the night last and this morning. Was having some issues when you try to send or share one of my albums to iCloud. This morning, he left unexpectedly and when I opened it, it says it must rebuild. After more than an

  • It is a solution - how to install XP on Satellite L40

    NOTE: you will need a license for XP Pro SP2(it should work with Sp1 and Home, but runs better on Pro SP2)! First download and install nLite. http://www.nliteos.com/download.html (requires .NET Framework version 2.0, you can download .NET Framework f

  • problema stop corretto corretto Moussa pianifico quando a riavvio

    Ciao ragazzi,.Ho ESXi 6 All version, compresi i vmtools qnd faccio aggiornato a riavvio dell'host, macchine virtuali TR spengono, my spengono if in modo UN po strano, nel senso che nel giro di some istante TR spegne, ed'e impossibile procedure di spe