How to Populate a table with DBMS_OUTPUT.put_line

Hey Guys, it's Xev.
Please only pleasant people reply to this.
I have a PL/SQL Program that searches for strings and then at the end of it it prints out to DBMS_OUTPUT.put_line.
I have the owner, the table_name, the column name and the count, then it goes to DBMS_OUTPUT.put_line
What i want to do, is take the results of DBMS_OUTPUT.put_line and insert it into a table.
Here is the script I am talking about, as you can see it's simple, yet for me it works.  I want to take the results of this and insert it into a table. How can i do  that??
set serveroutput on size unlimited
execute DBMS_OUTPUT.ENABLE (buffer_size => NULL);
DECLARE
   FND_GOVIDS       INTEGER;
   BEGIN
FOR t  IN (SELECT owner, table_name, column_name
            FROM all_tab_columns
            WHERE owner = upper('&SCHEMA_NAME'))
LOOP
  BEGIN
    EXECUTE IMMEDIATE 'with a as ( select  case when REGEXP_LIKE(' || t.column_name ||
--This searches for 8 Alpha Digits
',''^([[:alpha:]]{2}|[[:alpha:]]{4})?[ ]?[0-9]{8}[ ]?([[:alpha:]]{2}|[[:alpha:]]{4})?$'')
then ''Match Found''
else ''No Match Found'' end as output from ' || t.owner || '.' || t.table_name || ')
select count(*) from a where a.output=''Match Found'' '
      INTO FND_GOVIDS ;
IF FND_GOVIDS > 0         THEN
DBMS_OUTPUT.put_line (
t.owner
|| '.'
|| t.table_name
|| ' '
|| t.column_name
|| ' '
|| FND_GOVIDS);
  END IF;
  EXCEPTION
    WHEN OTHERS
      THEN
      DBMS_OUTPUT.put_line (
      'Generic Error '
      || t.column_name
      || ' from '
      || t.owner
      || '.'
      || t.table_name);      
      END;
   END LOOP;
END;

Nope, the table is empty....
But it ran without error??!?! Wait a minute, I think i have to commit right? Since it's not straight sql, ok, that's what I am going to try..
set serveroutput on size unlimited
execute DBMS_OUTPUT.ENABLE (buffer_size => NULL);
DECLARE
   FND_GOVIDS       INTEGER;
   BEGIN
FOR t  IN (SELECT owner, table_name, column_name
            FROM all_tab_columns
            WHERE owner = upper('&SCHEMA_NAME'))
LOOP
  BEGIN
    EXECUTE IMMEDIATE 'with a as ( select  case when REGEXP_LIKE(' || t.column_name ||
--This searches for 6 Alpha Digits
',''^([[:alpha:]]|[[:alpha:]]{3})[0-9]{6}$'')
then ''Match Found''
else ''No Match Found'' end as output from ' || t.owner || '.' || t.table_name || ')
select count(*) from a where a.output=''Match Found'' '
      INTO FND_GOVIDS ;
/*Table insert for resulting */
IF FND_GOVIDS > 0 THEN
INSERT INTO "SMEG"."DYNAMIC_COUNTS" (T_OWNER, T_TABLE_NAME, T_COLUMN_NAME, FND_GOVIDS) VALUES
('t.owner','t.table_name','t.column_name','FND_GOVIDS');
  END IF;
/* dbms_output */
IF FND_GOVIDS > 0 THEN
DBMS_OUTPUT.put_line (t.owner || '.' || t.table_name || ' ' || t.column_name || ' ' || FND_GOVIDS);
  END IF;
/* Exception Handeling */
  EXCEPTION
    WHEN OTHERS
      THEN
      DBMS_OUTPUT.put_line (
      'Generic Error '
      || t.column_name
      || ' from '
      || t.owner
      || '.'
      || t.table_name);     
      END;
   END LOOP;
END;

Similar Messages

  • How to populate a table with ORDSYS.ORDImage item by BLOB item?

    Hi, I have a table, that contain blob column and another table with ORDSYS.ORDImage column and I would like to populate ORDSYS.ORDImage item in table by BLOB item, in which I have store some images?

    You should be able to do something like (this is off the top of my head, so please excuse any compile errors...):
    define
    b blob;
    i ordsys.ordimage;
    begin
    INSERT INTO ordsysImgs VALUES (1,ORDSYS.ORDImage.init());
    select imgCol into i from ordsysImgs where ID = 1 for update;
    select blobcol into b from blobImgTable;
    i.source.localdata := b;
    i.setlocal();
    i.setproperties();
    update imgcol set imgCol = i where ID = 1;
    commit;
    end;

  • How to populate a table with array loop

    I'm looping an array object and as I loop, I'm calling a function and this function returns 6 items
    <CFLOOP  from="1" to="#ArrayLen(zz)#" index="k">
      <cfdump var="#zz[k].getLine()#"> <p>
    </CFLOOP > 
    The above cfdump will return something like:
    [empty string]
    street name1
    [empty string]
    [empty string]
    city1
    state1
    zip1
    [empty string]
    street name2
    Apartment AA
    [empty string]
    city2
    state2
    zip2
    street name 3
    Margenthaller Hall
    Suite 202
    city2
    state2
    zip2
    etc
    I need to insert these results into my address table while looping.
    When I did the following (see below), each record got repeated 12 times (not sure why)
    <CFLOOP  from="1" to="#ArrayLen(zz)#" index="k">  <cfdump var="#zz[k].getLine()#">
      <cfquery name="test" datasourece="MyDNS">
       INSERT INTO MyAddr (street1,street2,street3,city,state,zip)
       VALUES ('#zz[1].getLine()#', '#zz[2].getLine()#', '#zz[3].getLine()#', '#zz[4].getLine()#','#zz[5].getLine()#', '#zz[6].getLine()#')
    </cfquery>
    </CFLOOP >
    Is there a way? to do insert as I already got the address correctly while looping but not sure how can I use the return result in insert statement.
    Can anyone help?

    For what you seem to be doing here, the loop is unnecessary and causing the multiple inserts since the <cfquery...> is inside the insert, it will be executed for each and every iteration of the loop.
    You COULD put the loop inside the <cfquery...> to build the repeating part of your query I.E. the VALUES clause it seems in your case.  But, unless you would have different sized arrays I would just do what you are doing and explicitly calling each array element.  I.E. the zz[1]...zz[2]...zz[3]...etc. that you have.

  • How to populate a page with images in across/down direction?

    Hi,
    Does anyone know how to populate a page with images in across and down direction (for example 6 X 6 )? It seems that I cannot use data table because records are only running downward and each row can have one record.
    Any suggestion would be appreciated. thanks.

    Alex,
    You can create your own tabular form using APEX_ITEM API's
    Create report and you can put similar code to following
    SELECT APEX_ITEM.TEXT(1,col1) pk1, APEX_ITEM.TEXT(2,col2) pk2 FROM your_tableSo data will be displayed in TEXT boxes as if it's a tabular form. Now you need to handle INSERT/UPDATE/DELETE processes manually. You can easily handle INSERT and DELETE. But handling UPDATE can be a nightmare. What if user has updated both the column values?
    Updated details
    One way out would be to use ROWID as Primary key to handle DELETE and UPDATE
    SELECT APEX_ITEM.CHECKBOX(1,ROWID) tick, APEX_ITEM.TEXT(2,col1) pk1, APEX_ITEM.TEXT(3,col2) pk2 FROM your_tablebut yet I suggest to go for proper primary key..
    Regards,
    Hari
    Edited by: Hari_639 on Dec 3, 2009 6:52 PM

  • How to Populate Internal table data to Table Control in a Report Program

    Dear All,
           How to Populate Internal table data to Table Control in a Report Program? It is a pure report program with out any Module pool coding involved, which is just used to display data. Till now it is being displayed in a report. Now the user wants the data to be displayed in a table control. Could someone tell me how to go about with this.
    Thanks in Advance,
    Joseph Reddy

    If you want to use a table control, you will need to create a screen.
    In your report....
    start-of-selection.
    perform get_data.  " Get all your data here
    call screen 100. " Now present to the user.
    Double click on the "100" in your call screen statement.  This will forward navigate you to the screen.  If you have not created it yet, it will ask you if you want to create it, say yes.  Go into screen painter or layout of the screen.  Use the table control wizard to help you along the process.  It will write the code for you.  Since it is an output only table control, it will be really easy with not a lot of code. 
    A better way to present the data to the user would be to give it in a ALV grid.  If you want to go that way, it is a lot easier.  Here is a sample of the ALV function module.  You don't even have to create a screen.
    report zrich_0004
           no standard page heading.
    type-pools slis.
    data: fieldcat type slis_t_fieldcat_alv.
    data: begin of imara occurs 0,
          matnr type mara-matnr,
          maktx type makt-maktx,
          end of imara.
    * Selection Screen
    selection-screen begin of block b1 with frame title text-001 .
    select-options: s_matnr for imara-matnr .
    selection-screen end of block b1.
    start-of-selection.
      perform get_data.
      perform write_report.
    *  Get_Data
    form get_data.
      select  mara~matnr makt~maktx
                into corresponding fields of table imara
                  from mara
                   inner join makt
                     on mara~matnr = makt~matnr
                        where mara~matnr in s_matnr
                          and makt~spras = sy-langu.
    endform.
    *  WRITE_REPORT
    form write_report.
      perform build_field_catalog.
    * CALL ABAP LIST VIEWER (ALV)
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                it_fieldcat = fieldcat
           tables
                t_outtab    = imara.
    endform.
    * BUILD_FIELD_CATALOG
    form build_field_catalog.
      data: fc_tmp type slis_t_fieldcat_alv with header line.
      clear: fieldcat. refresh: fieldcat.
      clear: fc_tmp.
      fc_tmp-reptext_ddic    = 'Material Number'.
      fc_tmp-fieldname  = 'MATNR'.
      fc_tmp-tabname   = 'IMARA'.
      fc_tmp-outputlen  = '18'.
      fc_tmp-col_pos    = 2.
      append fc_tmp to fieldcat.
      clear: fc_tmp.
      fc_tmp-reptext_ddic    = 'Material'.
      fc_tmp-fieldname  = 'MAKTX'.
      fc_tmp-tabname   = 'IMARA'.
      fc_tmp-outputlen  = '40'.
      fc_tmp-col_pos    = 3.
      append fc_tmp to fieldcat.
    endform.
    Regards,
    Rich Heilman

  • How to populate a table in the html page from the java script

    Hi all,
    I have doubt in populating a table in the html page. my application is as follows
    I have a html page in which i have a combo box and a table following the combo box.
    i have to populate the table depending on the item selected in the combo box.
    for this i am using javascript to get the value of combo box onClick
    then i have to call some function thru jsp to get the data and then i have to populate the table with thst into from java script
    how can i do this, i.e populating html table from java script
    Thanks in advance
    satya

    Hi Mihai,
    You can populate data in DO_INIT_CONTEXT method of ur impl class in your Z component.
    data:
    lv_struct_ref type ref to YOUR_STRUCTURE,
    lv_value_node type ref to cl_bsp_wd_value_node,
    lv_bo_coll type ref to if_bol_bo_col.
    Data: current type ref to if_bol_bo_property_access.
    data: dref type ref to data.
    data: lv_guid_h type crmt_object_guid.
    data: lt_attr type table of YOUR_STRUCTURE.
    data: ls_attr type YOUR_STRUCTURE.
    data: lr_entity type ref to cl_crm_bol_entity.
    create object lv_bo_coll type cl_crm_bol_bo_col.
    lt_attr is ur internal table.
    Loop at lt_attr into ls_attr.
      create data lv_struct_ref.
      create object lv_value_node
           exporting
                iv_data_ref = lv_struct_ref.
    call method lv_value_node->if_bol_bo_property_access~set_property
    exporting
    iv_attr_name = 'YOURFIELDNAME1'
    iv_value = ls_attr-firstname.
    call method lv_value_node->if_bol_bo_property_access~set_property
    exporting
    iv_attr_name = ' YOURFIELDNAME2'
    iv_value = ls_attr-lastname.
    lv_bo_coll->add( lv_value_node ).
    typed_context->YOURCONTEXTNODE->set_collection( lv_bo_coll ).
    endloop.
    Regards,
    Raghu

  • How to populate a table based on a row selection from another table.

    Hi, i just started to use ADF BC and Faces. Could some one help me or point me a solution on the following scenario .
    By using a search component , a table is being displayed as a search result. If i select any row in the resulted table , i need to populate an another table at the bottom of the same page from another view. These two tables are related by primary key . May i know how to populate a table based on a row selection from another table. Thanks
    ganesh

    I understand your requirement and the tutorial doesn't talk about Association between the views so that you can create a Master-Detail or in DB parlance, a Parent-Child relationship.
    I will assume that we are dealing with two entities here: Department and Employees where a particular Department has many Employees and hence a Parent-Child relationship.
    Firstly, you need to create an Association between the two Entities - Department and Employees. You can do that by right clicking on the model's entity and then associating the two entities with the appropriate key say, DepartmentId.
    Once you have done that, you need to link the two entities in the View section with this Association that you created. Then go to AppModule and make sure that in the Available View Objects: 'EmployeesView' appears under 'DepartmentView' as "EmployeesView via <link you created>". Shuttle the 'DepartmentView' to the right, Data Model and then shuttle
    "EmployeesView via <link you created>" to the right, Data Model under 'DepartmentView'.
    This will then be reflected in your Data Controls. After that, you simply would have to drag this View into your page as a Master-Detail form...and then when you run this page, any row selected in the Master table, would display the data in the Detail table.
    Also, refer to this link: [Master-Detail|http://baigsorcl.blogspot.com/2010/03/creating-master-detail-form-in-adf.html]
    Hope this helps.

  • How to create a table with events in smartforms?

    How to create a table with events view in smartforms?
    It doesn't like general table with header, main area and footer.
    for example:
    in smartforms: LE_SHP_DELNOTE
    table name is TABLEITEM(Delivery items table)

    Vel wrote:
    I am creating XML file using DBMS_XMLGEN package. This XML file will contain data from two different database tables. So I am creating temporary table in the PL/SQL procedure to have the data from these different tables in a single temporary table.
    Please find the below Dynamic SQL statements that i'm using for create the temp table and inserting the data into it.
    Before insert the V_NAME filed, i will be appending a VARCHAR field to the original data.
    EXECUTE IMMEDIATE 'CREATE TABLE TEMP_TABLE (UNIQUE_KEY NUMBER , FILE_NAME VARCHAR2(1000), LAST_DATE DATE)';
    EXECUTE IMMEDIATE 'INSERT INTO TEMP_TABLE values (SEQUENCE.nextval,:1,:2)' USING V_NAME,vLastDate;What exactly i need is to eliminate the INSERT portion of it,Since i have to insert more 90,000 rows into it. Is there way to have the temp table created with data in it along with the sequence value as well.
    I'm using Oracle 10.2.0.4 version.
    Edited by: 903948 on Dec 22, 2011 10:58 PMWhat you need to do to eliminate the INSERT statement is to -- as already suggested by others - eliminate the temporary table. You don't need it. It is just necessary overhead. Please explain why you (apparently) believe that the suggestion of a view will not meet your requirements.

  • How to create a table with varied number of columns?

    I am trying to create a balance table. The colunms should include years between the start year and end year the user will input at run time. The rows will be the customers with outstanding balance in those years.
    If the user input years 2000 and 2002, the table should have columns 2000, 2001, 2002. But if the user input 2000 and 2001, the table will only have columns 2000 and 2001.
    Can I do it? How? Thanka a lot.

    Why did you create a new thread for this?
    How to create a table with varied number of columns?

  • How to create a table with datatype blob and insert a pdf file (ravi)

    how to create a table with datatype blob and insert a pdf file,
    give me the explain asap
    1.create the table?
    2.insert the pdffiles into tables?
    3.how to view the files?
    Thanks & Regards
    ravikumar.k
    Edited by: 895044 on Dec 5, 2011 2:55 AM

    895044 wrote:
    how to create a table with datatype blob and insert a pdf file,
    give me the explain asapPerhaps you should read...
    {message:id=9360002}
    especially point 2.
    We're not just sitting here waiting to answer your question as quickly as possible for you.

  • How to Populate a table in PL/SQL

    Hi Every1,
    please clarify me How to Populate a table in PL/SQL,Thanx in advance...
    Thanks & Regards,
    Ram Nainar S

    Not possible. SQL is used to populate tables - it is the language that interacts (CRUD) Oracle data in tables. Not PL/SQL.
    So even when using PL/SQL, you still need to use SQL. Thus "populating" a table is no different than using SQL or using SQL (from inside PL/SQL).

  • How to build a table with predifined? Like Huffman decoding, there are 34 predefined tables?

    I am trying to use Labview for mp3 huffman decoding. there are 34 predefined tables for lookup purpose. I tried build array control, but it is so hard to assign value with size of 16. What is the better way to create predefined array? And how to do lookup table with Labview?

    IMHO, the best way to have something "predefined" is to read this data from a "setup/configuration" file (if you don't want to use "default settings" LV feature). The choice of the format for all the data that you want to store in some kind of configuration file is up to you.
    Also, constructing a "lookup table" in LV doesn't seems different as for any other programming language.

  • How to insert a table with variable rows in smart form

    Hi all,
    How to insert a table with variable rows in smart form?
    Any help would be appreciated.
    Regards,
    Mahesh.

    Hi,
    Right click the mouse->create->table
    If you want 5 columns, you need to declare 5 cells in one line type of the table
    Click on Table -> Details, then do the following
    Line Type 1 2 3 4 5
    L1 2mm 3mm etc
    Here specify the width of the columns as many as you want..
    then in the header/main area of the table, click create Table Line, Rowtype is L1, automatically 5 cells will come,In each cell create a text element, display the variable to be printed there.

  • How to populate the table using webservice

    Hi,
    i have created the web service from function module and  integrated this web service in interactive form using New data connection.
    I have drag and drop all field into the form table and test the form,but its not populate table.
    if any script need for this,
    Kindly explain in detail or give the sample code.
    Thanks in advance
    Parthasarathi

    Dear folks
    M about to create a midlet
    application in which i need to populate my table
    with the current stock exchange values. Since these
    values get changed dynamically , I planned to use
    streaming. Since m new to streaming ,pls someone
    come up to guide me in right path. M using Canvas
    application. I appreciate all the repliesthats fine and funny....
    let me tell you something, in GCF everything you fetch through GPRS is bound to come as an inputstream and whatever request you send is passed as outputstream. so if you have worked with GCF, you have worked with streaming already. isn't it.
    SD

  • How to populate the table using streaming data

    Dear folks
    M about to create a midlet application in which i need to populate my table with the current stock exchange values. Since these values get changed dynamically , I planned to use streaming. Since m new to streaming ,pls someone come up to guide me in right path. M using Canvas application. I appreciate all the replies

    Dear folks
    M about to create a midlet
    application in which i need to populate my table
    with the current stock exchange values. Since these
    values get changed dynamically , I planned to use
    streaming. Since m new to streaming ,pls someone
    come up to guide me in right path. M using Canvas
    application. I appreciate all the repliesthats fine and funny....
    let me tell you something, in GCF everything you fetch through GPRS is bound to come as an inputstream and whatever request you send is passed as outputstream. so if you have worked with GCF, you have worked with streaming already. isn't it.
    SD

Maybe you are looking for

  • Language setting issue with Xcelsius 2008 - Web Service NW BI

    French language is set during Xcelsius installation. In Xcelsius, English is always set as the preference language. With Web Service NW BI, I get text data returned in French. English is also defined as  default language in SAP BW BI . I would like t

  • ContainerBreaks and ColumnBreaks feature in TLF 3.0

    Feature Description Add a way for the user to force the text to break and continue on the next column or container. It is an attribute, and you should either be able to apply it to an element to force it to be the last in the column or container, or

  • Planned Cost is taken from Actual Cost even through there is Baseline Cost

    Hi All, Responsibility: Project Super User Create Project with fully shared structure Enter planned cost for 25000 against Task (Define Project scope in detail) with Financial Element as Resource and baseline the work plan. Now enter the actual cost

  • Using HDV clips from Final Cut in a 4:3 iMovie Timeline

    I'm trying to use HDV clips in a standard def, 4:3 iMovie file. I export them as full quality QT clips out of my FCP timeline - to the desktop - then when I drag them into my iMovie file - they squish instead of letterboxing. I've tried everything bu

  • Partner Link URL/WSDL or Dynamic Partner link

    We are using a service similar to CreditRatingService in orderBooking Tutorial as a partner link. The partner has different test vs production service. I was wondering during deplyment on production is it possible to specify the URL in config file or