Gui_Download export to excel delivering only one row in excel output

Hello,
I am using Vista Os with the SAP front end logon 710 and Office 2007. Also my company is using Ecc6.0 in the server.
I am able to export the Itab data to excel but all the rows are on the first row in Excel.
If i have 3 rows in ITAB then all the 3 rows are on the First row of Excel
I have supplied these parameters
filename = 'C:\ITAB2XLS.xls'
FILETYPE = 'ASC'
WRITE_FIELD_SEPARATOR = 'X'
SHOW_TRANSFER_STATUS = 'X'
tables
data_tab = itab[]
FIELDNAMES = headingTab[]
Is anyone having the same issue like me ?
Thanks.

Hi,
I tried commenting the Field seperator but it didnt change anything. I am still having the same problem.
I am pasting my code sample.
data:begin of itab occurs 0,
grp type c,
val type i,
end of itab.
data:begin of headingTab occurs 0,
TEXT(10) type c,
end of headingTab.
itab-grp = 'A'.
itab-val = 100.
append itab.
itab-grp = 'B'.
itab-val = 200.
append itab.
headingTab-text = 'GROUP'.
append headingTab.
headingTab-text = 'VALUE'.
append headingTab.
call function 'GUI_DOWNLOAD'
exporting
filename = 'C:\ITAB2XLS.xls'
FILETYPE = 'DAT'
WRITE_FIELD_SEPARATOR = 'X'
SHOW_TRANSFER_STATUS = 'X'
tables
data_tab = itab[]
FIELDNAMES = headingTab[]
I think there is some problem with the Vista / Office 2007 with SAP.
Any suggestions?

Similar Messages

  • One to many to return only one row

    hi guys,
    i have an urgent problem here. i have a sql statement like below;
    SELECT ALM_SWAP2_REP.M_TP_RTMFRP0, ALM_SWAP2_REP.M_TP_RTMFRP1,
    ALM_SWAP2_REP.M_TP_RTMFRF0, ALM_SWAP2_REP.M_TP_RTMFRF1,
    To_Char(TRN_HDR_DBF.M_OPT_FLWFST,'YYYYMMDD') AS VALDATE, ALM_SWAP2_REP.M_TP_RTFXC02,
    ALM_SWAP2_REP.M_TP_RTFXC12, TRN_HDR_DBF.M_BRW_NOMU1, TRN_HDR_DBF.M_BRW_NOMU2,
    ALM_SWAP2_REP.M_TP_RTAMC02, ALM_SWAP2_REP.M_TP_RTAMC12,
    (CASE WHEN PAY_FLOW_DBF.M_LEG = 0 AND '20100831' BETWEEN To_Char(PAY_FLOW_DBF.M_CALC_DATE0,'YYYYMMDD') AND To_Char(PAY_FLOW_DBF.M_CALC_DATE1,'YYYYMMDD') THEN To_Char(PAY_FLOW_DBF.M_CALC_DATE1,'YYYYMMDD') END) AS RCV_DATE,
    (CASE WHEN PAY_FLOW_DBF.M_LEG = 1 AND '20100831' BETWEEN To_Char(PAY_FLOW_DBF.M_CALC_DATE0,'YYYYMMDD') AND To_Char(PAY_FLOW_DBF.M_CALC_DATE1,'YYYYMMDD') THEN To_Char(PAY_FLOW_DBF.M_CALC_DATE1,'YYYYMMDD') END) AS PAY_DATE
    FROM ALM_SWAP2_REP, TRN_HDR_DBF, PAY_FLOW_DBF WHERE ALM_SWAP2_REP.M_REF_DATA = 456576
    AND ALM_SWAP2_REP.M_NB = TRN_HDR_DBF.M_NB
    AND ALM_SWAP2_REP.M_NB = PAY_FLOW_DBF.M_TRN_ID
    AND ALM_SWAP2_REP.M_NB = 228128
    AND '20100831' BETWEEN To_Char(PAY_FLOW_DBF.M_CALC_DATE0,'YYYYMMDD') AND To_Char(PAY_FLOW_DBF.M_CALC_DATE1,'YYYYMMDD')
    ORDER BY ALM_SWAP2_REP.M_TRN_GRP, ALM_SWAP2_REP.M_NB
    When I join few tables, the results are returned in two rows because I have two records that in table PAY_FLOW_DBF that matches one row in table ALM_SWAP2_REP. I need these two matches but I want it to be returned in only one row without using group by. Pls help me. Thankls

    user9274041 wrote:
    i have an urgent problem here.http://www.oracle.com/html/terms.html
    >
    4. Use of Community Services
    Community Services are provided as a convenience to users and Oracle is not obligated to provide any technical support for, or participate in, Community Services. While Community Services may include information regarding Oracle products and services, including information from Oracle employees, they are not an official customer support channel for Oracle.
    You may use Community Services subject to the following: (a) Community Services may be used solely for your personal, informational, noncommercial purposes; (b) Content provided on or through Community Services may not be redistributed; and (c) personal data about other users may not be stored or collected except where expressly authorized by Oracle
    >
    Could you explain how something that is for your personal, informational, noncommercial purposes can be urgent?
    Or is this a violation of the terms of use and abuse of these forums?

  • Selecting only one row at a time

    Hi experts,
    i have following doubt regarding selecting rows from a db:
    Is there any way of selecting only one row AT A TIME from a dabase just to collect the data in rows instead of in a unique document containing all the rows?
    I would like you to ellaborate on this as i need to send only one row to the IE, and then other row, and so on... without throwing any error!
    I have seen that there are SELECT SINGLE and SELECT UP TO 1 ROW, but these two methods are only useful when retrieving only one row, and that does not match my requirements. I need to process all the rows but one by one..
    I know that we can use the receiver jdbc adapter as if it was a sender by means of its specific datatype, but how to do it row by row??
    Hope i had explained well..
    Thanks in advance and best regards,
    David

    Hi kiran,
    Yes, my table has 5 not null fields but i am selecting and updating fixes values so i think that I will definetely go for the next solution:
    SELECT * FROM t1 WHERE status='0' and ROWNUM<2;
    UPDATE t1 SET status='1' WHERE status='0' and ROWNUM<2;
    My only concern is if the update will take the same row that the select.... BTW, I think it will
    ..What do you guys think?
    I ve been trying to operate with your proposed queries but i received some errors. Your queries are very interesting but i think that with the above ones i meet my requirements as the status field will be 0 for not processed rows and 1 for precessed ones (and the update will look for the row that meets the same 'where' clause than the select, and then, and only then, it will set status='1').
    The only thing i have to care about is what i questioned before.
    Thanks a lot and best regards,
    David

  • Way to rollback only one row of a view object

    Is there a way to "rollback" only one row of a view object? That is, two or more rows have been modified but we wish to only restore one of the rows to the original (database) values.
    Is there a way to retain all of the current rows in all of the view objects for an application module after issuing a jbo:Rollback?
    Thanks

    Is there a way to "rollback" only one row of a view object? That is, two or more rows have been modified but we wish to only restore one of the rows to the original (database) values.In jdev903, a new method is being added to Row interface to reset the row state to the transaction-original state i.e., rollback the row to it's original values.
    Is there a way to retain all of the current rows in all of the view objects for an application module after issuing a jbo:Rollback?No. You may however override before/afterRollback methods on the ViewObjectImpl subclasses to cache the current row key in beforeRollback and restore currency on the default iterator to that rowkey in afterRollback
    Thanks

  • Select event not triggered in table with only one row

    Hi all,
    I am building a BI VC application where query data is displayed in a table. When the user clicks on a table row another query is then triggered and output in a second table. The output from table 1 is linked to the input of query2/table2 with a select event.
    The problem that I am facing is that if there is only one row in table 1, the select event is never triggered. If, however there are two or more rows in the table the select event is triggered and query 2 is executed. I have searched the forums but all I could find on select event problems was how to avoid the initial select event.
    Has anyone else experienced this issue and what is the workaround or is this a bug in Visual Composer? We are on VC 7.0 SP19.
    Cheers,
    Astein Meland

    Thanks Chittya,
    Yes we have considered this option as well. But as we have more than one table linked together we would like to avoid having to manually click several buttons.
    In the end I found Note 1364334 describing bugfixes released in VC 7.0 SP20:
    "Normally, when a Visual Composer table is populated from a data service, the first row is selected by default. However, we have found that if only one data row is returned from the data service, this row is not selected by default and cannot be manually selected by clicking on it either."
    So I think we will just have to upgrade our Portal to the latest support packs to solve this problem.
    Thanks,
    Astein

  • Issue with Selection Listener when the table has only one row

    Hi All ,
    I have developed a table in which I am using Selection Listener to perform some task when any row is selected.
    It is working fine when I have more than 1 row in the table, but when I have only one row in the table , the selection listener do not call the corresponding method in bean.
    I understand that selection event will be raised only when the row is changed, but in the use case when only one row is there, what should be done to make the selection listener work ?
    In the selection listener I have written code to make the selected row as current row , and perform the required task.
    Please suggest a way out for this situation.
    Thanks in advance.

    Hi,
    try removing this attr from table
    selectedRowKeys="#{bindings.xxx_VO1.collectionModel.selectedRow}"

  • Oracle database link to MySQL select only one row

    Hello,
    I have created a connection from the Oracle batabase 11.2 to a MySQL database via database link. The following statement shows, that 35 rows are in the mySQL table:
    SQL>  select count(*) from "main_pages"@MOREWEB;
      COUNT(*)
            35
    But a normal select statement only return 1 row.
    SQL> select "subject" from "main_pages"@MOREWEB;
    subject
    Übersicht: Referenzen
    I am using the mysql-connector-odbc-3.51.30-winx64 driver. A newer version cann't be installed because on Windows Server 2008 R2 I get an error with an missing dll-file. The DataDirect-ODBC-driver is not possible, because we like to use the free MySQL-database an DataDirect only support the enterprise edition.
    I also have tried to limit the HS_OPEN_CURSORS or dont limit the HS_FDS_FETCH_ROWS, but there is no difference in the result. I always get only one row.
    HS Init.ora
    # This is a sample agent init file that contains the HS parameters that are
    # needed for the Database Gateway for ODBC
    # HS init parameters
    HS_FDS_CONNECT_INFO = moreweb
    HS_FDS_TRACE_LEVEL = ON
    HS_FDS_FETCH_ROWS=1
    # Environment variables required for the non-Oracle system
    #set <envvar>=<value>
    HS tracefile
    Oracle Corporation --- MITTWOCH   NOV 05 2014 13:56:22.066
    Heterogeneous Agent Release
    11.2.0.1.0
    Oracle Corporation --- MITTWOCH   NOV 05 2014 13:56:22.066
        Version 11.2.0.1.0
    HOSGIP for "HS_FDS_TRACE_LEVEL" returned "ON"
    HOSGIP for "HS_OPEN_CURSORS" returned "50"
    HOSGIP for "HS_FDS_FETCH_ROWS" returned "1"
    HOSGIP for "HS_LONG_PIECE_TRANSFER_SIZE" returned "65536"
    HOSGIP for "HS_NLS_NUMERIC_CHARACTER" returned ".,"
    HOSGIP for "HS_KEEP_REMOTE_COLUMN_SIZE" returned "OFF"
    HOSGIP for "HS_FDS_DELAYED_OPEN" returned "TRUE"
    HOSGIP for "HS_FDS_WORKAROUNDS" returned "0"
    HOSGIP for "HS_FDS_MBCS_TO_GRAPHIC" returned "FALSE"
    HOSGIP for "HS_FDS_GRAPHIC_TO_MBCS" returned "FALSE"
    HOSGIP for "HS_FDS_RECOVERY_ACCOUNT" returned "RECOVER"
    HOSGIP for "HS_FDS_TRANSACTION_LOG" returned "HS_TRANSACTION_LOG"
    HOSGIP for "HS_FDS_TIMESTAMP_MAPPING" returned "DATE"
    HOSGIP for "HS_FDS_DATE_MAPPING" returned "DATE"
    HOSGIP for "HS_FDS_CHARACTER_SEMANTICS" returned "FALSE"
    HOSGIP for "HS_FDS_MAP_NCHAR" returned "TRUE"
    HOSGIP for "HS_FDS_RESULTSET_SUPPORT" returned "FALSE"
    HOSGIP for "HS_FDS_RSET_RETURN_ROWCOUNT" returned "FALSE"
    HOSGIP for "HS_FDS_PROC_IS_FUNC" returned "FALSE"
    HOSGIP for "HS_FDS_REPORT_REAL_AS_DOUBLE" returned "FALSE"
    using mpgw as default value for "HS_FDS_DEFAULT_OWNER"
    HOSGIP for "HS_SQL_HANDLE_STMT_REUSE" returned "FALSE"
    SQL text from hgopars, id=1, len=36 ...
         00: 53454C45 43542043 4F554E54 282A2920  [SELECT COUNT(*) ]
         10: 46524F4D 20606D61 696E5F70 61676573  [FROM `main_pages]
         20: 60204131                             [` A1]
    Deferred open until first fetch.
    Performing delayed open.
    SQL text from hgopars, id=1, len=40 ...
         00: 53454C45 43542041 312E6073 75626A65  [SELECT A1.`subje]
         10: 63746020 46524F4D 20606D61 696E5F70  [ct` FROM `main_p]
         20: 61676573 60204131                    [ages` A1]
    Deferred open until first fetch.
    Performing delayed open.
    Please can help me someone.
    Thanks.
    Bianca

    mxallen wrote:
    Bianca,
    If you log directly into MySQL and issue the same query (select "subject" from "main_pages";) what data is returned?
    I looks to me that you count is the number of rows in the entire table "main_pages"
    while you select is for the data in the "subject" column only.
    This seems to indicate that you have just one row in that subject column.
    Regards,
    Matt
    WHAATT?
    What do you mean by "just one row in that subject column"?
    That makes no sense at all.  A row is a row.  A column is a part of a row.  All rows have all columns, though not all columns of all rows will necessarily have an assigned value.  Lacking a WHERE clause to filter rows, any SELECT should return all rows.

  • SQL Server 2012 Undetected Deadlock in a table with only one row

      We have migrated our SQL 2000 Enterprise Database to SQL 2012 Enterprise few days ago.
      This is our main database, so most of the applications access it.
      The day after the migration, when users started to run tasks, the database access started to experiment a total failure.
      That is, all processes in the SQL 2k12 database were in lock with each other. This is a commom case of deadlock, but the Database Engine was unable to detect it.
      After some research, we found that the applications were trying to access a very simple table with only one row. This table has a number that is restarted every day and is used to number all the transactions made against the system.   So, client
    applications start a new transaction, get the current number, increment it by one and commit the transaction.
      The only solution we found was to kill all user processes in SQL Server every time this situation occurs (no more than 5 minutes when all clients are accessing the database).
      No client application was changed in this migration and this process was working very well for the last 10 years.
      The problem is that SQL 2k12 is unable to handle this situation compared to SQL 2k.
      It seems to occurs with other tables too, but as this is an "entry table" the problem occurs with it first.
      I have searched internet and some suggest some workarounds like using table hints to completely lock the table at the begining of the transaction, but it can't be used to other tables.
      Does anyone have heard this to be a problem with SQL 2k12? Is there any fixes to make SQL 2k12 as good as SQL 2k?

    First off re: "Unfortunatelly, this can't be used in production environment as exclusive table lock would serialize the accesses to tables and there will be other tables that will suffer with this problem."
    This is incorrect. 
    Using a table to generate sequence numbers like this is a bad idea exactly because the access must be serialized.  Since you can't switch to a SEQUENCE object, which is the correct solution, the _entire goal_ of this exercise to find a way to properly
    serialize access to this table.  Using exclusive locking will not be necessary for all the tables; just for the single-row table used for generating sequence values with a cursor.
    I converted the sample program to VB.NET:
    Public Class Form1
    Private mbCancel As Boolean = False
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    Dim soConn As ADODB.Connection
    Dim soRst As ADODB.Recordset
    Dim sdData As Date
    Dim slValue As Long
    Dim slDelay As Long
    'create database vbtest
    'go
    ' CREATE TABLE [dbo].[ControlNumTest](
    ' [UltData] [datetime] NOT NULL,
    ' [UltNum] [int] NOT NULL,
    ' CONSTRAINT [PK_CorreioNumTeste] PRIMARY KEY CLUSTERED
    ' [UltData] Asc
    ' )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80) ON [PRIMARY]
    ' ) ON [PRIMARY]
    mbCancel = False
    Do
    ' Configure the Connection object
    soConn = New ADODB.Connection
    With soConn
    .ConnectionString = "Provider=SQLNCLI11;Initial Catalog=vbtest;Data Source=localhost;trusted_connection=yes"
    .IsolationLevel = ADODB.IsolationLevelEnum.adXactCursorStability
    .Mode = ADODB.ConnectModeEnum.adModeReadWrite
    .CursorLocation = ADODB.CursorLocationEnum.adUseServer
    .Open()
    End With
    ' Start a new transaction
    Call soConn.BeginTrans()
    ' Configure the RecordSet object
    soRst = New ADODB.Recordset
    With soRst
    .ActiveConnection = soConn
    .CursorLocation = ADODB.CursorLocationEnum.adUseServer
    .CursorType = ADODB.CursorTypeEnum.adOpenForwardOnly
    .LockType = ADODB.LockTypeEnum.adLockPessimistic
    .Open("SELECT * FROM dbo.ControlNumTest")
    End With
    With soRst
    sdData = .Fields!UltData.Value ' Read the last Date (LOCK INFO 1: See comments bello
    slValue = .Fields!UltNum.Value ' Read the last Number
    If sdData <> Date.Now.Date Then ' Date has changed?
    sdData = Date.Now.Date
    slValue = 1 ' Restart number
    End If
    .Fields!UltData.Value = sdData ' Update data
    .Fields!UltNum.Value = slValue + 1 ' Next number
    End With
    Call soRst.Update()
    Call soRst.Close()
    ' Ends the transaction
    Call soConn.CommitTrans()
    Call soConn.Close()
    soRst = Nothing
    soConn = Nothing
    txtUltNum.Text = slValue + 1 ' Display the last number
    Application.DoEvents()
    slDelay = Int(((Rnd * 250) + 100) / 100) * 100
    System.Threading.Thread.Sleep(slDelay)
    Loop While mbCancel = False
    If mbCancel = True Then
    Call MsgBox("The test was canceled")
    End If
    Exit Sub
    End Sub
    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
    mbCancel = True
    End Sub
    End Class
    And created the table
    CREATE TABLE [dbo].[ControlNumTest](
    [UltData] [datetime] NOT NULL,
    [UltNum] [int] NOT NULL,
    CONSTRAINT [PK_CorreioNumTeste] PRIMARY KEY CLUSTERED
    [UltData] Asc
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = on, FILLFACTOR = 80) ON [PRIMARY]
    ) ON [PRIMARY]
    go insert into ControlNumTest values (cast(getdate()as date),1)
    Then ran 3 copies of the program and generated the deadlock:
    <deadlock>
    <victim-list>
    <victimProcess id="processf27b1498" />
    </victim-list>
    <process-list>
    <process id="processf27b1498" taskpriority="0" logused="0" waitresource="KEY: 35:72057594039042048 (a01df6b954ad)" waittime="1970" ownerId="3181" transactionname="implicit_transaction" lasttranstarted="2014-02-14T15:49:31.263" XDES="0xf04da3a8" lockMode="X" schedulerid="4" kpid="9700" status="suspended" spid="51" sbid="0" ecid="0" priority="0" trancount="2" lastbatchstarted="2014-02-14T15:49:31.267" lastbatchcompleted="2014-02-14T15:49:31.267" lastattention="1900-01-01T00:00:00.267" clientapp="vbt" hostname="DBROWNE2" hostpid="21152" loginname="NORTHAMERICA\dbrowne" isolationlevel="read committed (2)" xactid="3181" currentdb="35" lockTimeout="4294967295" clientoption1="671088672" clientoption2="128058">
    <executionStack>
    <frame procname="adhoc" line="1" stmtstart="80" sqlhandle="0x020000008376181f3ad0ea908fe9d8593f2e3ced9882f5c90000000000000000000000000000000000000000">
    UPDATE [dbo].[ControlNumTest] SET [UltData]=@Param000004,[UltNum]=@Param000005 </frame>
    <frame procname="unknown" line="1" sqlhandle="0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000">
    unknown </frame>
    </executionStack>
    <inputbuf>
    (@Param000004 datetime,@Param000005 int)UPDATE [dbo].[ControlNumTest] SET [UltData]=@Param000004,[UltNum]=@Param000005 </inputbuf>
    </process>
    <process id="processf6ac9498" taskpriority="0" logused="10000" waitresource="KEY: 35:72057594039042048 (a01df6b954ad)" waittime="1971" schedulerid="5" kpid="30516" status="suspended" spid="55" sbid="0" ecid="0" priority="0" trancount="1" lastbatchstarted="2014-02-14T15:49:31.267" lastbatchcompleted="2014-02-14T15:49:31.267" lastattention="1900-01-01T00:00:00.267" clientapp="vbt" hostname="DBROWNE2" hostpid="27852" loginname="NORTHAMERICA\dbrowne" isolationlevel="read committed (2)" xactid="3182" currentdb="35" lockTimeout="4294967295" clientoption1="671156256" clientoption2="128058">
    <executionStack>
    <frame procname="adhoc" line="1" sqlhandle="0x020000003c6309232ab0edbe0a7790a816a09c4c5ac6f43c0000000000000000000000000000000000000000">
    FETCH API_CURSOR0000000000000001 </frame>
    <frame procname="unknown" line="1" sqlhandle="0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000">
    unknown </frame>
    </executionStack>
    <inputbuf>
    FETCH API_CURSOR0000000000000001 </inputbuf>
    </process>
    </process-list>
    <resource-list>
    <keylock hobtid="72057594039042048" dbid="35" objectname="vbtest.dbo.ControlNumTest" indexname="PK_CorreioNumTeste" id="lockff6e6c80" mode="U" associatedObjectId="72057594039042048">
    <owner-list>
    <owner id="processf6ac9498" mode="S" />
    <owner id="processf6ac9498" mode="U" requestType="wait" />
    </owner-list>
    <waiter-list>
    <waiter id="processf27b1498" mode="X" requestType="convert" />
    </waiter-list>
    </keylock>
    <keylock hobtid="72057594039042048" dbid="35" objectname="vbtest.dbo.ControlNumTest" indexname="PK_CorreioNumTeste" id="lockff6e6c80" mode="U" associatedObjectId="72057594039042048">
    <owner-list>
    <owner id="processf27b1498" mode="U" />
    <owner id="processf27b1498" mode="U" />
    <owner id="processf27b1498" mode="X" requestType="convert" />
    </owner-list>
    <waiter-list>
    <waiter id="processf6ac9498" mode="U" requestType="wait" />
    </waiter-list>
    </keylock>
    </resource-list>
    </deadlock>
    It's the S lock that comes from the cursor read that's the villian here.  U locks are compatible with S locks, so one session gets a U lock and another gets an S lock.  But then the session with an S needs a U, and the session with a U needs an
    X.  Deadlock. 
    I'm not sure what kind of locks were taken by this cursor code on SQL 2000, but on SQL 2012, this code is absolutely broken and should deadlock.
    The right way to fix this code is to add (UPDLOCK,SERIALIZABLE) to the cursor
    .Open("SELECT * FROM dbo.ControlNumTest with (updlock,serializable)")
    So each session reads the table with a restrictive lock, and you don't mix S, U and X locks in this transaction.  This resolves the deadlock, but requires a code change.
    I tried several things that didn't require a code, which did not resolve the deadlock;
    1) setting ALLOW_ROW_LOCKS=OFF ALLOW_PAGE_LOCKS=OFF
    2) SERIALIZABLE isolation level
    3) Switching OleDB providers from SQLOLEDB to SQLNCLI11
    Then I replaced the table with a view containing a lock hint:
    CREATE TABLE [dbo].[ControlNumTest_t](
    [UltData] [datetime] NOT NULL,
    [UltNum] [int] NOT NULL,
    CONSTRAINT [PK_CorreioNumTeste] PRIMARY KEY CLUSTERED
    [UltData] Asc
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = on, FILLFACTOR = 80) ON [PRIMARY]
    ) ON [PRIMARY]
    go
    create view ControlNumTest as
    select * from ControlNumTest_t with (tablockx)
    Which, at least in my limited testing, resovlved the deadlock without any client code change.
    David
    David http://blogs.msdn.com/b/dbrowne/

  • How to select only one row

    hello,
    i've got a select query which returns a couple of rows.
    now i would like for the query to return only one row (the first match it can find).
    how do i do that?
    thank you!
    my sample of my data as below , the first and seconde record is equal and i want to display all the colomn for the first row and ignore the second row .
    84A8E46E8C97     9410     20110812
    84A8E46E8C97     9420     20110813
    84A8E46E8C6E     9410     20110816
    84A8E46E8AFA     9400     20110819

    876602 wrote:
    my sample of my data as below , the first and seconde record is equal and i want to display all the colomn for the first row and ignore the second rowThere is no row order in relational database tables. Same query canreturn rows in different order next time you run it unless you specify ORDER BY. Only ORDER BY guarantees order, so when you say first row/second row you must provide ordering criteria.
    SY.

  • How to restrict only one row in Table ??.

    Hi all,
    i want to restrict no. of rows to one,
    that is not more that one row should be there in the table.
    Following trigger works well in all conditions
    except:
    insert into myTab select 'x' from emp;
    inserts 14 rows.
    Create or replace trigger one_row_myTab
    before insert on myTab
    for each row
    declare
    cnt number;
    pragma AUTONOMOUS_TRANSACTION;
    Begin
    select count(*) into cnt from mydual;
    if cnt=1 then
    raise_application_error(-20001,'MyDual Can have only one Row');
    end if;
    end;
    i think with trigger it w't be possible because,
    same transaction triggers c't query the table (Mutating Table),
    Autonomus trans ca't identify uncommited changes.
    pls add your suggestions.
    Thanks for Reading the Post.
    Rajashekhar Ganga,
    mail : [email protected]

    nice try Mulder ! it doesn't work everywhere...
    SQL> connect scott/tiger@lsc69
    Connected to:
    Oracle7 Server Release 7.3.4.5.0 - Production
    With the distributed and parallel query options
    PL/SQL Release 2.3.4.5.0 - Production
    SQL>  create table d as select * from dual;
    Table created.
    SQL> create index i on d(1);         
    create index i on d(1)
    ERROR at line 1:
    ORA-00904: invalid column name
    SQL> connect scott/tiger@lsc65
    Connected to:
    Oracle8i Enterprise Edition Release 8.1.7.4.0 - 64bit Production
    JServer Release 8.1.7.4.0 - 64bit Production
    SQL> create table d as select * from dual;
    Table created.
    SQL> create index i on d(1);         
    Index created.
    SQL> connect scott/tiger@lsc68
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - 64bit Production
    With the Partitioning and Data Mining options
    SQL> create table d as select * from dual
    Table created.
    SQL> CREATE UNIQUE INDEX i on d(1);                  
    CREATE UNIQUE INDEX i on d(1)
    ERROR at line 1:
    ORA-03113: end-of-file on communication channel

  • Condition that takes only one row with the maximum cost of the maximum date

    I have to the following query
    SELECT distinct b.segment1 ||'.'|| b.segment2 as ITEM,
           so.vendor_site_id as SUPPLIER,
           'VE' as ORIGIN_COUNTRY_ID,
           replace(round(l.mto_costo_neto/l.can_unidades_empaque,2),',','.') as UNIT_COST,
           5 as lead_time,
           null as pickup_lead_time,
           l.can_unidades_empaque as supp_pack_size,
           1 as inner_pack_size,
           'C' as round_lvl,
           50 as ROUND_TO_INNER_PCT,
           50 as ROUND_TO_CASE_PCT,
           50 as ROUND_TO_LAYER_PCT,
           50 as ROUND_TO_PALLET_PCT,
           null as MIN_ORDER_QTY,
           null as MAX_ORDER_QTY,
           'FLAT' as PACKING_METHOD,
           'N' as PRIMARY_SUPP_IND,
           'Y' as PRIMARY_COUNTRY_IND,
           case when b.primary_unit_of_measure like '%KG%' then 'KG'
                when b.primary_unit_of_measure like '%Kg%' then 'KG'
                when b.primary_unit_of_measure like '%UND%' then 'EA'
                when b.primary_unit_of_measure = 'Kilogramo' then 'KG'
                when b.primary_unit_of_measure = 'Litro' then 'L'
                when b.primary_unit_of_measure = 'Unidad' then 'EA'
                else null
           end as DEFAULT_UOP,
           1 as TI,
           1 as HI,
           null as SUPP_HIER_TYPE_1,
           null as SUPP_HIER_LVL_1,
           null as SUPP_HIER_TYPE_2,
           null as SUPP_HIER_LVL_2,
           null as SUPP_HIER_TYPE_3,
           null as SUPP_HIER_LVL_3,
           null as CREATE_DATETIME,
           null as LAST_UPDATE_DATETIME,
           null as LAST_UPDATE_ID,
           case when b.primary_unit_of_measure like '%KG%' then 'KG'
                when b.primary_unit_of_measure like '%Kg%' then 'KG'
                when b.primary_unit_of_measure like '%UND%' then 'EA'
                when b.primary_unit_of_measure = 'Kilogramo' then 'KG'
                when b.primary_unit_of_measure = 'Litro' then 'L'
                when b.primary_unit_of_measure = 'Unidad' then 'EA'
                else null
           end as COST_UOM,
           null as TOLERANCE_TYPE,
           null as MAX_TOLERANCE,
           null as MIN_TOLERANCE
    FROM mrp.mrp_sr_assignments sr , MRP.MRP_SR_RECEIPT_ORG ro , MRP.MRP_SR_SOURCE_ORG so,
         inv.mtl_system_items_b b, lcm.cmp_lineas_cotizacion l
    WHERE sr.SOURCING_RULE_ID = ro.SOURCING_RULE_ID
          and ro.SR_RECEIPT_ID = so.SR_RECEIPT_ID
          and sr.inventory_item_id in ((select inventory_item_id  from TMP.VIVERES_VEGETALES)
                                      UNION ALL
                                      (select inventory_item_id  from TMP.GENERICOS)
                                      UNION ALL
                                      (select inventory_item_id from TMP.HIJOS_GENERICOS))
          and sr.inventory_item_id = b.inventory_item_id
          and b.organization_id = 136
          and sr.inventory_item_id = l.cod_producto_idI need to agregate the following condition
    For example, The following query
    SELECT l2.fec_ini_vigencia_costo, l2.mto_costo_neto, l2.can_unidades_empaque, l2.cod_producto,
           REPLACE(ROUND(l2.mto_costo_neto/l2.can_unidades_empaque,2),',','.')  costo_unidad
    from cmp_lineas_cotizacion l2
    order by cod_producto, fec_ini_vigencia_costo desc, mto_costo_neto descgenerate
    FEC_INI_VIGENCIA_COSTO     MTO_COSTO_NETO     CAN_UNIDADES_EMPAQUE     COD_PRODUCTO      COSTO_UNIDAD
    17/06/2010     382.56     12     1.1000008     31.88 -- THIS ONE
    17/06/2010     382.56     12     1.1000008     31.88
    17/06/2010     371.0832     12     1.1000008     30.92
    17/06/2010     371.0832     12     1.1000008     30.92
    18/05/2009     382.56     12     1.1000008     31.88
    04/05/2009     245.82     12     1.1000008     20.49
    13/04/2009     382.56     12     1.1000008     31.88
    23/03/2009     373.2072     12     1.1000008     31.1
    23/03/2009     373.2072     12     1.1000008     31.1I need to take only one row with the maximum FEC_INI_VIGENCIA with the maximum COSTO_UNIDAD of the table lcm.cmp_lineas_cotizacion l, which is calculated with the formula ROUND(l2.mto_costo_neto/l2.can_unidades_empaque,2)

    A better example
    I need only one row the maximum COSTO_UNIDAD for the maximum FEC_INI_VIGENCIA for every cod_producto_id in the table lcm.cmp_lineas_cotizacion
    I need to take these values
    FEC_INI_VIGENCIA_COSTO     MTO_COSTO_NETO     CAN_UNIDADES_EMPAQUE     COD_PRODUCTO_ID  COSTO_UNIDAD
    17/06/2010     382.56     12     1.1000008     31.88 -- THIS!
    17/06/2010     382.56     12     1.1000008     31.88
    17/06/2010     371.0832     12     1.1000008     30.92
    17/06/2010     371.0832     12     1.1000008     30.92
    18/05/2009     382.56     12     1.1000008     31.88
    04/05/2009     245.82     12     1.1000008     20.49
    13/04/2009     382.56     12     1.1000008     31.88
    17/06/2010     382.56     12     1.1000008     31.88
    17/06/2010     382.56     12     1.1000008     31.88
    17/06/2010     371.0832     12     1.1000008     30.92
    17/06/2010     371.0832     12     1.1000008     30.92
    18/05/2009     382.56     12     1.1000008     31.88
    04/05/2009     245.82     12     1.1000008     20.49
    13/04/2009     382.56     12     1.1000008     31.88
    27/10/2010     1171.549344     12     1.1000009     97.63 -- THIS!
    13/10/2010     1171.549344     12     1.1000009     97.63
    06/09/2010     1171.549344     12     1.1000009     97.63
    02/08/2010     1048.825056     12     1.1000009     87.4
    28/07/2010     754.8     12     1.1000009     62.9
    27/07/2010     614.04     12     1.1000009     51.17
    21/06/2010     954.84     12     1.1000009     79.57
    27/05/2010     614.04     12     1.1000009     51.17
    07/07/2009     1143.17     12     1.1000010     95.26
    28/03/2009     1143.17     12     1.1000010     95.26
    27/10/2008     1744.644672     12     1.1000010     145.39
    01/07/2008     1690.12224     12     1.1000010     140.84
    07/07/2009     1143.17     12     1.1000010     95.26             --THIS!
    28/03/2009     1143.17     12     1.1000010     95.26
    27/10/2008     1744.644672     12     1.1000010     145.39
    01/07/2008     1690.12224     12     1.1000010     140.84
    07/07/2009     1143.17     12     1.1000010     95.26
    28/03/2009     1143.17     12     1.1000010     95.26
    27/10/2008     1744.644672     12     1.1000010     145.39
    01/07/2008     1690.12224     12     1.1000010     140.84

  • Merge only one row out of multiple rows

    I need to prepare a merge statement which merge only one row in to a table. Below is the table definition, sample data and merge statement i used.
          CREATE TABLE Mob_Attr (NAME VARCHAR2(20), ATTR_1 VARCHAR2(20), ATTR_2 VARCHAR2(20), ATTR_3 VARCHAR2(20));
          CREATE TABLE Mob_Desc (NAME VARCHAR2(50), ATTR_1 VARCHAR2(20), ID NUMBER(20));     
          CREATE TABLE Mob_Main (NAME VARCHAR2(20), ATTR VARCHAR2(20), ID VARCHAR2(10));     
          insert into Mob_Attr(name, attr_1, attr_2,attr_3) values ('n1','aa',null,null);
          insert into Mob_Attr(name, attr_1, attr_2,attr_3) values ('n2','bb',null,null);
          insert into Mob_Attr(name, attr_1, attr_2,attr_3) values ('n3','cc',null,null);
          insert into Mob_Attr(name, attr_1, attr_2,attr_3) values ('n4','dd',null,null);
          insert into Mob_Desc (NAME,ATTR_1,ID) values ('n1','aa',10);
          insert into Mob_Desc (NAME,ATTR_1,ID) values ('n1','aa',15);
          insert into Mob_Desc (NAME,ATTR_1,ID) values ('n1','aa',123);
          insert into Mob_Desc (NAME,ATTR_1,ID) values ('n1','aa',1455);
          insert into Mob_Desc (NAME,ATTR_1,ID) values ('n2','bb',455);
          insert into Mob_Desc (NAME,ATTR_1,ID) values ('n2','bb',135);
          insert into Mob_Desc (NAME,ATTR_1,ID) values ('n3','cc',15);
          insert into Mob_Desc (NAME,ATTR_1,ID) values ('n3','cc',52);
          insert into Mob_Desc (NAME,ATTR_1,ID) values ('n4','dd',1455);
          merge into Mob_Main ma using
          (select d.name, d.attr_1,d.id from Mob_Attr a, Mob_Desc d
          where a.name = d.name and a.attr_1 = d.attr_1
          ) q on (ma.name=q.name and ma.attr=q.attr_1)
          when not matched then
          insert (NAME,ATTR,ID)
          values (q.name,q.attr_1,q.ID);
          Above merge statement will actually merge entire data . But i want the first row will only get inserted to the base table (Mob_Main). If we take name 'n1' first row from table Mob_Desc with ID as '10' only should get inserted. I can go for a cursor to do this as i have huge data volume i prefer merge instead.

    MERGE INTO Mob_Main ma
         USING (SELECT d.name, d.attr_1, d.id
                  FROM Mob_Attr a, Mob_Desc d
                 WHERE a.name = d.name AND a.attr_1 = d.attr_1 AND id = 10
                UNION
                SELECT d.name, d.attr_1, d.id
                  FROM Mob_Attr a, Mob_Desc d
                 WHERE a.name = d.name AND a.attr_1 = d.attr_1 AND id != 10
                       AND NOT EXISTS
                                  (SELECT 1
                                     FROM Mob_Desc d1
                                    WHERE     d.name = d1.name
                                          AND d.attr_1 = d1.attr_1
                                          AND d1.id = 10)) q
            ON (ma.name = q.name AND ma.attr = q.attr_1)
    WHEN NOT MATCHED
    THEN
       INSERT     (NAME, ATTR, ID)
           VALUES (q.name, q.attr_1, q.ID);
    COMMIT;
    select *
    from Mob_Main
    order by name, id;
    NAME                 ATTR                 ID       
    n1                   aa                   10       
    n2                   bb                   135      
    n2                   bb                   455      
    n3                   cc                   15       
    n3                   cc                   52       
    n4                   dd                   1455     
    6 rows selected.

  • Missing rows / output only one row in a Report after applying patchset 2

    Hi.
    We use Reports Builder for 10g R2. We had the problem with our AS 10g R2 on windows 2003, that some reports creates duplicate rows when it is a ASCII report (desformat = delimited), see Bug 3340546.
    Now we apply Patchset 2 on a local machine, to test the functionality. It fix the problem (look in metalink doc ID 398955.1 under "2.12 Oracle Reports Developer Bugs")-
    But now most csv reports creates only one row instead of multiple rows.
    We run reports on our local machine with OC4N and local started Form (via Forms Builder) to generate the reports (local started report server) from DevSuite).
    When we start the reports with desformat=delimited the txt-file has only the header row and one data row (instead of multiple ones).
    And when we generate the same report with desformat=delimiteddata it looks fine and generates all rows as expected.
    We found neither here in the forum or in metalink knowledge base nor on the internet.
    Have you any suggestions for us how to fix this problem?
    Using delimiteddata is now acceptable solution for us, because delimited is easier to use.
    Thanks for your help!

    Hey folks.
    We have solved the problem. :)
    We applied PatchSet2 for 10gR2. But we don´t know how the csv-report outputs only 1 data-row instead of several rows.
    Than we create a similar report (with the same sql-query) as a new one with the reports builder assistant.
    This one works pretty fine. So we looked for the attributes and see the "max. number datasets for each site" and it was in the new one set to 0 and in our old one set to 1.
    So we change this and ... the old one works pretty fine! :)
    So the problem is, that this attribute does not had any consequences in the old version. But since we update with PatchSet 2 it respect this attribute but we don´t "see" it.
    Hope this helps others.

  • Grant to update only one row

    Hi all,
    I'm working with an 10.2.0.3 Oracle Enterprise version.
    I need to create a new user on my database with permission to update only one row on table.
    Have you notice if this is possible? In case, how is the grant to do this?
    Regards,
    dbajug

    Try this:
    SQL> create user usr1 identified by usr1;
    User created.
    SQL> create user usr2 identified by usr2;
    User created.
    SQL> grant connect, resource to usr1,usr2;
    Grant succeeded.
    SQL> conn usr1/usr1
    Connected.
    SQL> create table t (id number);
    Table created.
    SQL> insert into t values(1);
    1 row created.
    SQL> insert into t values(2);
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> grant update on t to usr2;
    Grant succeeded.
    SQL> create or replace trigger trg_t
      2  before update on t
      3  for each row
      4  begin
      5  if :old.id>1 then
      6  raise_application_error(-22299,'You cant change the specific value ');
      7  end if;
      8  end;
      9  /
    Trigger created.
    SQL> update usr1.t set id=2 where id=1;
    1 row updated.
    SQL> update usr1.t set id=2 where id=2;
    update usr1.t set id=2 where id=2
    ERROR at line 1:
    ORA-21000: error number argument to raise_application_error of -22299 is out of
    range
    ORA-06512: at "USR1.TRG_T", line 3
    ORA-04088: error during execution of trigger 'USR1.TRG_T'
    SQL>

  • Display only one row for distinct columns and with multiple rows their valu

    Hi,
    I have a table having some similar rows for some columns and multiple different rows for some other columns
    i.e
    o_mobile_no o_doc_date o_status d_mobile_no d_doc_date d_status
    9825000111 01-jan-06 'a' 980515464 01-feb-06 c
    9825000111 01-jan-06 'a' 991543154 02-feb-06 d
    9825000111 01-jan-06 'a' 154845545 10-mar-06 a
    What i want is to display only one row for above distinct row along with multiple non distinct colums
    ie
    o_mobile_no o_doc_date o_status d_mobile_no d_doc_date d_status
    9825000111 01-jan-06 'a' 980515464 01-feb-06 c
    991543154 02-feb-06 d
    154845545 10-mar-06 a
    regards,
    Kumar

    Re: SQL Help

Maybe you are looking for

  • Startflightrecording: any way to get methods deeper stack traces?(dept 64)

    I'm using jrcmd PID start_flightrecording in order to get some useful samplings, but it seems the stack traces are limited to depth 64 (i.e. in the Hot Methods's Predecessors view of JRockit Mission Control 4.1.0 I see only the last 64 frames) hence

  • I want to sell my old macbook air, what is the best way to get my files and programs off of it?

    I am going to sell my macbook air (2011) as I am replacing it with a macbook pro retina. I want to remove my files and programs from it before I sell it. What is the best way to go about this?

  • FLVplayer Buffering bar doesn't work

    I have used a standard flv player (actionscript 3) component, standard skin, but when I add a buffering bar, the bar just runs through the whole movie. When I set up an actionscript 2 file and use the as2 components the buffer bar works as expected.

  • Select item "sent to back"

    I am trying to select an item that I have sent to the back. I can't select it no matter how hard I try. I am working from a blank template. What am I doing wrong? The deal is I have students creating a calendar and they are creating a background my u

  • Mac book pro has crashed?????

    as of now, when I turn on my macbook pro, the screen remains black (as if it is of) and the release button light, lights up repeatedly. I tried to start it from the 10.6 snow leopard disc to no avail any other suggestions? it is covered by my apple p