Inconsistency in Bdoc sequence

Hello,
we added some z-fields to smokna1 and hence to capgen_object_write. We face problems with the distribution of the contents of the z-filds. Data entered on one client gets saved in the CRM Server but is not saved on other clients altough the data is in the bdoc.
We found that the sequencial position of the fields of the bdoc is not continous.In the BDoc, the fields are in order till positon 91. Then it starts from 104.
We generated the Bdoc automatically. Does someone know a way to change the sequence to be in order?
Thanks
Wiliam C.
Message was edited by:
        Wiliam C. Haltenhoff

Hi Kaushal,
what Anusha posted today in her answer is right. We found this solution by chance. After removing the 'use map' flag in sbdm the sequence was in order and the bdocs were processed fine.
In our tests we also found out, that the meta data on the clients has not to be generated again. Only by transporting the flag deletion to our QA-System it worked there also.
Best regards.

Similar Messages

  • Inconsistent behavior in TestStand and TestStand UI for the same sequence file

    Solved!
    Go to Solution.

    I tried both the TopLevelVI and testexec.exe; but both of them were giving the same error. I never tried any other UI than Labview. 
    Because the same sequence was working without any issue on some other system, I uninstalled and reinstalled TestStand 4.0 and same sequence is now working fine, in TestStand, testexec.exe, TopLevelVI – basically everywhere. I am not sure what was wrong with TestStand in my system, but definitely something wasn’t correct. 
    Thank you for all the responses.
    Vidula
    Message Edited by Vidula S. on 08-26-2009 10:28 AM

  • Inconsistent sequence numbers generated

    We just ran into an unexplained occurrence using a sequence table.
    Suddenly it started assigning id number millions higher than the sequence it was previously filling. As you can see in the log the original range was in the 19 million area and then it began inserting values in the 28 million range.
    Here is the id sequence it put in (I realize these are not exactly sequential because it does not commit them in the same order it allocates them.)
    Previous transaction
    many ids, the last one is...
    19712292
    Problematic transaction
    28064436 ---> ???
    19741496
    19728823
    19742100
    19741852
    28064408 ---> ???
    19726424
    28064433 ---> ???
    19737253
    etc...
    I have no idea where these 28 million series numbers came from. It was a large transaction but I certainly did not insert 9 million rows.

    I have some occasional spawned threads that read, but only the primary thread writes.
    No JTA
    Yes they are in the same transaction
    Yes the same thread, session and connection are used by both. Here is a portion of the log.
    [TopLink Fine]: 2007.04.28 08:15:37.208--UnitOfWork(25076495)--Connection(29197673)--Thread(Thread[AJPRequestHandler-RMICallHandler-1,5,RequestThreadGroup])--INSERT INTO Q_TBL (ID, ALIAS) VALUES (28064436, 'a')
    [TopLink Fine]: 2007.04.28 08:15:37.230--UnitOfWork(25076495)--Connection(29197673)--Thread(Thread[AJPRequestHandler-RMICallHandler-1,5,RequestThreadGroup])--INSERT INTO Q_TBL (ID, ALIAS) VALUES (19741496, 'b')
    [TopLink Fine]: 2007.04.28 08:15:37.236--UnitOfWork(25076495)--Connection(29197673)--Thread(Thread[AJPRequestHandler-RMICallHandler-1,5,RequestThreadGroup])--INSERT INTO Q_TBL (ID, ALIAS) VALUES (19728823, 'c')
    [TopLink Fine]: 2007.04.28 08:15:37.241--UnitOfWork(25076495)--Connection(29197673)--Thread(Thread[AJPRequestHandler-RMICallHandler-1,5,RequestThreadGroup])--INSERT INTO Q_TBL (ID, ALIAS) VALUES (19742100, 'd')
    [TopLink Fine]: 2007.04.28 08:15:37.247--UnitOfWork(25076495)--Connection(29197673)--Thread(Thread[AJPRequestHandler-RMICallHandler-1,5,RequestThreadGroup])--INSERT INTO Q_TBL (ID, ALIAS) VALUES (19741852, 'e')
    [TopLink Fine]: 2007.04.28 08:15:37.252--UnitOfWork(25076495)--Connection(29197673)--Thread(Thread[AJPRequestHandler-RMICallHandler-1,5,RequestThreadGroup])--INSERT INTO Q_TBL (ID, ALIAS) VALUES (28064408, 'f')
    [TopLink Fine]: 2007.04.28 08:15:37.259--UnitOfWork(25076495)--Connection(29197673)--Thread(Thread[AJPRequestHandler-RMICallHandler-1,5,RequestThreadGroup])--INSERT INTO Q_TBL (ID, ALIAS) VALUES (19726424, 'g')
    [TopLink Fine]: 2007.04.28 08:15:37.264--UnitOfWork(25076495)--Connection(29197673)--Thread(Thread[AJPRequestHandler-RMICallHandler-1,5,RequestThreadGroup])--INSERT INTO Q_TBL (ID, ALIAS) VALUES (28064433, 'h')
    [TopLink Fine]: 2007.04.28 08:15:37.270--UnitOfWork(25076495)--Connection(29197673)--Thread(Thread[AJPRequestHandler-RMICallHandler-1,5,RequestThreadGroup])--INSERT INTO Q_TBL (ID, ALIAS) VALUES (19737253, 'i')

  • The sequence in producion order is inconsistent with that in routing sap

    Hi All:
      I meet some problem.For one material,the sequence of the component is 2,but the sequence has  been changed to be 0.Please help me to find the reason.Thanks.

    I want to add one point that : the material is a configurable material  to which one class has been assigned.

  • BI IP Executing planning sequence via process chain not possible

    Hi,
    we use BI IP and have defined a process chain (RSPC) with value type process planning sequence. When we execute it, we get error message
    "Inconsistent input parameter (parameter: <unknown>, value <unknown>)"
    When we execute this planning sequence via the modeller or via SE38 RSPLS_PLSEQ_EXECUTE everything works fine. I thougt the cause could be the user of the job itself (job is executed with different user, and variant of planning sequence is user-dependent!), but I changed the user in the job itself as well without results.
    any thoughts?
    regards
    D
    null

    Hi,
    I executed with my user and have a SAP_ALL authorization. Perhaps it could be because we use authorisation with the old method (4.0) (-> I'm not sure on this). I also think it has to do with authorization. I'll check this out with our authorization consultant.
    D

  • How can I know if a certain tick in a sequence has been reached during playback?

    I'm using the sequencer to play a sequence and I need to jump to an other part of the sequence when a certain tick is reached. Imagine a loop that when we reach tick number "y" we jump back to tick number "x". But I'm not doing a loop so the built in looping methods won't work for me because sometimes I have to jump forward and that is not allowed .
    At the moment I'm using a swing timer that fires a getTickPosition() every millisecond until I reach my desired tick but this is giving me slightly inconsistent results and I have a feeling it is using a lot of CPU for a fairly simple task.
    I wish there was an event listener that would notify me when a certain tick is processed by the sequencer or even if I could be notified each time a new tick is processed so that I can do a check to see if it was the tick I was waiting for.
    I wonder how the sequencer does it internally for knowing when the loop end is.
    Any suggestions or workarounds would be greatly appreciated.

    Just to make it more clear, the SQL we were looking for is this:
    Select
    From
      OJDT
    Where
      OJDT.TransId Not In ( Select VPM2.DocEntry From VPM2 Where VPM2.InvType = 30 )
      And
      OJDT.TransType = 30

  • Sequence w 23.976 fps exporting as h.264 QT with 22.69fps

    I exported an h.264 QuickTime from Premiere Pro CC (Mac).  The project/sequence was set to 23.976 fps.  The export settings for the QuickTime was also set to 23.976 fps. However, the QuickTime that was created had a frame rate of 22.69fps.  I have never had an issue like this before. 
    I had Premiere add the QuickTime to the project on export.  That QuickTime file displayed 23.976 fps in the Premiere Pro Project Panel.  However, the same QuickTime is showing as 22.69fps on the QuickTime inspector in QuickTime, as well as a third party application. 
    The odd thing is, after several attempts with the above set up, sometimes the exported QuickTime has the correct frame rate of 23.976 fps and sometimes the exported QuickTime has a frame rate of 22.69fps (incorrect), so it is not consistent.
    I have reported this issue to Adobe. The Adobe tech, via a screen sharing session, also noticed this inconsistency first-hand and agreed there was an issue of some kind.
    Does anyone have any ideas what could be going on?

    any ideas what could be going on?
    You're using QuickTime.  It's buggy.

  • How to use new sequence when one is reached its maxvalue in PL SQL code

    Hi,
    Currently, I am populating a unique product serial number in a table column using a sequence call to generate new number. For different products, I have different sequences and in my PL SQL code usiing IF..Else block I populate serial number for different products. For one most selling product sequence, we are reaching a Max value in production in a month and to make sure that application will continue to work fine for various end users without getting any error on their screens, I want my code to switch to new sequence automatically. I just need to add another if condition but my problem is how to find accurately when max value is reached for old sequence.
    As call to old sequence can happen in different sessions there could be inconsistency and can end up at error. My new sequence value has to start with AV1000. Please suggest.
    My old sequence look like this :
    SEQUENCE Prd
    INCREMENT BY 1
    START WITH AS1000
    MAXVALUE AS9999
    MINVALUE AS1000
    CYCLE NOCYCLE
    CACHE 2
    Order Yes;
    Edited by: user11695088 on Jul 15, 2009 12:14 AM

    Catch the exception and use your new sequence. But somehow, I'm not liking your alternative approach.
    SQL> set line 300
    SQL> set pages 50000
    SQL> set serveroutput on
    SQL> create sequence testing_seq increment by 1 start with 1 maxvalue 3
      2  /
    Sequence created.
    SQL>
    SQL> create or replace procedure test_seq_proc(p_seq out number)
      2  is
      3  begin
      4     select testing_seq.nextval
      5     into p_seq
      6     from dual;
      7  --
      8     dbms_output.put_line(p_seq);
      9  --
    10  end;
    11  /
    Procedure created.
    SQL> declare v_out number;
      2  begin
      3     test_seq_proc(v_out);
      4  end;
      5  /
    1
    PL/SQL procedure successfully completed.
    SQL> /
    2
    PL/SQL procedure successfully completed.
    SQL> /
    3
    PL/SQL procedure successfully completed.
    SQL> /
    declare v_out number;
    ERROR at line 1:
    ORA-08004: sequence TESTING_SEQ.NEXTVAL exceeds MAXVALUE and cannot be instantiated
    ORA-06512: at "ETL_ADMIN.TEST_SEQ_PROC", line 4
    ORA-06512: at line 3
    SQL>Cheers
    Sarma.

  • Planning sequence in Process chain

    HI,
        I have used Planning sequence in process chain, But while executing it, it throws a following message
    "Inconsistent input parameter (parameter: <unknown>, value <unknown>)""
    Any Guess??
    Regards,
    Meiy

    HI,
          I have created a planning sequence in IP. I wanted to execute it in Process chain. While executing in process chain it throws a error which is mentioned above.
    Regards,
    meiy

  • Error in SMW01:Allocation of the tax for country RO, sequence 1, value 0 no

    Hi,
    when materials are replicated we found a queue existing in SMQ1 and SMQ2.
    When i have checked in SMW01 for the Log it showed me the error "Allocation of the tax for country RO, sequence 1, value 0 not possible"
    Then i clicked on Show BDoc Message Ext.data It showed around 20 materials.I ahve checked the material in R3 there is no sales view for this material type itself.
    i tried to replicate one of those material manually then it is replicated.
    Can anyone guide me why system showed "Allocation of the tax for country RO, sequence 1, value 0 not possible" this message even there is no problem with material?
    Is there any Trasaction to find the exact material which is creating problem?
    kindly suggest me few points on this how to solve this kind of error in future
    regards
    subbu

    Hello Subbu,
    There is a txn:CRM_TAXCUST_VALIDATE which would help you to figure out any issues with Tax customizing.
    Please exceute this txn and you would come to know the list of erroneous tax customizing.
    Also,
    in CRM table CRMC_TAX_MAP for country RO,check whether any  records have been                
    maintained for Access Sequence (i.e LFDNR) 1.
                                                                                    Please check the following customization in txn:SPRO.                                                                               
    CRM->Basic Functions->Taxes->Basic Settings->Tax Types and Tax Groups->            
    Assign Tax Groups to SAP ECC Tax Classifications (Product).                                                                               
    For example: If there are entries for Country RO for sequence 1 and                
    value 0 there must also be correpsonding  entries in R/3 table MLAN and            
    vice versa.                                                                               
    Also,I kindly advice you to go through the documentaion of                         
    "Assign Tax Groups to SAP ECC Tax Classifications (Product)" in CRM,               
    which is present in the above mentioned SPRO navigation.                                                                               
    Also,                                                                               
    *If you are not sure about the sequence of the taxes, you can check it             
    in SAP ECC, in Customizing for Sales and Distribution (SD), by choosing            
    Basic Functions -> Taxes -> Define Tax Determination Rules.                                                                               
    Hope this helps!
    Best Regards,
    Shanthala Kudva.

  • File to idocs - sequence of inbound processing

    Hi everybody,
    we have a file to (2) idocs scenario. In XI we map the received data of vendors into two idocs (adrmas and cremas). After building the idocs we send them in that sequence to the reveiver systems (recommended). The problem is that in the receiver system very often the idoc cremas wants to be processed before adrmas is ready. This leads to the error "vendor xy is blocked by user sapale". Especially for massprocessing I get a lot of these error-messages in bd87. As workaround I processed all the error-idocs by the report rbdmani2. (First step adrmas - second step cremas) But then I face missing data in some cases in table lfa1 - which seems to me that the sequence of 1. adrmas and 2. cremas was not correct processed.
    Is there a possibility for inbound processing with the rule process adrmas - wait until ready - process the associated cremas and so on?
    I checked the sap-help article for seralisation - but we could not achieve a better result by queing the outgoing messages in the xi.
    Thanks very much.
    With kind regards
    Jörg

    You have to get a solution based on the following concepts
    1. Do not use BPM it is not efficient
    2. Understand what is the difference between an IDOC in received state and processed state. Received state mean IDOC is saved into IDOC table. Processed state mean IDOC processed into the business system.
    3. You can ASK BASIS guy to turn on the immediate IDOC processing option in SAP system,so that SAP process the IDOC as soon as it arrive in IDOC table. This is not efficient, in case if your SAP system has to process SAP online client request and SAP document (inbound and outbound) same time.
    4. Understand the concept of standard based integration, mean integration system provide the option to business parties to provide the successfull message transfer.
    Based on all these points I recomend you to follow the steps below.
    1. Extract each record from the input files into two idocs.
    2. Send the first IDOC to the receiving system
    3. Send the second IDOC to a ESB storage such as DATABASE, JMS Queue, MQ Series Q (if you have available) or even to another File.
    4. Develop an RFC module to check the status of the IDOC being send to the receiving system. Status here mean whether the IDOC data processed into the business system. You can do this lookup using a custom RFC lookup using the attribute connecting the first IDOC record with second IDOC.
    5. Process the records (second IDOC) from the intermediate storage using the RFC lookup into the business system updates its status as ready to deliver.
    6. Using another process such as FILE to IDOC or JMS to IDOC or JDBC to IDOC send each record which are ready to process from intermediate storage to the receiving system.
    7. Create a report using FILE or JMS, JDBC adaptor module to keep track of these three stage processing, so that in case an inconsistency happed you will have an auditing trace available.
    This is the standard based integration approach.
    ABAP guys, BASIS guys they may not get it when then repair a BMW in local auto workshop, cuz I had to fight with them 4 years ago to make it happen in Verizon supply chain project where I had to accomplish the same concept in SAME IDOCS you mentioned here.
    BPM, turning on immediate processing of IDOCS etc will end up in buying another 16 CPU hardware and BASIS guys or ABAP guys running BAD record IDOC processing report for 350.00 hr consulting FEES.
    SAP is a good company and XI is a good product, as long as it is being used as per right usage.

  • A problem with inconsistent datatypes

    Whenever I try inserting a new record of type t_cliente_societa in my Cliente table, I get ORA-00932 inconsistent datatypes error and I'm not able to find the reason.
    Could anyone help me? Thanks in advance.
    I'll post my SQL code here. please ignore member functions for I havent' included the code necessary to create the needed tables.
    I defined some types useful for storing informations about the entities I have to deal with.
    The main type is t_cliente and its subtypes are t_cliente_pers and t_cliente_soc.
    I use polymorphism to insert records based on subtypes instancies into a table based on supertype.
    When I would add a new t_cliente_pers record, first I add it into Persona table and then into Cliente table.
    The latter contains a REF to Persona for I have several "persons" who aren't "clients" and I use a single table to store them all.
    create or replace TYPE t_indirizzo AS OBJECT (
    via VARCHAR(45),
    numero NUMBER(4),
    cap INTEGER(5),
    citta VARCHAR(30),
    provincia VARCHAR(30),
    regione VARCHAR(30),
    MEMBER FUNCTION indirizzoCompleto RETURN VARCHAR
    create or replace TYPE t_telefono AS OBJECT (
    num_tel NUMBER(15)
    create or replace TYPE t_telefono_array IS VARRAY(3) OF t_telefono
    create or replace TYPE t_anagrafica AS OBJECT (
    nome VARCHAR(45),
    cognome VARCHAR(45),
    sesso CHAR(1),
    cod_fiscale VARCHAR(16),
    data_nascita DATE
    create or replace TYPE t_ragioneSociale AS OBJECT (
    nome_soc VARCHAR(45),
    data_cost DATE,
    part_iva NUMBER(11)
    create or replace TYPE t_persona AS OBJECT (
    dati_anagrafici t_anagrafica,
    indirizzo t_indirizzo,
    email VARCHAR(45),
    telefono t_telefono_array
    create or replace TYPE t_societa AS OBJECT (
    ragione_sociale t_ragioneSociale,
    indirizzo t_indirizzo,
    email VARCHAR(45),
    telefono t_telefono_array,
    persona_rif t_persona
    create or replace TYPE t_cliente AS OBJECT (
    cod_cliente NUMBER(8),
    MEMBER FUNCTION incFatti RETURN NUMBER,
    MEMBER FUNCTION incSubiti RETURN NUMBER,
    MEMBER FUNCTION incFattiPeriodo RETURN NUMBER,
    MEMBER FUNCTION incSubitiPeriodo RETURN NUMBER,
    MEMBER FUNCTION nomeCliente RETURN VARCHAR,
    MEMBER FUNCTION tipoCliente RETURN VARCHAR
    ) NOT FINAL
    CREATE OR REPLACE TYPE BODY t_cliente AS
    MEMBER FUNCTION incFatti RETURN NUMBER
    IS incidenti NUMBER;
    BEGIN
    SELECT count(i. cod_incidente) INTO incidenti
    FROM Incidenti i, Mezzi m
    WHERE SELF.cod_cliente = m.possessore.cod_cliente AND m.num_targa = i.mezzo. num_targa AND i. responsabilita = ‘c’;
    RETURN (incidenti);
    END;
    MEMBER FUNCTION incSubiti RETURN NUMBER
    IS incidenti NUMBER;
    BEGIN
    SELECT count(i. cod_incidente) INTO incidenti
    FROM Incidenti i, Mezzi m
    WHERE SELF.cod_cliente = m.possessore.cod_cliente AND m.num_targa = i.mezzo. num_targa AND i. responsabilita = ‘s’;
    RETURN (incidenti);
    END;
    MEMBER FUNCTION incFattiPeriodo (da DATE, a DATE) RETURN NUMBER
    IS incidenti NUMBER;
    BEGIN
    SELECT count(i. cod_incidente) INTO incidenti
    FROM Incidenti i ,Mezzi m
    WHERE SELF. cod_cliente = m.possessore.cod_cliente AND m. num_targa = i.mezzo. num_targa AND i. responsabilita = ‘c’ AND (i.data BETWEEN da and a);
    RETURN (incidenti);
    END;
    MEMBER FUNCTION incSubitiPeriodo (da DATE, a DATE) RETURN NUMBER
    IS incidenti NUMBER;
    BEGIN
    SELECT count(i. cod_incidente) INTO incidenti
    FROM Incidenti i ,Mezzi m
    WHERE SELF. cod_cliente = m.possessore.cod_cliente AND m. num_targa = i.mezzo. num_targa AND i. responsabilita = ‘s’ AND (i.data BETWEEN da and a);
    RETURN (incidenti);
    END;
    MEMBER FUNCTION nomeCliente RETURN VARCHAR
    IS
    BEGIN
    RETURN TO_CHAR(cod_cliente);
    END;
    MEMBER FUNCTION tipoCliente RETURN VARCHAR
    IS
    BEGIN
    RETURN (‘u’);
    END;
    END ;
    create or replace TYPE t_cliente_pers UNDER t_cliente (
    persona REF t_persona,
    OVERRIDING MEMBER FUNCTION nomeCliente RETURN VARCHAR,
    OVERRIDING MEMBER FUNCTION tipoCliente RETURN VARCHAR
    ) NOT FINAL
    CREATE OR REPLACE TYPE BODY t_cliente_pers AS
    MEMBER FUNCTION nomeCliente RETURN VARCHAR
    IS nc VARCHAR(90) ;
    BEGIN
    SELECT concat(p.dati_anagrafici.nome, concat(' ',p.dati_anagrafici.cognome)) INTO nc
    FROM d;
    RETURN (nc);
    END;
    MEMBER FUNCTION tipoCliente RETURN VARCHAR
    IS
    BEGIN
    RETURN (‘p’);
    END;
    END ;
    create or replace TYPE t_cliente_soc UNDER t_cliente (
    societa t_societa,
    OVERRIDING MEMBER FUNCTION nomeCliente RETURN VARCHAR,
    OVERRIDING MEMBER FUNCTION tipoCliente RETURN VARCHAR
    ) NOT FINAL
    CREATE OR REPLACE TYPE BODY t_cliente_soc AS
    MEMBER FUNCTION nomeCliente RETURN VARCHAR
    IS
    BEGIN
    RETURN (ragione_sociale.nome_soc);
    END;
    MEMBER FUNCTION tipoCliente RETURN VARCHAR
    IS
    BEGIN
    RETURN (‘s’);
    END;
    END ;
    CREATE TABLE persona OF t_persona(
    dati_anagrafici NOT NULL,
    indirizzo NOT NULL,
    email NOT NULL,
    telefono NOT NULL,
    PRIMARY KEY (dati_anagrafici.cod_fiscale)
    CREATE TABLE cliente OF t_cliente(
    PRIMARY KEY (cod_cliente)
    CREATE SEQUENCE seqCliente
    START WITH 1
    INCREMENT BY 1
    MINVALUE 1
    NOMAXVALUE
    NOCYCLE;
    And finally this is the instruction that gives me problems.*
    INSERT INTO cliente VALUES(
    t_cliente_soc(
    seqCliente.NEXTVAL,
    t_societa(
    t_ragioneSociale('Adecco', '01-gen-1999', '12345678901'),
    t_indirizzo('Milano', '18', '21100', 'Varese', 'Varese', 'Lombardia'),
    '[email protected]',
    t_telefono_array(t_telefono('0332563214')),
    t_persona(
    t_anagrafica('Giulia', 'Macchi', 'f', 'MCCGLA80C23L682L', '23-gen-1980'),
    t_indirizzo('Tofane', '2', '23026', 'Arona', 'Novara', 'Piemonte'),
    '[email protected]',
    t_telefono_array(t_telefono('0322123456'), t_telefono('3337894561'))
    /

    I eliminated the entire database and recreated everything. Now it works... Thanks anyway.

  • Changed DivX codec - now all DivX files give 'file importer detected inconsistency ... '

    Okay, so I've upgraded to DivX 7 - or so I thought (still says 6.8.5), long story short, NONE of my previously input DivX encoded avis work in Premiere anymore (Pro CS4). I get a message "File importer detected an inconsistency in th efile structure of ...avi. Reading and writing of the file's metadata (XMP has been disabled."
    They work in external media players, but anything in Premiere seems broken. I've spent WEEKS on this movie and haven't the slightest clue how to fix it. I feel like vomitting because this is for work and I can't figure this out.
    I'm desperate, PLEASE HELP!

    reidbaker wrote:
    Thank you for the answers. I did a system restore to before I changed the DivX stuff and it seems to work again.
    But I hate editing these files. I think I will take up the advice to convert and replace. But question - when I replace the files in the 'Project area', will it replace all of the pieces connected to that with the correct timing in the timeline?
    I would think it would, but I just want to check.
    Yes; If you replace the clip in the project panel; it will replace it every palce it was used on the timeline in any sequence.
    If you rwplace the clip ON the timeline, it only replaces that clip.

  • Creating first number in a sequence field

    Hello. I'm used to SQL Server and I see there is no direct way to create identity fields in Oracle.
    I have an application that receive many messages that are inserted in a table. I need that to be the fastest I can do it. The table has a sequence number as primary key. Now, I'm using select max(id)+1 in the insert query, but this works after the second time it's executed.
    When the table is empty, max(id) is null. I don't want to do a second query in the code, because it will happen only once.
    How can I solve that in the most efficient way?
    In SQL Server I work with stored procedures and functions. Can I do that in Oracle?

    What you are doing - using MAX(id) + 1 - is bound to fail in a multi user environment. If two users are doing the same thing and their transactions overlap, you get invalid or inconsistent data. In Oracle, you use a sequence object. Create a trigger that fills this id for you with the sequence.nextval. Granted, you'll get gaps but that doesn't matter.

  • Sort order inconsistent behavior

    There seems to be inconsistent behaviour when defining a default sort order sequence.
    Everything works as expected when the display sequence and the order in which the columns are defined in the query are the same but as soon as the display sequence is changed the default sort order doesn't work for the second column in the order sequence.
    I have put up an example at [apex.com|http://apex.oracle.com/pls/otn/f?p=36885:1]
    In report EMP the display sequence and query sequence are the same and the default sort on "Job" and "Hiredate" is correct working. Even when the user sorts on "Manager".
    The sort order sequence then becomes "Manager", "Job" and "Hiredate". As also descripted in the following Sorting on multiple columns
    And exactly the behaviour we are looking for.
    Report EMP2 is a copy of EMP with the only difference the order in which the columns are displayed
    Now the default sort order doesn't work as expected. The report is first ordered on "Job" but then on "Employee" instate of "Hiredate" as is defined. Interestingly "Employee" is the second column in the query.
    It seems that instate of the query_column_id the column_display_sequence is used in the order by. At least for the second column in the defined sort order sequence.
    This may also explain the behaviour mentioned with [derived columns and sort sequence|http://forums.oracle.com/forums/thread.jspa?messageID=1006429&#1006429]
    The display sequence in report EMP2 is where the wizard came up with.
    Nicolette

    Stew
    At the report attributes you can define the sort sequence of a column. When you do that initialy the report is sorted as you defined it. So in my example that is first by "Job"and within "Job" by "Hiredate". When the user sort explicit on an other column this column is put before the columns you have defined.
    So when the user clicks on "Manager" the sort order becomes "Manager", "Job", "Hiredate". When the user then sort on "Employee" the sort order becomes "Employee", "Job" an "Hiredate".
    This works when the order in which the columns appear in your query are the same as the order in which they are displayed.
    BUT as soon as the display order changes the sort sequence doesn't work anymore. Even worse is that also the initial sort sequence doesn't work for the second column any more. (I haven't tested for three or more columns)
    In the example I have put on apex.com in the second report the sort sequence of the report attributes is the same as in the first report. But the initial sort order that is actually done is on "Job" and "Employee" instate of "Job" and "Hiredate". Where "Hiredate" is the second column in the display sequence. But "Employee" is the second column in the query.
    So to really make use of the sort sequence you have to keep your display sequence equal to the order in witch they appear in the query. This isn't really practical.
    Nicolette

Maybe you are looking for