sql - Is there a default sort order for cursors in COBOL reading from DB2? -
i trying understand how following cobol cursor works:
t43624 exec sql t43624 declare x_cursor cursor t43624 select t43624 t43624 ,b t43624 ,c t43624 ,d t43624 ,e t43624 ,f t43624 t43624 x t43624 t43624 l = :pp-l t43624 , m <= :pp-m t43624 , n = :pp-n t43624 , o = :pp-o t43624 , p = :pp-p t43624 , q = :pp-q t43624 end-exec.
given there no order clause, in order rows returned? default have been set somewhere?
there no default sort order results returned db/2 select statement. if need, or expect, data returned in order ordering must specified using order clause on sql predicate.
you may find results appear ordered ordering artifact of access paths used db/2 resolve perdicate. simple queries requiring stage 1 processing resolved using index , these typically ordered because undelying index follows order. totally unreliable , may change due rebind causing different access path used or when underlying index in need of being rebuilt (after many insertions/deletions, lack of free space etc).
queries require stage 2 processing tend come out ordred, artifact of query resolution , should never relied upon.
cobol not excercise inherent control on db/2 operations other may achieved using sql alone.
Comments
Post a Comment