N-m mapping generates blobs in ref-table

Why generates the schematool blobs in the reference-table of a n-m mapping?
I want to map an existing schema and this isn't possible with blobs. I
expected a table with the primary-keys of each class.

Abe White wrote:
Why generates the schematool blobs in the reference-table of a n-m mapping?
I want to map an existing schema and this isn't possible with blobs. I
expected a table with the primary-keys of each class.
Kodo fully supports n-m and m-m mappings. If you post your .jdo files and
describe your schema somehow we can probably help you find out where the
problem lies.Hello,
here I send you a short and useless example which contains
my two problems:
- n-m mapping generates blobs in ref-table
- multi-table inheritance mapping
This are my classes:
Class Person
String firstname
String lastname
Class Employee extends Person
long personalNumber
Collection memberOf ( TYPE Project )
Class Project
String projectname
Collection members ( TYPE Employee )
The jdo-metadata:
<?xml version="1.0"?>
<jdo>
<package name="test">
<class name="Person" identity-type="application"
objectid-class="PersonPK">
<extension vendor-name="kodo" key="table" value="DB_PERSON" />
<extension vendor-name="kodo" key="lock-column" value="VERSION_ID" />
<extension vendor-name="kodo" key="class-column" value="none" />
<field name="firstname" null-value="exception" primary-key="true">
<extension vendor-name="kodo" key="data-column"
value="FIRSTNAME_TXT" />
<extension vendor-name="kodo" key="column-length" value="50"/>
</field>
<field name="lastname" null-value="exception" primary-key="true">
<extension vendor-name="kodo" key="data-column"
value="LASTNAME_TXT" />
<extension vendor-name="kodo" key="column-length" value="50"/>
</field>
</class>
<!-- I tried both -->
<!-- <class name="Employee"
persistence-capable-superclass="test.Person"> -->
<class name="Employee" identity-type="application"
objectid-class="PersonPK" persistence-capable-superclass="test.Person">
<extension vendor-name="kodo" key="table" value="DB_EMPLOYEE" />
<extension vendor-name="kodo" key="lock-column" value="VERSION_ID" />
<extension vendor-name="kodo" key="class-column" value="none" />
<field name="personalNumber" null-value="exception">
<extension vendor-name="kodo" key="data-column"
value="PERSONAL_NUM" />
</field>
<field name="memberOf" null-value="none">
<extension vendor-name="kodo" key="inverse" value="members" />
<extension vendor-name="kodo" key="table"
value="DB_EMPLOYEE_PROJECT_REF" />
<extension vendor-name="kodo" key="projectname-data-column"
value="PROJECT_NAME" />
<extension vendor-name="kodo" key="firstname-ref-column"
value="EMPLOYEE_FIRSTNAME" />
<extension vendor-name="kodo" key="lastname-ref-column"
value="EMPLOYEE_LASTNAME" />
</field>
</class>
<class name="Project" identity-type="application"
objectid-class="ProjectPK">
<extension vendor-name="kodo" key="table" value="DB_PROJECT" />
<extension vendor-name="kodo" key="lock-column" value="VERSION_ID" />
<extension vendor-name="kodo" key="class-column" value="none" />
<field name="projectname" null-value="exception" primary-key="true">
<extension vendor-name="kodo" key="data-column" value="NAME_TXT" />
<extension vendor-name="kodo" key="column-length" value="50"/>
</field>
<field name="members" null-value="none">
<extension vendor-name="kodo" key="inverse" value="memberOf" />
<extension vendor-name="kodo" key="table"
value="DB_EMPLOYEE_PROJECT_REF" />
<extension vendor-name="kodo" key="firstname-data-column"
value="EMPLOYEE_FIRSTNAME" />
<extension vendor-name="kodo" key="lastname-data-column"
value="EMPLOYEE_LASTNAME" />
<extension vendor-name="kodo" key="projectname-ref-column"
value="PROJECT_NAME" />
</field>
</class>
</package>
</jdo>
Kodo generates this db-schema:
Table db_person
Column VERSION_ID ( Type int(11) )
Column FIRSTNAME_TXT ( Type varchar(50) ) <PrimaryKey>
Column LASTNAME_TXT ( Type varchar(50) ) <PrimaryKey>
Table db_employee
Column PERSONAL_NUM ( Type bigint(20) )
Table db_project
Column VERSION_ID ( Type int(11) )
Column NAME_TXT ( Type varchar(50) ) <PrimaryKey>
Table db_employee_project_ref
Column MEMBERSX ( Type blob )
Column MEMBEROFX ( Type blob )
I expected this:
Table db_person
Column VERSION_ID ( Type int(11) )
Column FIRSTNAME_TXT ( Type varchar(50) ) <PrimaryKey>
Column LASTNAME_TXT ( Type varchar(50) ) <PrimaryKey>
Table db_employee
Column PERSONAL_NUM ( Type bigint(20) )
**** I think Kodo needs this reference to the base-class ****
Column FIRSTNAME_TXT ( Type varchar(50) ) <ForeignKey>
Column LASTNAME_TXT ( Type varchar(50) ) <ForeignKey>
Table db_project
Column VERSION_ID ( Type int(11) )
Column NAME_TXT ( Type varchar(50) ) <PrimaryKey>
Table db_employee_project_ref
**** the mapping should use the primary keys, no blobs ****
Column EMPLOYEE_FIRSTNAME ( Type varchar(50) ) <ForeignKey>
Column EMPLOYEE_LASTNAME ( Type varchar(50) ) <ForeignKey>
Column PROJECT_NAME ( Type varchar(50) ) <ForeignKey>

Similar Messages

  • How to generate report from two tables using DAO design pattern?

    Hi,
    Iam using struts with DAO pattern for my application. According to DAO design im creating model class for each table in my database with getter,setter methods. i have no problem when im generating report from one table. but if have i have to join two tables whatis the better way for doing that? is it good practise to create a new model contains properties from both the tables?
    Please help me
    Thanks in Advance
    Rajesh

    Dear Rajesh,
    As per the pattern you are creating equivalent java objects for every database table under consideration in which each db field will become a private attribute and public getter and setter methods.
    If you have to display data from one table the above approach is sufficient enough.
    But in case your database is normalised ..lets take an example of Bank having Branch and Accounts tables. We dont need to repeat the whole information of the branch for every account in that branch. so we prefer to have a branch id in that table....this approach lot of insertion/deletion/updatation anomlies that may exists with the database...
    now lets come back to our topic....we shall create two java objects 1) Branch 2) Account.....
    When ever u just need to display simple report u can do it staright forward,,,,,now if u want to display branch information along with the account information....the two objects just created are not sufficient
    So i suggest u the following approaches
    1) Create an attribute of type Branch in the Accounts Object......
    This shall serve the purpose of displaying the Btranch information
    2) Create a collection object of type ( Vector or ArrayList) which can have objects of Account in the Branch Object,,,
    Now its upto u how shall u fill up the objects with appropriate sql queries.
    The method that i mentioned is followed by Oracle Toplink and Hibernate ....which provide Object to relation mapping layers.
    Any queries ...revert back to me...
    Mahesh

  • Downloading BLOB from a table.

    Hello,
    First I want to say thatnks for such a great tool like HTMLDB.
    Question is:
    How do I download BLOB from a table. What I am trying to do is. I am uploading files to a default HTMLDB location (wwv_flow_file_objects$) and moving the records to different table (delete file from wwv_file_objects$). Then I would like to be able to download that blobs from a DB by following some link. And I need it to be secure, user have to authenticate to do it. I got to the point where I created process (before header) to download the file. But I am having hard time passing some variables to that process in URL. Can some one advice me on the best practice of doing it. And also if it is a right thing to use before header process to put my own header and start uploading blob in html db. The main reason I do not whant to use DAD for that is simple security issue and ability of storing of the BLOBs only in one table. I prefer to upload it to a temporary location and then move it to other table(s). Then I need to be able to retriev the files back from those tables without moving them around.
    Any help is greatly appriciated

    i think i see what you're asking, but i'll step through the pieces just to make sure i cover your issue:
    it sounds as if you have a procedure that successfully calls wpg_docload.download_file to get your blob out of your images table. for this explanation, lets just say your images table has the same table structure as wwv_flow_files created with something like...
    create table myfiles as select * from wwv_flow_files where rownum < 3;
    ....and let's say your download proc that passed the blob from your myfiles table to wpg_docload.download_file looked something like...
    create or replace procedure getmyfile(
    p_id in varchar2,
    p_mime_type in varchar2 default null)
    as
    l_lob blob;
    l_mimetype varchar2(48);
    l_mime_charset varchar2(255);
    l_filename varchar2(400);
    begin
    select mime_type, blob_content, filename, file_charset
    into l_mimetype, l_lob, l_filename, l_mime_charset
    from myfiles
    where id = p_id;
    if l_mime_charset is not null then
    owa_util.mime_header( l_mimetype, FALSE, l_mime_charset );
    else
    owa_util.mime_header( l_mimetype, FALSE );
    end if;
    htp.p('Content-length: ' || dbms_lob.getlength( l_lob ));
    htp.p('Content-Disposition: attachment; filename="' ||
    wwv_flow_utilities.escape_url( p_url => l_filename, p_url_charset => 'utf-8') || '"');
    owa_util.http_header_close;
    wpg_docload.download_file( l_lob );
    end;
    ...then it sounds as if this is where you start running into issues. to be able to call this procedure from the url, you'd have to grant execute on your getmyfile proc to the db user that your modplsql DAD uses to access your db. once that user was given access to run getmyfile, you could access your files in myfiles by calling a URL like...
    http://myserver.com/pls/mydad/myschema.getmyfile?p_id=1005529367869246
    ...where p_id is the unique id associated with your blob in getmyfiles (you could, of course, use whatever method you want to uniquely identify that file and adjust your select-into statement w/in your getmyfile procedure). so that's all fine and dandy, but it sounds as if you want users to have to authenticate into your html db application before they can access a blob in your images table. it also sounds as if you're on the right track to do so by putting your procedure call in a before_header html db process. you could quite easily call your getmyfile procedure in such an html db pl/sql before_header process with something like...
    begin
    getmyfile (p_id => 1008411584930314);
    end;
    ...which would cause your page to just show the blob associated with the id you passed to getmyfile. because you're now accessing your blob table through html db parsing as your application schema owner, you'd no longer need to grant execute on getmyfile to your modplsql DAD's db user. that eliminates most of the security hole to which you were referring. now that you're calling getmyfile from w/in an html db process, you can take advantage of all the other html db perks such as applying conditions and an authorization scheme to the html db process to really lock things down. finally, you asked about firing your process before_header versus other firing points. before_header is a good way to go, but if you really wanted to execute other procedural logic on your page before showing the blob (and you didn't want to implement that code as before_header processes that fire sequentially before your getmyfile call),you could just throw an htp.init in right before your getmyfile call to clear out your http buffer like so...
    begin
    htp.init;
    getmyfile (p_id => 1008411584930314);
    end;
    ...hope this helps,
    raj

  • Mapping from nested to one table (sales order) XML to IDOC

    Hello,
    I have to map a xml file to the IDOC SALESORDER_CREATEFROMDAT2.SALESORDER_CREATEFROMDAT202.
    How I can map the the longtext from the XML file to the IDOC struktur.
    Part of the XML file, there could be n times BPosition with n times longtext. The longtext must be map with a table. I some case its a mapping from nested to mornal table.
        <BPosition>
             <lpos>1</lpos>
             <bbl_sap_nr/>
             <milvonr/>
             <kurztitel/>
             <anzbest/>
             <anzliefer/>
             <kostenpflichtig/>
             <longtext>
                <line>pos1 zeile1</line>
                <line>pos1 zeile 2</line>
             </longtext>
          </BPosition>
    thanks for your help.

    Hi, I have to map this 1 XML to 1 IDOC
    XML:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MT_Milver xmlns:ns0="http://ccssap.bfi.admin.ch/milver">
       <bestellung>
          <besteller>
             <bestellnr/>
             <auftragdefit/>
             <wempfdebit/>
             <bestelldat/>
             <lieferdat/>
             <anzpos/>
             <language/>
             <adrzeile1/>
             <adrzeile2/>
             <adrzeile3/>
             <adrzeile4/>
          </besteller>
          <Kopf>
             <Lkopf>Kopf1 zeile1</Lkopf>
             <Lkopf>Kopf1 zeile2</Lkopf>
          </Kopf>
          <BPosition>
             <lpos>1</lpos>
             <matnr/>
             <milvonr/>
             <kurztitel/>
             <anzbest/>
             <anzliefer/>
             <kostenpflichtig/>
             <bemerkung>
                <line>pos1 zeile1</line>
                <line>pos1 zeile 2</line>
             </bemerkung>
          </BPosition>
          <BPosition>
             <lpos>2</lpos>
             <matnr/>
             <milvonr/>
             <kurztitel/>
             <anzbest/>
             <anzliefer/>
             <kostenpflichtig/>
             <bemerkung>
                <line>pos2 zeile1</line>
                <line>pos2 zeile 2</line>
             </bemerkung>
          </BPosition>
       </bestellung>
    </ns0:MT_Milver>
    IDOC:
    The Idoc have a segment for the longtext (table).I have to map, lpos, line into  E1BPSDTEXT from SALESORDER_CREATEFROMDAT2. Its now more clear?

  • Map FLAT file to oracle table using 9.04 version - PLS HELP!!!!

    Hello all
    I am having a problem with mapping a flat file to oracle table. The validation is successful, when I go to Project/Deployment manager. Try to deploy the mapping itself and the target table. It said succesful, and the last step is another "Deploy", this one is fail. Saying could not locate the file (which is a flat file) , but it is there on the server.
    I have read all the help on line and follow what they show me, but still not work
    Any ideas? Please provide detail answer if you know it.
    Thank in advance

    Hallo,
    just give a rights on connector
    Variant 1
    1. connect to user sys
    2. grant read,write on directory <connector_name> to <target_schema>;
    or
    Variant 2
    1. as user sys or system give CREATE_ANY_DIRECTORY to <target_schema>
    2. manualy make CREATE DIRECTORY <connector_name> as '<full_path_to_directory>';
    and enjoy :)
    PS: <connector_name> you can take from script CREATE_TABLE wisch in Generation phase was created!
    Kirill

  • Need help on Inbound Delivery - Mapping from IDoc to LIKP Table

    Hi,
    For the DESADV IDoc (Inbound Delivery) we are currently mapping data to the LIKP table for a subset of fields via  function module INPUT_IDOC_DESADV.  If I wanted to map the ABLAD - Unloading Point field from the IDoc to the LIKP - ABLAD - Unloading Point field is this possible and if yes, what work would be required? 
    And could you please let me know how to find out an user exit for the message type? (message type = desadv)

    Hi Murphy,
    Try this custom function '002'.
    CALL CUSTOMER-FUNCTION '002'
           EXPORTING
                xekko     = ekko
                xlfa1     = lfa1
                xlfb1     = lfb1
                dobject   = object
           TABLES
                int_edidd = int_edidd
                xekpo     = xekpo
                xeket     = xeket
                dvbak     = xvbak
                dvbap     = xvbap
                dvbkd     = xvbkd
           EXCEPTIONS
                error_message_received        = 1
                data_not_relevant_for_sending = 2.
    Hope this will help.
    Regards,
    Ferry Lianto

  • Loading a BLOB to a table, using webutil

    Is there somewhere I can see a comprehensive example of loading a BLOB to a table, using webutil. That is where the user browses and selects a picture (or whatever) from the client machine, and then the file is loaded to the database.
    Thanks, Wayne

    Hello,
    <p>You can inspire from this article.</p>
    Francois

  • How to move BLOBs from one table to another ??

    Hi All,
    I am trying to move blobs from one table to another, however my insert statement is not working. What i mean is its running, but records are not being inserted into the table.
    This is my first time moving blobs, so please bear with me.
    here is my insert statement:
    INSERT INTO CASES.FILESTORAGE
    SELECT      DID,
              DRENDITIONID,
              DLASTMODIFIED,
              DFILESIZE,
              DISDELETED,
              BFILEDATA       // this attribute is the BLOB
    FROM      USSC_CASES_TMP.FILESTORAGE
    WHERE      DID NOT IN (SELECT DID FROM CASES.FILESTORAGE);here is the DDL for the table.
    CREATE TABLE "USSC_CASES_TMP"."FILESTORAGE"
        "DID"          NUMBER(*,0) NOT NULL ,
        "DRENDITIONID" VARCHAR2(30 CHAR) NOT NULL ,
        "DLASTMODIFIED" TIMESTAMP (6),
        "DFILESIZE"  NUMBER(*,0),
        "DISDELETED" VARCHAR2(1 CHAR),
        "BFILEDATA" BLOB,
        CONSTRAINT "PK_FILESTORAGE" PRIMARY KEY ("DID", "DRENDITIONID")
      );CASES.FILESTORAGE table has the same DDL, but in a different schema.
    Thanks in advance.

    If this seems rather straight forward. If the schema are exact simply execute:
    inset into [destination] select * from [source] ;if something is amiss you should be throwing errors someplace* but try this:
    create table [scratch table name] as select * from [source table] where [place some limit here] ;If this does not work then something someplace is very wrong and if you are not the DBA you need to get this persons attention, fairly quickly. I would do the above from sqlplus and then after each statement would:
    commit;then check to see if it succeeded.

  • Mod_plsql: ORA-942 Execute(Temp BLOB) ORA-00942: table or view does not exi

    mod_plsql: ORA-942 Execute(Temp BLOB) ORA-00942: table or view does not exist
    This is the error I get in the Apache log. On the page:
    "The requested URL /pls/apex/wwv_flow.accept was not found on this server."
    I am sure this is just a configuration issue. I installed v1.6 with the http server off the companion cd with the db (10.2.0.1). After I had it working (did not test everything) I upgraded to 3.0.1.
    I get this message when I am trying to import an application that I just exported! I am testing this for pushing code up to our production environment.
    My dads.conf file looks like:
    Alias /i/ /oracle/product/apps/htmldb/images/
    AddType text/xml xbl
    AddType text/x-components htc
    <Location /pls/apex>
    SetHandler pls_handler
    Order deny,allow
    Allow from all
    AllowOverride None
    PlsqlDatabaseUsername APEX_PUBLIC_USER
    PlsqlDatabasePassword xxxxxx
    PlsqlDatabaseConnectString 192.168.2.195:1521:idpdev ServiceNameFormat
    PlsqlDefaultPage apex
    PlsqlDocumentTablename wwv_flow_file_object$
    PlsqlDocumentPath docs
    PlsqlDocumentProcedure wwv_flow_file_mgr.process_download
    PlsqlAuthenticationMode Basic
    PlsqlNLSLanguage AMERICAN_AMERICA.WE8ISO8859P1
    </Location>
    marvel.conf file is empty
    There is a log file for pl/sql.... it has the following text in it that seemed pertinent: Attempting to logon with '(unknown)'
    Also a log that says this and seems to have a "special character" in it that may be causing an issue:
    <1133864024 ms>6565646261636b206f6e a70726f6d707420202e2e2e646f6e65 a
    <1133864024 ms>-----------------------------2444716671664
    <1133864024 ms>^M
    <1133864024 ms>UploadBlobDoc: readahead 27 bytes into 82f5e5c
    <1133864024 ms>UploadBlobDoc : Inserting piece OCI_NEXT_PIECE
    <1133864024 ms>UploadBlobDoc:Attempt to write 2048 bytes(offset 249857)
    <1133864024 ms>UploadBlobDoc:OCILobWrite for 2048 bytes (offset 249857)
    <1133864024 ms>UploadBlobDoc: Read-Ahead buf 82f5e5c has 27 bytes
    <1133864024 ms>UploadBlobDoc : Inserting piece OCI_LAST_PIECE
    <1133864024 ms>UploadBlobDoc:Attempt to write 27 bytes(offset 251905)
    <1133864024 ms>UploadBlobDoc:OCILobWrite finished for 27 bytes
    <1133864024 ms>ORA-942 Execute(Temp BLOB) ORA-00942: table or view does not exist
    <1133864024 ms>Stale Connection due to Oracle error 942
    <1133864024 ms>/pls/apex/wwv_flow.accept HTTP-404 ORA-00942: table or view does not exist
    <1133864024 ms>(wpu.c,594) longjumping back to the beginning
    <1133864024 ms>(wpu.c,457) cleaning up before longjmp
    <1133864024 ms>(wpu.c,461) doing a rollback
    <1133864024 ms>(wpcs.c, 76) Executed 'rollback' (rc=0)
    <1133864024 ms>(wpcs.c, 76) Executed 'begin dbms_session.reset_package; end;' (rc=0)
    <1133864024 ms>(wpd.c,1816) Going to close cursor
    <1133864024 ms>Freed BLOB
    <1133864024 ms>DeinitCursor
    <1133864024 ms>(wpx.c,690) Shutdown has been called
    <1133864024 ms>(wpx.c,702) Going to logoff
    <1133864024 ms>Logoff: Closing connection due to stale connection
    <1133864034 ms>[ReqEndtime: 2/Oct/2007:15:38:11]
    <1133864034 ms>[ReqExecTime: 80 ms]
    I did go in and update the permissions to the wwv_flow_file_objects$ table to give PUBLIC full access to that table to see if that was the problem... it wasn't.
    Probably information overload, but just wanted to be thorough. Anyone have any ideas?

    I also have another issue... probably more of a clarification....
    I run the following to stop the process:
    "/oracle/product/apps/opmn/bin/opmnctl stopproc ias-component=HTTP_Server"
    then
    "/oracle/product/apps/opmn/bin/opmnctl startproc ias-component=HTTP_Server"
    But, at that point, it says that opmn is not running.
    So I try:
    "/oracle/product/apps/opmn/bin/opmnctl stopall"
    then
    "/oracle/product/apps/opmn/bin/opmnctl start"
    then
    "/oracle/product/apps/opmn/bin/opmnctl startproc ias-component=HTTP_Server" and it still says that opmn is not running.
    Once I start running the stops and starts, it will eventually start correctly.
    I think that I am trying the steps too fast and that I probably need to wait a bit between steps since that seems to work better that way.

  • BLOBs from different tables on one report

    Hi,
    I think the declarative BLOB support enhancement in 3.1 is really great. I am running into a problem with a report that joins two tables that both have BLOB columns. I have a Letters table and a Response table. The Response table has a FK linkage to the Letters table with the Letters table being the referenced table. I have a report that joins the Letters & Response tables and provides download links for the BLOBs in both tables. However on the report, only one of the link works at a given point in time. Both the links work fine in isolation (if the other link is commented out in the query).
    I am using the APEX_UTIL.GET_BLOB_FILE_SRC function to download the files. Has anyone tried using this function to download files from two different tables in a single report?
    TIA,
    Ramesh

    Ramesh,
    Is this application on apex.oracle.com by any chance? I just went to test there and am having all sorts of trouble with declarative display of BLOBs in a report but on our dev box, two works fine (except that the link for both is the default rather than what I selected).
    -- Sharon

  • How load File as Blob in Oracle Table?

    Hi, I am beginner in ODI.
    How load File as BLOB in Oracle Table?

    Ah so nice, a FAQ, by someone who can't use online resources!
    Any explanation why Google is broken for you?
    Here is the code I use to load a jpg.
    procedure upd_portrait(p_person_id in number, p_file_name in varchar2) is
    l_blob blob;
    l_bfile bfile;
    begin
    update person
    set portrait = empty_blob()
    where id = p_person_id
    returning portrait into l_blob;
    l_bfile := bfilename('MY_IMAGES', p_file_name);
    dbms_lob.fileopen(l_bfile);
    dbms_lob.loadfromfile(l_blob, l_bfile, dbms_lob.getlength(l_bfile));
    dbms_lob.fileclose(l_bfile);
    end;
    Sybrand Bakker
    Senior Oracle DBA

  • Generate script for filling table

    Hi all,
    I've got table at test Oracle server table1 with columns ID, BTYPE, MYDESCRIPTION. Rows of this table have been inserted manually. Now my need is to write script for creating table (structure + data). I think about writing something like
    CREATE TABLE table 1
    AS
    SELECT 1 AS ID, 'TYPE1' AS BTYPE, 'SOME TEXT' AS MYDESCRIPTION
    UNION ALL
    SELECT 2 AS ID, 'TYPE2' AS BTYPE, 'SOME TEXT 2' AS MYDESCRIPTION
    But rows are too many to type... Could you please suggest some way of generating script for creating table at working server using existing table at test server? The problem is I don't have an access to working server.
    Thanks ahead.

    Use the view user_tab_cols
    say
    declare
    cursor c1 is
    select 'e_'||column_name ||' '||data_type||' ('||data_length||') ' col
      from user_tab_cols
      where table_name = 'DEPARTMENTS'
    union
    select 'd_'||column_name ||' '||data_type||' ('||data_length||') ' col
      from user_tab_cols
      where table_name = 'EMPLOYEES';
    v1 varchar2(500);
    begin
    v1 := 'create table new_tabl (';
    for i in c1 loop
    v1 := v1||i.col||',';
    end loop;
    v1 := substr(v1,1,length(v1)-1);
    dbms_output.put_line(v1||')');
    end;
    /i am using employees and departments table of hr schema.
    now as both the tables have some column column so i have used e for employees and d for departments
    just do one thing remove the length for date data type in o/p i dont know why it is not working.
    this will give you structure for data use any sql stmt
    Edited by: 810345 on Jun 9, 2011 9:58 PM

  • Unable to generate statistics for the table

    I have got a staging table of more than 600 columns which has got range portioning. Size of the table is 4GB. The average size of the row is around 3 MB. I have created a Functional index on one of the column ABC VARCHAR2(50) and it has only number values. Now when I try generating statistics for this table through ANALYZE or DBMS_STAT, it gives Invalid Number error but when I drop this index and try analyzing, it works.
    Executed TO_NUMBER(ABC) query on the table and it works fine.
    I have got Functional Indexes on other tables also but I don't get such problem with those tables. I tried dropping the index and re-creating it but it didn't work out.
    I was suspecting DATA BLOCK CORRUPTION so checked ALERT LOG and TRACE FILES but found nothing.
    So what is this magic called?

    I am using TO_NUMBER on the column.
    I have checked the MetaLink for the same problem but could not find anything on that. I still suspect datafile error which I am unable to get in ALERT LOG or TRACE FILES. So I am going to try it this way:
    1) Create new Tablespace with New Datafile
    2) Transfer the table from existing Tablespace to new Tablespace
    3) Create the functional index in the same new Tablespace
    4) Try generating the statistics.
    5) If it works then create seprate Tablespace for data and Index.
    Hope it works !!
    Thanks for the reply guys.

  • Is table maintenance generator only for custom table?

    hi ,
    i have doubt is table maintenance generator only for custom table?

    hi swamya,
    Table Maintanance Generator is used to create/change/delete table entries in a particular table.
    In the production system, end-users will not be having access to transaction codes like SE11 and SE16. Developers will not be having access to many transaction codes including the above two.To view the contents of the database table, we will use SE16n in Production system. All these authorizations will be maintained by BASIS team, by creating access profiles.So in order to edit or create the contents of a database table, we should go for table maintenance generator. In real time, authorizations will be maintained in production system.
    The second reason is, we can edit or create multiple entries at a time, using tablemaintenance generator.
    Apart from that we have options like 'Enter conditions' in table maintenance screen SM30.
    hope this helps in clearing ur doubt.
    Regards
    Saurabh

  • ....how to create table maintanence generator for a z table and how to use

    Hi...
    3....how to create table maintanence generator for a z table and how to use that for transfering a selected records to one server to another server.
    thanks and regards,
    k.swaminath reddy

    Hi,
    Table maintanance Generator is used to manually
    input values using transaction sm30.The Table Maintenance Generator is used to create table maintenance program to add, modify or delete records in the database table. This can be accessed using transaction SE54 or in SE11 using the menu Utilities->Table Maintenance Generator
    <b>
    Follow below steps</b>
    go to se11 check table maintanance check box under
    attributes tab
    utilities-table maintanance Generator->
    create function group and assign it under
    function group input box.
    also assign authorization group default &NC& .
    select standard recording routine radio in table
    table mainitainence generator to move table
    contents to quality and production by assigning
    it to request.
    select maintaience type as single step.
    maintainence screen as system generated numbers
    this dialog box appears when you click on create
    button
    save and activate table
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ed2d446011d189700000e8322d00/content.htm
    One step, two step in Table Maintenance Generator
    Single step: Only overview screen is created i.e. the Table Maintenance Program will have only one screen where you can add, delete or edit records.
    Two step: Two screens namely the overview screen and Single screen are created. The user can see the key fields in the first screen and can further go on to edit further details.
    please check the link for getting information about table maintenance generator !
    https://www.sdn.sap.com/irj/sdn/advancedsearch?query=use%20of%20table%20maintenance%20generator&cat=sdn_all
    http://www.sapdevelopment.co.uk/tips/tips_tabmaint_tcode.htm
    http://www.sap-img.com/abap/create-a-table-maintance-program-for-a-z-table.htm
    Regards,
    Priyanka.

Maybe you are looking for