Select into Temp Table Identity Column

I'm trying to select data into a temp table but how would I select the identity column into my temp table. This is what I have so far(RefId is the identity Column (1,1)
BEGIN TRAN
SELECT [RefId]
,[Name]
,[CreationDate]
,[CreatedBy]
,[ModificationDate]
,[ModifiedBy]
,[RegistrationNumber]
,[EmployerType]
,[EmployerState]
,[ProviderLegalDescription]
,[WeeklySalaryDateType]
,[WeeklySalaryDateDay]
,[FortnightlySalaryDateType]
,[FortnightlySalaryDateDay]
,[MonthlySalaryDateType]
,[MonthlySalaryDateDay]
,[TrustLevel]
,[ForceDeductionOverrides]
,[PayrollPaypointlDeductionsEnabled]
,[PaypointRefId]
,[PayrollBackupEnabled]
,[PayrollBackupFailedPaymentsBefore]
,[PayrollBackupType]
,[PayrollBackupUploadType]
,[PayrollBackupEnableAutomation]
,[PayrollBackupAutomationType]
,[PayrollBackupFtpServer]
,[PayrollBackupFtpPort]
,[PayrollBackupFtpPassword]
,[PayrollBackupEmail]
,[PayrollBackupFtpUsername]
,[EnforceSingleProduct]
,[AffordabilityOverride]
,[AffordabilityReoccuringIncomePercent]
,[AffordabilityAdHocIncomePercent]
,[AffordabilityVariableIncomePercent]
,[AffordabilityNumerator]
,[AffordabilityExposure]
,[ExternalIdentificationNumber]
,[DeductionType]
,[IsValidated]
,[ValidatedBy]
,[ValidatedDate] INTO #TempEmployers FROM Employers WHERE RefId=2
SELECT
Name, COUNT(*) AS Repeats INTO #Temp
FROM
Employers
GROUP BY
Name
HAVING
COUNT(*) > 1
Declare @Nam nvarchar(250)
While (Select Count(*) From #Temp) > 0
Begin
Select Top 1 @Nam = Name From #Temp
--Do some processing here
Delete #Temp Where @Nam = Name
INSERT INTO #TempEmployers
SELECT [RefId]
,[Name]
,[CreationDate]
,[CreatedBy]
,[ModificationDate]
,[ModifiedBy]
,[RegistrationNumber]
,[EmployerType]
,[EmployerState]
,[ProviderLegalDescription]
,[WeeklySalaryDateType]
,[WeeklySalaryDateDay]
,[FortnightlySalaryDateType]
,[FortnightlySalaryDateDay]
,[MonthlySalaryDateType]
,[MonthlySalaryDateDay]
,[TrustLevel]
,[ForceDeductionOverrides]
,[PayrollPaypointlDeductionsEnabled]
,[PaypointRefId]
,[PayrollBackupEnabled]
,[PayrollBackupFailedPaymentsBefore]
,[PayrollBackupType]
,[PayrollBackupUploadType]
,[PayrollBackupEnableAutomation]
,[PayrollBackupAutomationType]
,[PayrollBackupFtpServer]
,[PayrollBackupFtpPort]
,[PayrollBackupFtpPassword]
,[PayrollBackupEmail]
,[PayrollBackupFtpUsername]
,[EnforceSingleProduct]
,[AffordabilityOverride]
,[AffordabilityReoccuringIncomePercent]
,[AffordabilityAdHocIncomePercent]
,[AffordabilityVariableIncomePercent]
,[AffordabilityNumerator]
,[AffordabilityExposure]
,[ExternalIdentificationNumber]
,[DeductionType]
,[IsValidated]
,[ValidatedBy]
,[ValidatedDate] FROM Employers
WHERE Name= @Nam
End
SELECT * FROM #TempEmployers
ROLLBACK

Hi,
Its the RefId column, I just need the actual values. Im getting the following error:
Column name or number of supplied values does not match table definition. And it points to The RefId
Column
If your question is regarding passing explicit values for identity column you need to set IDENTITY_INSERT to ON and pass a columnlist for the table
Which column in this is IDENTITY?
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

Similar Messages

  • Insert into temp table with sorting not works

    Hi,
    Am inserting some of the values into temp table . Before going to insert i will be sorting a cloumn in descending order and then i will try insert. But actually inserts in ascending order.Dont know why.
    Please find the code
    Create table #TempTable( column1 smalldateTime )
    Insert into #TempTable
    Select distinct(column1) from table1 where cloumn2 = 1 order by  column1 desc
    When i query the table
    select * from  #TempTable
    shows the dates are in ascending order instead it should in descending
    But when i query this Select distinct(column1) from table1 where cloumn2 = 1 order by  column1 desc
    dates are in descending order which means recent dates fills top

    Or use a CTE = Common Table Expression:
    CREATE TABLE #test (id int);
    INSERT INTO #test
    SELECT object_id
    FROM sys.objects;
    SELECT COUNT(*)
    FROM #test;
    GO
    ;WITH cte AS
    (SELECT Top 2 *
    FROM #test
    ORDER BY id desc)
    DELETE FROM cte;
    GO
    SELECT COUNT(*)
    FROM #test;
    GO
    DROP TABLE #test;
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • CTE into temp table

    I have query with many CTE:
    ;WITH CTE AS(...), CTE1 AS(....), CTE2 AS (...), CTE3 AS(...)
    CTE4 AS(...), CTE5 AS(...), CTE6 AS(...), CTE7 AS(...), CTE8 AS(...), CTE9 AS(...), CTE10 AS(...), CTE11 AS(...)
    SELECT * FROM CTE9 INNER JOIN CTE11 ON....
    The last select works 3 minutes, but until CTE11 everything works in 1 second.
    Is it possible to store CTE9 and CTE11 into temp table? (the same select form temp tables would execute immediately)
    CTE9 and CTE11 has inside access to previous CTE's, so I can't break the query before CTE11 unless I create every CTE as temp table.

    "I think it is too fragile."
    If I store in physical table instead of temp table than if server go down, at least I will
    have my data stored.
    And it is not critical if this records are not available in main table for some time.
    It could be solution, but requires some maintenance work in case server goes down or any other
    uncatchable error .
    But i guess I will just disable escalation.
    My problem is quite simple. I have table "dbo.Stock" where is stock of products in warehouse. Lets say 1 million of products with some quantity. Each quantity of product has some ownership.
    For example: i have quantity 1000 of product A. 500 quantity belongs to company1, 300 to company2 and 200 to company3.
    Then at some time, I have to rearrange the ownership of lets say 200000 products(20%). (could be any number, more or less).
    Until new ownership is not known, this stock should not be available for any operation - so, it is no problem, if this stock doesn't exists in table "dbo.Stock" at calculation time. But for other stock(800.000 products) all operations must be available.
    So, i move(delete) this 200.000 products out of stock table and calculate ownership. This calculation
    runs for 10 minutes. Then I move this stock back to the table(PK of most of the records is different now, so couldn't be update anyway).
    Can you image that this table is locked for 10 minutes and it is very frequent one? Everything would stop for 10 minutes and i will get fired :)
    What function? Do you have some description? I'm curious, maybe get some idea :)
    Thanks,
    Simon

  • SSIS package takes longer time when inserting data into temp tables

    querying records from one  server  and  inserting them into temp tables is taking longer time.
    are there any setting in package which  enhance the performance .

    will local temp table (#temp ) enhance the performance  ..
    If you're planning to use # tables in ssis make sure you read this
    http://consultingblogs.emc.com/jamiethomson/archive/2006/11/19/SSIS_3A00_-Using-temporary-tables.aspx
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • MS SQL Server 2014: Error inserting into Temp table with index and identity field

    In this thread, I mentioned a problem with SQL Server 2014:
    SQL Server 2014: Bug with IDENTITY INSERT ON
    The question was answered, it is a bug. To keep you informed on this issue, I open this discussion.
    Problem:
    The code below works perfectly fine on MS SQL Server 2008 R2 and MS SQL Server 2012, but gives an error every second time the proc is executed on MS SQL Server 2014. If I do not define any index on the temp table, the problem disappears. Defining the index
    after the insert, does not help.
    SET NOCOUNT ON
    GO
    IF EXISTS (SELECT 1 FROM sys.procedures WHERE name = 'usp_Test') DROP PROC dbo.usp_Test;
    GO
    CREATE PROC dbo.usp_Test AS
    BEGIN
    SET NOCOUNT ON
    CREATE TABLE #Source(ID integer NOT NULL);
    INSERT INTO #Source VALUES (1), (2), (3);
    CREATE TABLE #Dest (ID integer IDENTITY(1,1) NOT NULL);
    CREATE INDEX #IDX_Dest ON #Dest (ID);
    PRINT 'Check if the insert might cause an identity crisis';
    SELECT 'Source' AS SourceTable, * FROM #Source;
    SELECT 'Destination' AS DestTable, * FROM #Dest;
    SET IDENTITY_INSERT #Dest ON;
    PRINT 'Do the insert';
    INSERT INTO #Dest (ID) SELECT ID FROM #Source;
    PRINT 'Insert ready';
    SET IDENTITY_INSERT #Dest OFF;
    SELECT * FROM #Dest;
    DROP TABLE #Source;
    DROP TABLE #Dest;
    END;
    GO
    PRINT 'First execution of the proc, everything OK';
    EXEC dbo.usp_Test;
    PRINT '';
    PRINT 'Second execution of the proc, the insert fails.';
    PRINT 'Removing the index #IDX_Dest causes the error to disappear.';
    EXEC dbo.usp_Test;
    GO
    DROP PROC dbo.usp_Test;
    GO

    There is some progress. Communication from a former Microsoft employee tells us this:
    Shivendra Vishal
    Engineer at Microsoft
    I am no longer with MS, and I do not have code access, however from the public symbols, I could make out following:
    sqlmin!SetidentI2I4+0x1f3:
    000007fe`f4d865d3 488b10 mov rdx,qword ptr [rax] ds:00000000`00000000=????????????????
    ExceptionAddress: 000007fef4d865d3 (sqlmin!SetidentI2I4+0x00000000000001f3)
    ExceptionCode: c0000005 (Access violation)
    ExceptionFlags: 00000000
    NumberParameters: 2
    Parameter[0]: 0000000000000000
    Parameter[1]: 0000000000000000
    Attempt to read from address 0000000000000000
    This is a read AV and from registers it is clear that we were trying to move the value of location pointed by qword of register rax which is not valid:
    rax=0000000000000000 rbx=0000000000000038 rcx=0000000000001030
    rdx=0000000000000006 rsi=00000001f55def98 rdi=00000000106fd070
    rip=000007fef4d865d3 rsp=00000000106fcf40 rbp=00000000106fcfe9
    r8=0000000000000000 r9=00000001f55def60 r10=00000001f55defa0
    r11=00000000106fcd20 r12=0000000000000000 r13=0000000000000002
    r14=00000001f49c3860 r15=00000001f58c0040
    iopl=0 nv up ei pl nz na po nc
    cs=0033 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00010206
    The stack is:
    # Child-SP RetAddr Call Site
    00 00000000`106fcf40 000007fe`f30c1437 sqlmin!SetidentI2I4+0x1f3
    01 00000000`106fd050 000007fe`f474e7ce sqlTsEs!CEsExec::GeneralEval4+0xe7
    02 00000000`106fd120 000007fe`f470e6ef sqlmin!CQScanUpdateNew::GetRow+0x43d
    03 00000000`106fd1d0 000007fe`f08ff517 sqlmin!CQueryScan::GetRow+0x81
    04 00000000`106fd200 000007fe`f091cebe sqllang!CXStmtQuery::ErsqExecuteQuery+0x36d
    05 00000000`106fd390 000007fe`f091ccb9 sqllang!CXStmtDML::XretDMLExecute+0x2ee
    06 00000000`106fd480 000007fe`f08fa058 sqllang!CXStmtDML::XretExecute+0xad
    07 00000000`106fd4b0 000007fe`f08fb66b sqllang!CMsqlExecContext::ExecuteStmts<1,1>+0x427
    08 00000000`106fd5f0 000007fe`f08fac2e sqllang!CMsqlExecContext::FExecute+0xa33
    09 00000000`106fd7e0 000007fe`f152cfaa sqllang!CSQLSource::Execute+0x86c
    0a 00000000`106fd9b0 000007fe`f152c9e8 sqllang!CStmtExecProc::XretLocalExec+0x25a
    0b 00000000`106fda30 000007fe`f152a1d8 sqllang!CStmtExecProc::XretExecExecute+0x4e8
    0c 00000000`106fe1e0 000007fe`f08fa058 sqllang!CXStmtExecProc::XretExecute+0x38
    0d 00000000`106fe220 000007fe`f08fb66b sqllang!CMsqlExecContext::ExecuteStmts<1,1>+0x427
    0e 00000000`106fe360 000007fe`f08fac2e sqllang!CMsqlExecContext::FExecute+0xa33
    0f 00000000`106fe550 000007fe`f0902267 sqllang!CSQLSource::Execute+0x86c
    10 00000000`106fe720 000007fe`f0909087 sqllang!process_request+0xa57
    11 00000000`106feee0 000007fe`f2bf49d0 sqllang!process_commands+0x4a3
    12 00000000`106ff200 000007fe`f2bf47b4 sqldk!SOS_Task::Param::Execute+0x21e
    13 00000000`106ff800 000007fe`f2bf45b6 sqldk!SOS_Scheduler::RunTask+0xa8
    14 00000000`106ff870 000007fe`f2c136ff sqldk!SOS_Scheduler::ProcessTasks+0x279
    15 00000000`106ff8f0 000007fe`f2c138f0 sqldk!SchedulerManager::WorkerEntryPoint+0x24c
    16 00000000`106ff990 000007fe`f2c13246 sqldk!SystemThread::RunWorker+0x8f
    17 00000000`106ff9c0 000007fe`f2c13558 sqldk!SystemThreadDispatcher::ProcessWorker+0x3ab
    18 00000000`106ffa70 00000000`775d59ed sqldk!SchedulerManager::ThreadEntryPoint+0x226
    19 00000000`106ffb10 00000000`7780c541 kernel32!BaseThreadInitThunk+0xd
    1a 00000000`106ffb40 00000000`00000000 ntdll!RtlUserThreadStart+0x21
    Unassembling the function:
    000007fe`f4d8658e 4c8b10 mov r10,qword ptr [rax]
    000007fe`f4d86591 4533e4 xor r12d,r12d
    000007fe`f4d86594 410fb7d5 movzx edx,r13w
    000007fe`f4d86598 4533c9 xor r9d,r9d
    000007fe`f4d8659b 4533c0 xor r8d,r8d
    000007fe`f4d8659e 488bc8 mov rcx,rax
    000007fe`f4d865a1 4489642420 mov dword ptr [rsp+20h],r12d
    000007fe`f4d865a6 41ff5230 call qword ptr [r10+30h]
    000007fe`f4d865aa 8b5597 mov edx,dword ptr [rbp-69h]
    000007fe`f4d865ad 4c8b10 mov r10,qword ptr [rax]
    000007fe`f4d865b0 4489642438 mov dword ptr [rsp+38h],r12d
    000007fe`f4d865b5 4489642430 mov dword ptr [rsp+30h],r12d
    000007fe`f4d865ba 458d442401 lea r8d,[r12+1]
    000007fe`f4d865bf 4533c9 xor r9d,r9d
    000007fe`f4d865c2 488bc8 mov rcx,rax
    000007fe`f4d865c5 c644242801 mov byte ptr [rsp+28h],1
    000007fe`f4d865ca 4488642420 mov byte ptr [rsp+20h],r12b
    000007fe`f4d865cf 41ff5250 call qword ptr [r10+50h]
    000007fe`f4d865d3 488b10 mov rdx,qword ptr [rax] <=================== AV happened over here
    000007fe`f4d865d6 488bc8 mov rcx,rax
    000007fe`f4d865d9 4c8bf0 mov r14,rax
    000007fe`f4d865dc ff5268 call qword ptr [rdx+68h]
    000007fe`f4d865df 488d55e7 lea rdx,[rbp-19h]
    000007fe`f4d865e3 4c8b00 mov r8,qword ptr [rax]
    000007fe`f4d865e6 488bc8 mov rcx,rax
    000007fe`f4d865e9 41ff5010 call qword ptr [r8+10h]
    000007fe`f4d865ed f6450a04 test byte ptr [rbp+0Ah],4
    I remember few issues with scan2ident function, I am not sure if they have fixed it however it appears that this is intoduced to SQL 2014 and we need help from MS to get this resolved as it needs code analysis.
    It is not getting simulated for other versions of SQL apart from SQL 2014.
    Also to add, interestingly, the value of rax is not visibly changed and it was successfully passed on to rcx, which has a valid value, so something should have changed the value of rax inside call to function using call qword ptr [r10+50h], and looking at this
    it appears that it might be a list of functions and we are going at particular offset [50h]. So, bottom line is that the call to function qword ptr [r10+50h], should be changing something in rax, and debugging/analyzing this code might give us some more idea.

  • Select by Location. Select Into.. No column was specified

    Hello.. I am starting out as a new user with Sql Server Express 2012.
    I'm using the information in the AdventureWorks2012 database and
    http://msdn.microsoft.com/en-us/library/ff929109.aspx 
    I can run a select by location from the Person.Address table as illustrated in the documentation.  I want to be able to run a 'SELECT INTO' and I'm stumped on the syntax.  
    -- selecting around a point the 7 most closest around a defined point.
    USE AdventureWorks2012
    GO
    DECLARE @g geography = 'POINT(-121.626 47.8315)';SELECT
    TOP(7) SpatialLocation.ToString(), City
    INTO Person.AddressTest2
    FROM Person.Address
    ORDER BY SpatialLocation.STDistance(@g)
    Problem is in the incorporation of the 'INTO Person.AddressTest2.  I get the 'No column was specified for column1' ERROR.  How do I give a default name to the (No column name)?

    Welll...  Dog gone it..
    Answer is this..  putting the 'location' as the alias into the statement did it.
    I knew that asking would make it work.
    Andy
    -- selecting around a point the 7 most closest around a defined point.
    USE AdventureWorks2012
    GO
    DECLARE @g geography = 'POINT(-121.626 47.8315)';
    SELECT
    TOP(7) SpatialLocation.ToString() location, City
    INTO Person.AddressTest2
    FROM Person.Address
    ORDER BY SpatialLocation.STDistance(@g)

  • How to input data into a table with columns?

    I am trying to input data into a table.  My table have 5 columns and an unlimited amount of rows.  I created a program in LabView that enters the data into the table but it enters all of the data in one row.  I would like to enter the first set of information into the first column, the second set of info into the second  column and so on.  I am including a copy of the program that I am working with.  I would like the number of runs to be put into the first column (it should count down like number 5 in first row, number 4 in second row, number 3 in third row, and so on).  I would like the applied voltage to be placed in the second column, and so on.  Any help or information will be greatly appreciated.  I am working with LabView Version 6.1 and 8.0.  I am submitting the vi from 6.1. 
    Attachments:
    FJ-PROGRAM.vi ‏68 KB

    Pondered,
    I looked at your code and I think you might be making things too complicated. I've included a very simple example that demonstrates how to write a 2D array of integers to a table. Hope you find this helpful. It is in LV 7.1.
    Chris C
    Chris Cilino
    National Instruments
    LabVIEW Product Marketing Manager
    Certified LabVIEW Architect
    Attachments:
    rows - columns.vi ‏17 KB

  • Select into internal table

    Hello abap-gurus,
    I have a small problem when doing a select into an internal table. As i select and append into an internal table, the program dumps as there is not enough memory for the internal table. The SAP-table i'm selecting from is simply too big. So I'm wondering if there is a way to stop or set the max lines in the internal table to say 10000 rows? I would appreciate any example.. the statement looks like this:
    SELECT * INTO l_bdcpv
    FROM  bdcpv
    WHERE not process = 'X'
    AND   mestype = 'ISM_MATMAS'.
    APPEND l_bdcpv TO i_bdcpv.
    ENDSELECT.
    Best regards Ballo

    HI,
    DATA: I_BDPCV LIKE BDPCV OCCURS 0 WITH HEADER LINE.
    SELECT * FROM BDPCV INTO I_BDPCV UP TO 100 ROWS WHERE PROCESS NE 'X' AND MESTYPE = 'ISM_MATMAS'.
    APPEND I_BDPCV.
    ENDSELECT.
    Regards
    CNU

  • Remove all duplicate records and load into temp table

    Hi
    I have a table contains data like this.
    Emp No Designation location
    1111 SE CA
    1111 DE CT
    3456 WE NJ
    4523 TY GH
    We found that there are two duplicate records for emp no: 1111. I want to delete all duplicate records (in this case two records for emp no:1111) and load into the temp table.
    Please advice me how to do it.

    Oh look, you can search the forums...
    http://forums.oracle.com/forums/search.jspa?threadID=&q=delete+duplicates&objID=f75&dateRange=all&userID=&numResults=30

  • Union select over temp table

    Hi,
    I have a question about the best solution in selecting data from two tables and one of it is a temp table.
    If ID is found on both tables, only the temp_table row should be selected. My solution looks like:
    ORIG_TABLE
    PK_ID
    Data1
    Data2
    status_cd
    TEMP_TABLE
    PK_ID
    Data1
    Data2
    status_cd
    select data1, data2, status_cd from ORIG_TABLE
      where pk_id not in (select pk_id from temp_table)
    union
    select data1, data2, status_cd from TEMP_TABLEI wonder if there is an easier way in selecting data like that.
    Thanks ahead,
    Tobias

    Tobias Arnhold wrote:
    I wonder if there is an easier way in selecting data like that.I think your current apporach is probably the best solution (You may want to replace UNION with UNION ALL though depending upon whether you expect (and need or not) duplicate records). You may want to keep an eye on the execution plan of the query using NOT IN if the temp table is a GTT (global temporary table) since maintaining statistics on a GTT can be tricky.
    Edited by: user503699 on Nov 4, 2010 3:20 PM - Added comment about UNION

  • How to insert text data into temp tables....

    Dear All,
    I have one notepad with three columns, first column is segment1, second column is segment2 & third column is price list....
    and there is no delimiter and exact spaces..(i.e, zizak fomat)
    Ex:-
    xx yy 00009999
    kk mmmm 00009333
    Data is available like above example...So, I need to insert this data into one table.(2LAKSHS OF RECORDS AVAILABLE IN THAT NOTEPAD)
    So, Any can one help me, how to insert this kind of text data into temparory table...
    Regards
    Krishna
    Edited by: user12070109 on May 29, 2010 9:48 PM
    Edited by: user12070109 on May 29, 2010 9:49 PM

    Hello,
    What manu suggested this can be done through oracle forms.
    If as i read your last post you are using that in database it will not work in db. Try to use the same process in oracle forms will work by making some changes.
    And if you don't want to use forms then there is one way using SQL LOADER. It required control file to execute for uploading data.
    See the below link.
    http://www.orafaq.com/wiki/SQL*Loader_FAQ
    In this example its showing filename.csv you can use your file name like yourfilename.txt.
    So your control file will look like this...
    load data
    infile 'file_path\file_name.txt'
    into table table_name  -- use actual table name where you want to upload data
    fields terminated by " "  -- Here using spaces as you mentioned           
    (column1, column2, column3)  -- Here use the three column names of tableAnd after creating control file with the above code. You can call it in command prompt like this
    sqlldr username/password control=control_file_path\control_file_name.ctl log=log_file_path\log_file_name.log
    or
    sqlldr username/password@dbconnection control=control_file_path\control_file_name.ctl log=log_file_path\log_file_name.log
    Before doing this practice make sure SQLLDR.exe availabe in the machine where you have to execute. Otherwise you will have to install db client for using sqlldr.exe
    -Ammad

  • Problems when selecting from temp table

    I have a php script wich creates a temporary table with this command:
    "create global temporary table temp_ouput(...)"
    All is ok.
    Then I insert a lot of data and it doesn't complain.
    Then I attempt to select all records but I end up with an empty set. I mean, it doesn't return any records.
    What's wrong here?

    Are you using the ON COMMIT PRESERVE ROWS option? If not, your data will be deleted as soon as you commit after your insert.
    If you do use this option, you need to clear the table yourself if you are re-using the temp table within your session.

  • How do i insert into temp table

    Hi ALL,
    I have a table APP
    APP_I Acronym Desc
    1 ACC Accounts
    PLTFRM
    swr_pltfrm_i swr_pltfrm_x swr_pltfrm_typ_x
    1 AIX-JAVA Execution
    2 COBOL/BATCH Execution
    3 COBOL/CICS Execution
    4 CONSULTWORKS/MOBILE Delivery
    5 CONSULTWORKS Delivery
    PLTFRM_APP_ENVT
    swr_pltfrm_i app_i
    1 1
    2 1
    3 1
    4 1
    5 1
    I want to create one temporary tab
    TEMP_insert(app_i,desc, acrnymc ,delivery,execution) which have this columns
    App_i desc acrnymc execution
    1 Accounts ACC AIX-JAVA,COBOL/BATCH,COBOL/CICS
    delivery
    CONSULTWORKS,CONSULTWORKS/MOBILE
    How do i insert the row in to the Temp_Insert table based on APP_I as input to my stored procedure.
    Thanks

    hopefully this will help
    dev>declare
      2      cursor c is select empno,ename,job from emp where deptno=20 and rownum<3;
      3      str varchar2(100);
      4  begin
      5      for cur in c loop
      6          str:=str||' '||cur.ename||' '||cur.job;
      7      end loop;
      8      insert into emp_test (ename) VALUES(str);
      9  end; 
    10  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.00
    dev>select ename from emp_test;
    ENAME
    SMITH CLERK JONES MANAGER
    [pre                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Select into another table

    Hello -
    I'm running Oracle 8.1.7.4. Is there a way to run a query and automatically load the results into a newly created table? For example, my secondary table currently does not exist. I want to run a query, and at the same time, create and load the secondary table with the query results.
    Thanks.

    A utilização da clausula storage (initial value integer) pode melhorar o desempenho no momento da criação da tabela, pois evita a extensão automática do segmento no momento da carga, segue um exemplo:
    create table teste
    storage (initial 2048 k) /*para ser mais preciso verifique o tamanho do segmento tabela1 e substitua o valor initial da clausula storage */
    as select * from tabela1 nologging

  • SQL Select into Nested Table

    Hi,
    I would like to be able to store results of a query in the database. So far, I believe the best method is to store it as a nested table so that I may refer to it by criteria (e.g. date, name, etc.). I am somewhat new to Oracle and I'm not sure how to do this.
    The query will always return the same columns, so that should make it easier for me. Also, I need to be able to query the data that is stored into an APEX report region.
    Can someone tell me if this is the best method to do this? Also, is there a tutorial anywhere that explains how to do what I want?
    Thanks in advance,
    -David

    would like to be able to store results of a query in the database. So far,
    I believe the best method is to store it as a nested table so that I may refer
    to it by criteria (e.g. date, name, etc.). I am somewhat new to Oracle and
    I'm not sure how to do this.Given that you're new to Oracle how did you decide the best approach was a nested table? As most people who know anything at all about Oracle would take the opposite view (as Dan has done).
    Let's drill down into your requirements some more. How long do what to retain the results for? Do you want to retain the results of many queries? If so, will these queries be the same shape (same number and type of columns) or will they be different? Do you want one user to be able to see the results of another user's queries? Do you want to associate metadata with these result sets?
    In fact, why do you want to be able to store these result sets at all? Oracle is actually pretty good at caching data, especially in 11g. So you may be re-inventing a wheel and designing it wonky at that.
    Cheers, APC
    Blog : http://radiofreetooting.blogspot.com/

Maybe you are looking for

  • Apps / Game Center / Iphone 6 Plus wont sync

    I received my new iPhone yesterday , I synced my "old" iPhone 4s to iTunes , then proceeded to transfer the data to my new iPhone 6 plus. Game Center transferred fine , however when I open a game app , it's starts me, as if I just downloaded the app

  • Skype asking for renewal but date not due yet

    I wrote on here a few weeks ago and am still awaiting a reply.  I took out one year's subscription - unlimited landline calls in UK - last October 2011.  Why is Skype threatening to cancel me when my renewal date is months away???  Please reply.

  • Is there any best practice or standard for database object naming ?

    Hi Thank you for reading my post is there any standard or best practice for databse objects naming ? for example how should we name columns of a table ? should it be like TOTAL_VOTE or TOTALVOTE and many other items. Thanks

  • WUT-133 Error Message is showing in different languages??

    I have a user that is showing the WUT-133 error in French in the English environment and I am showing the English message in both environments??? Is there a setting in the webutil.cfg or formsweb.cfg file to set? Thanks, Terry

  • Bridge CS3: Stars gone!

    I have been using bridge for years, and have always had the option of clicking the stars below the thumbnails to rate my photos. While I still do have the option of using the pull down menu to rate my images, the little stars below the images are not