How to use BULK INSERT for a data from a cursor?

Oracle 10G enterprise edition.
I tried to Bulk insert datas returning from a cursor, its returning error.
PLS-00302: component 'LAST' must be declared
I need some help to use the Bulk INSERT here.Can any one help me to specify what error i have made?
CREATE OR REPLACE PROCEDURE HOT_ADMIN.get_search_keyword_stats_prc
IS
CURSOR c_get_scenarios
IS
SELECT a.*,ROWNUM rnum
FROM (
SELECT TRUNC(r.search_date) sdate,
r.search_hits hits,
r.search_type stype,
r.search_qualification qual,
r.search_location loc,
r.search_town stown,
r.search_postcode pcode,
r.search_college college,
r.search_colname colname,
r.search_text text,
r.affiliate_id affiliate,
r.search_study_mode smode,
r.location_hint hint,
r.search_posttown ptown,
COUNT(1) cnt
FROM w_search_headers r
WHERE search_text IS NOT NULL
AND NVL(search_type,' ') <> 'C'
AND TRUNC(search_date)= TO_DATE(TO_CHAR(SYSDATE-1,'DD-MON-RRRR'))
GROUP BY TRUNC(r.search_date),
r.search_hits,
r.search_type,
r.search_qualification,
r.search_location,
r.search_town,
r.search_postcode,
r.search_college,
r.search_colname,
r.search_text,
r.affiliate_id,
r.search_study_mode,
r.location_hint,
r.search_posttown
ORDER BY cnt desc
) a
WHERE ROWNUM <=1000;
lc_get_data c_get_scenarios%ROWTYPE;
BEGIN
OPEN c_get_scenarios;
FETCH c_get_scenarios into lc_get_data;
CLOSE c_get_scenarios;
FORALL i IN 1..lc_get_data.last
INSERT INTO W_SEARCH_SCENARIO_STATS VALUES ( i.sdate,
i.hits,
i.stype,
i.qual,
i.loc,
i.stown,
i.pcode,
i.college,
i.colname,
i.text,
i.affiliate,
i.smode,
i.hint,
i.ptown,
i.cnt
COMMIT;
END;

This isn't what you asked, but I've generally found it helpful to list the columns in an INSERT statement before the values. It is of course optional, but useful for reference when looking at the statement later

Similar Messages

  • How to use bulk insert in utl_file

    i am creating text file of employee list i go huge data i want to use bulk insert with utl_file is it possible if so, how pls help me.

    If what you are asking, in some unknown version of Oracle, is whether using FORALL will increase the speed for writing a file to your hard disk the answer is no.
    BULK COLLECT, however, might help.

  • How to use waveform chart for slow data

    For slow data acquisition (e.g. 1 sample / sec) in the case of using DMM, how to display those data in a chart / graph?
    For this sampling rate, there will be only 1 point in the chart. 
    How to buffer them and display them in a sequence?
    Or, any other method?
    thanks

    Here is a quick example showing chart, graph and XY graph.  All YOU need to do is use a chart and wire your DMM reading right to it.  Charts have their own built in history (you can change the buffer size by right-clicking > Chart History Length)
    For more info see the Examples...  Building User Interfaces > Displaying Data > Graphs and Charts
    Using LabVIEW: 7.1.1, 8.5.1 & 2013
    Attachments:
    MultiGraphs.vi ‏17 KB

  • Hi experts, how to use open sql to read data from one " maintenance view"?

    i want to use this part of data within report ,so how to use open sql statement to read data from one " maintenance view"?

    Hi
    You can't use OPEN SQl statements to fetch data from maintenance view
    You have to use only Database views
    see the different types of views and the difference
    The followings are different types of views:
    - Database View (SE11)
    Database views are implement an inner join, that is, only records of the primary table (selected via the join operation) for which the corresponding records of the secondary tables also exist are fetched. Inconsistencies between primary and secondary table could, therefore, lead to a reduced selection set.
    In database views, the join conditions can be formulated using equality relationships between any base fields. In the other types of view, they must be taken from existing foreign keys. That is, tables can only be collected in a maintenance or help view if they are linked to one another via foreign keys.
    - Help View ( SE54)
    Help views are used to output additional information when the online help system is called.
    When the F4 button is pressed for a screen field, a check is first made on whether a matchcode is defined for this field. If this is not the case, the help view is displayed in which the check table of the field is the primary table. Thus, for each table no more than one help view can be created, that is, a table can only be primary table in at most one help view.
    - Projection View
    Projection views are used to suppress or mask certain fields in a table (projection), thus minimizing the number of interfaces. This means that only the data that is actually required is exchanged when the database is accessed.
    A projection view can draw upon only one table. Selection conditions cannot be specified for projection views.
    - Maintenance View ( SE54 )
    Maintenance views enable a business-oriented approach to looking at data, while at the same time, making it possible to maintain the data involved. Data from several tables can be summarized in a maintenance view and maintained collectively via this view. That is, the data is entered via the view and then distributed to the underlying tables by the system.
    Please have a look at below link. It will help you.
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ed06446011d189700000e8322d00/frameset.htm
    for more detailed info look on:
    http://www.sap-img.com/abap/what-is-the-different-types-and-usage-of-views.htm
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/abap+dictionary&
    Reward points for useful Answers
    Regards
    Anji

  • Index used or not for selecting data from ODS in a start routine

    Dear friends,
    In the start routine of the update rules to a cube, I am reading some data of an ODS in to an internal table .
    The ODS is indexed. But, I am not sure if the index is at all used in the Select statement (that gets the data from ODS to the internal table in the start routine) while loading data to the cube.
    Any help is highly appreciated.
    regards,
    atlaj

    Hi Atlaj
    You can findout this is display execution plan for SQL statement in DB02.
    Goto DB02. and under diagnostic, you find explain. Select that and enter your query. Make sure that everything here is in capital format. Below is a sample query which I have entered.
    SELECT "CRM_SALORG" "SALESORG" FROM "/BI0/QORGUNIT"
    WHERE "SALESORG" = ? AND "OBJVERS" = ? AND "DATETO" >= ?
    AND "DATEFROM" <= ?
    The select parameters should be inside qoutes and in caps and even the from table. Once you enter your query in this format, click on explain. It will show the index scan if the index is present. the output for my query will be something like
    0 SELECT STATEMENT ( Estimated Costs =  1,348E+01 [timerons] )
            1 (COOR) RETURN
                2 (    0) TQ
                    3 (    0) FETCH /BI0/QORGUNIT
                        4 (    0) IXSCAN /BI0/QORGUNIT~Z1
    Where my last statement (line 4) is showing index scan and the name of index read is Z1.
    Hope this helps.
    Please let me know if you have any problems entering the query in the specified format and u get any error.
    Regards
    Sriram

  • WLS 10.3.4: How to use OS authentication for JDBC Data Source

    Hello all,
    As a preface, I've tried searching the forum/Google for "OS authentication" and reading the WLS JDBC doc to no avail - if it's documented somewhere, a RTFM link would be much appreciated.
    I'm trying to set up a JDBC data source on WLS that leverages the OS Authentication capability of the Oracle database. If it would help, I can go into the reasoning behind why I want to do this, but basically, it's to simplify the config/deployment of a COTS application. What I have in the database is an "identified externally" user that corresponds to the OS user that is running the WebLogic Server. Normally, in tools such as SQL*Plus, I would use "/@db" as the username/password (in other words, no username and no password specified), and I would be logged in as the "idenfitied externally" user. I want to configure the same thing for a WebLogic Data Source, but if I leave the username/password blank, testing the connection in the WLS console gives me "invalid username/password, login denied" I've also tried using "/" as the username, as was documented in a quite old WLS faq, but that gives me the same result.
    Is there some magic switch I need to flip?
    Thanks,
    John

    Hi John, there's no way to do that with connection pools, which is how WLS datasources get their
    connections, or middleware in general. WebLogic would have no way of knowing which if any of the
    pooled connections was appropriate for the current 'user', which is not the application user, but
    instead is the OS identity of the person who started the WebLogic server! If you start up your
    WebLogic server, and people start pointing their browsers to it, doing various stuff, the OS knows
    you started WebLogic, and maybe with the help of OCI, Oracle's JDBC might know it was you who
    started WebLogic's OS process, but what does the OS know about any user that may be running
    a browser or application elsewhere (even if on this same machine), when that browser or application
    connects to your WebLogic server process?
    HTH,
    Joe

  • Using Bulk Scenario to Capture Data from Source for First time

    Hi,
    I need to setup ODI for a table between two Database. Genereally, I follow practice of importing oracle  dump of table into target database for the first time before delta capture preocess starts. However, this time there is space constraint at source system & we can not create the oracle dump as it will result into 120-130 GB.
    Is it possible to import these one time data into target Database via ODI Bulk Schenario. Does ODI have any timeouts set at the database connetion as this will take long running session to copy across such a huge data. Will it cause any time outs at Database.
    Please suggest.
    Thanks.

    Hi All,
    Thanks a lot for your responses. Moving ahead and trying out different things, i figured out that the EPMA/Planning had to be on the same machine as the ERPI. After installing EPMA/Planning on the same machine, the ERPI target application registration page started displaying all the applications created using the EPMA and i also successfully registered my target planning application with ERPI. But you know life is not that fair, right after the resolution of this problem, another problem appeared :(. While registering the target planning application, EPMA was by default selected as the Metadata Load method and i selected FDM as the data load method.
    After registering the application, i happily started adding the metadata rule as instructed in the knowledge document 951369.1 (Thanks user735469 for the reference), but when i clicked on the Add Dimension button, the next page gave an error stating There are no more dimensions remaining to be mapped under this application. and the dimensions drop down under the target application area was empty.
    According to this link http://download.oracle.com/docs/cd/E12825_01/epm.111/readme/fdm_11113_readme.html , this error can be fixed by clicking on the refresh button but i couldnt find a refresh button on the entire page. I tried refreshing the browser but to vain. I also downloaded and applied latest ERPI patch but still no positive results.
    Any idea why is this happening ?
    Desperately waiting for your help. :(
    Thanks & Regards,
    Muhammad Jamshaid Nawaz

  • How to use Power Query to load data from a single source into multiple tables

    Hi all,
    I have a requirement to load my data into three different data models using Power Query. Is that possible?
    My source is a SharePoint survey list, with similar questions like:
    1) Course lecturer - John Doe
    1a) The course was useful (rate 1 to 5)
    1b) The lecturer displayed good knowledge of topic (rate 1 to 5)
    2) Course Lecturer - Mary Brown
    2a) The course was useful (rate 1 to 5)
    2b) The lecturer displayed good knowledge of topic (rate 1 to 5)
    I would like to split the data into separate data models (one for John Doe; another for Mary Brown), so that I can compare the different lecturers. Other than running separate surveys for each of them, I thought of using Power Query to transform the data.
    Is it possible?
    Thanks.
    Regards
    GM

    Yes, this is possible.
    Start with a single query that returns you the data for all lecturers.
    Right-click on the "all lecturers" query in the queries pane, and choose Reference, once for each lecturer. This will create a query for each lecturer.
    Open the query for each lecturer and filter the data so that only that lecturer's results are visible.
    Click "Close & Load To..." for each lecturer's query  to load the data into the data model. This will create a data model table for each lecturer.
    If your question is more about how to transform such a survey list into a table that can be easily filtered, please provide an example of how the list shows up in Power Query.
    Ehren

  • Report question: how to use external table to bring data from excel file?

    i need to import excel data into oracle report, how to do that? thanks.

    Hi... What is the error message you get when using external tables?
    You must create a control center connection in the Connection Explorer.
    I recommend you read this:
    http://download-east.oracle.com/docs/cd/B31080_01/doc/owb.102/b28223/toc.htm
    Look for the following sections:
    - Using External Tables (and the "External Tables versus Flat File Operators" sub section)
    - About Flat File Modules
    - Chapter 16, Deploying Target Systems
    Regards,
    Marcos

  • How to use JDBC iView to get data from MSSQL

    Hi Guru,
    I just try to follow the Demo (from SDN) to use JDBC iView. In the step of selecting query or existing function, I choose the query option to broswer the table. But the system is not display any tables. It just keep on displaying 'Loading ...'. Is there anything wrong with that?
    Thanks for your help,
    Bo

    Hi Bo,
    I got the same problem with your, do you know how to fix the problem?
    Thanks,
    Ku

  • How to use Substr & Instr to get data from a file

    hi i have a Scenario
    i am getting a file like this
    1,20,ram,sales
    i am getting a file like this data as a column
    i want to split this data in 4 different column like
    1     20      ram     Sales

    Hi,
    this query will help you.
    select
         SUBSTR(C1,0,INSTR(C1,',')-1),
         SUBSTR(C1,INSTR(C1,',')+1,INSTR(C1,',',1,2)-INSTR(C1,',',1,1)-1),
         SUBSTR(C1,INSTR(C1,',',1,2)+1,INSTR(C1,',',1,3)-INSTR(C1,',',1,2)-1),
         SUBSTR(C1,INSTR(C1,',',1,3)+1,INSTR(C1,',',1,4)-INSTR(C1,',',1,3)-1),
         SUBSTR(C1,INSTR(C1,',',1,3)+1)
    from (
         select '1,20,ram,sales' C1 from dual
    remember that a comma isn't really safe as field separator
    Message was edited by: DecaXD

  • How to get Inventory Balances for PO data

    Hi Guys,
                   How to get Inventory Balances for PO data.
    from which tables I can get it ?
    We are migrating material data to a new plant.. for this process.. The inventory data also has to be moved..
    I am using BAPI_GOODMVT_CREATE to post inventory balances for the new plant.
    Thanks

    Hi,
    Try MARC, MSKA, MARD .
    Thanks,
    Krishna

  • Problem while using BCP utility for witing data in file

    hi all,
    I have a batch file in which I am using bcp command for reading data from MS SQL and writing it in delimiter file. Now there are some exceptions in MS SQL that while writing into file whenever it encounters new line character it switches to next line while writing and starts writing the rest of the data on next.
    Could you help me in getting rid of this problem. I wanted to replace the new line character with space.
    Thanks and regards
    Nitin

    Hi Dilip,
    Before going for any other table,
    As Kalnr is only one of the primary keys of table KEKO, You can try creating secondary index on KEKO, which might help in improving your report performance.
    Also, you can add more conditions in where clause if possible, which will also help in improving performance.
    Thansk,
    Archana

  • Using Bulk operations for INSERT into destination table and delete from src

    Hi,
    Is there any way to expediate the process of data movement?
    I have a source set of tables (with its pk-fk relations) and a destination set of tables.
    Currently my code as of now, is pickin up the single record in cursor from the parentmost table, and then moving the data from other respecitve tables. But this is happening one by one... Is there any way I can make this take less time?
    If I use bulk insert and collections, i will not be able to use the DELETE in the same block for same source record.
    Thanks
    Regards
    Abhivyakti

    Abhivyakti
    I'm not 100% sure how your code flows from what you've stated, but generally you should try and avoid cursor FOR LOOPS and possibly BULK COLLECTING.
    I always follow the sequence in terms of design:
    1. Attempt to use bulk INSERTS, UPDATES and/or DELETES first and foremost. (include MERGE as well!)
    2. If one cannot possibly do the above then USE BULK COLLECTIONS using a combination of RETURNING INTO's and
    FORALL's.
    However, before you follow this method and if you relatively new to Oracle PL/SQL,
    share the reason you cannot follow the first method on this forum, and you're bound to find some
    help with sticking to method one!
    3. If method two is impossible, and there would have to be a seriously good reason for this, then follow the cursor FOR LOOP
    method.
    You can combine BULK COLLECTS with UPDATES and DELETES, but not with INSERTS
    bulk collect into after insert ?
    Another simple example of BULK COLLECTING
    Re: Reading multiple table type objects returned
    P;

  • What are Parameters? How are they differenet from Variables? Why can't we use variables for passing data from one sequnece to another? What is the advantage of using Parameters instead of Variables?

    Hi All,
    I am new to TestStand. Still in the process of learning it.
    What are Parameters? How are they differenet from Variables? Why can't we use variables for passing data from one sequnece to another? What is the advantage of using Parameters instead of Variables?
    Thanks in advance,
    LaVIEWan
    Solved!
    Go to Solution.

    Hi,
    Using the Parameters is the correct method to pass data into and out of a sub sequence. You assign your data to be passed into or out of a Sequence when you are in the Edit Sequence Call dialog and in the Sequence Parameter list.
    Regards
    Ray Farmer

Maybe you are looking for

  • Update Multiple records using NW CE WebDyn Pro 7.2 interface ITEMDETAILS

    We are trying to use SAP Netweaver CE 7.2 and NetWeaver Design Studio 7.2 with the Web Dynpro application interfaces configured to connect to our MDM 7.1 SP06 repositories to develop web screens that allow our end users the ability to maintain MDM re

  • XML- SQL

    Hi, I am trying to store some xml data in sql. There are several levels in the xml file. eg. CREATE TYPE EmployeeType AS OBJECT EMPNO NUMBER(2), SALARY NUMBER(2) CREATE TYPE EmployeeListType AS TABLE OF EmployeeType; CREATE TYPE dept AS OBJECT DEPTNO

  • Missing: burn CD button

    ...in the past, when I have created playlists, there is a "Burn CD" button on the bottom right corner of my Itunes window... for some reason the button is not there and now I am unable to burn CD's - HELP? these playlists are under "my device" - is t

  • Read XML tags

    Hi, I have the below XML <RESULTS> <ROW> <COLUMN NAME="ID">12688f8ac8aa6310VgnVCM10000078ccc70a____</COLUMN> <COLUMN NAME="BRANCH_NAME">Brooklyn</COLUMN> </ROW> </RESULTS> Could somebody please assist me with a way to read the XML tags alone from thi

  • Can connect to VPN but still unable to use the internet

    I have a MacBook Pro 5, 5 Running OS X 10.6.2 i have always been able to join my uni network and use the internet through VPN up until recently, I am not aware of any changes to my computer that could have caused this, i have had ICT Services at the