Query with many or clause

Hello,
I need to write a query to fetch data using OR clause. Is there a limit as to what is the number of OR conditions which can be present in a Query?
I am using Oracle 11g.
My question comes from the backdrop of the limit of 1000 items limit in "IN" clause.
Also, if I have a query which has (column1=x1 and column2=y1) or (column1=x2 and column2=y2), is it possible to use IN clause for two columns, i.e something like,
(column1,column2) IN ((x1,y1),(x2,y2)?
Thanks
Vivek

I just ran this query on 11.2.0.3:
select *
from   dual
where 1 = 1
or 2 = 2
or 3 = 3
or 4 = 4
or 5 = 5
or 6 = 6
or 7 = 7
or 8 = 8
or 9 = 9
or 10 = 10
or 11 = 11
or 12 = 12
or 13 = 13
or 14 = 14
or 15 = 15
or 16 = 16
or 17 = 17
or 18 = 18
or 19 = 19
or 20 = 20
or 21 = 21
or 22 = 22
or 23 = 23
or 24 = 24
or 25 = 25
or 26 = 26
or 27 = 27
or 28 = 28
or 29 = 29
or 30 = 30
or 31 = 31
or 32 = 32
or 33 = 33
or 34 = 34
or 35 = 35
or 36 = 36
or 37 = 37
or 38 = 38
or 39 = 39
or 40 = 40
or 41 = 41
or 42 = 42
or 43 = 43
or 44 = 44
or 45 = 45
or 46 = 46
or 47 = 47
or 48 = 48
or 49 = 49
or 50 = 50
or 51 = 51
or 52 = 52
or 53 = 53
or 54 = 54
or 55 = 55
or 56 = 56
or 57 = 57
or 58 = 58
or 59 = 59
or 60 = 60
or 61 = 61
or 62 = 62
or 63 = 63
or 64 = 64
or 65 = 65
or 66 = 66
or 67 = 67
or 68 = 68
or 69 = 69
or 70 = 70
or 71 = 71
or 72 = 72
or 73 = 73
or 74 = 74
or 75 = 75
or 76 = 76
or 77 = 77
or 78 = 78
or 79 = 79
or 80 = 80
or 81 = 81
or 82 = 82
or 83 = 83
or 84 = 84
or 85 = 85
or 86 = 86
or 87 = 87
or 88 = 88
or 89 = 89
or 90 = 90
or 91 = 91
or 92 = 92
or 93 = 93
or 94 = 94
or 95 = 95
or 96 = 96
or 97 = 97
or 98 = 98
or 99 = 99
or 100 = 100
or 101 = 101
or 102 = 102
or 103 = 103
or 104 = 104
or 105 = 105
or 106 = 106
or 107 = 107
or 108 = 108
or 109 = 109
or 110 = 110
or 111 = 111
or 112 = 112
or 113 = 113
or 114 = 114
or 115 = 115
or 116 = 116
or 117 = 117
or 118 = 118
or 119 = 119
or 120 = 120
or 121 = 121
or 122 = 122
or 123 = 123
or 124 = 124
or 125 = 125
or 126 = 126
or 127 = 127
or 128 = 128
or 129 = 129
or 130 = 130
or 131 = 131
or 132 = 132
or 133 = 133
or 134 = 134
or 135 = 135
or 136 = 136
or 137 = 137
or 138 = 138
or 139 = 139
or 140 = 140
or 141 = 141
or 142 = 142
or 143 = 143
or 144 = 144
or 145 = 145
or 146 = 146
or 147 = 147
or 148 = 148
or 149 = 149
or 150 = 150
or 151 = 151
or 152 = 152
or 153 = 153
or 154 = 154
or 155 = 155
or 156 = 156
or 157 = 157
or 158 = 158
or 159 = 159
or 160 = 160
or 161 = 161
or 162 = 162
or 163 = 163
or 164 = 164
or 165 = 165
or 166 = 166
or 167 = 167
or 168 = 168
or 169 = 169
or 170 = 170
or 171 = 171
or 172 = 172
or 173 = 173
or 174 = 174
or 175 = 175
or 176 = 176
or 177 = 177
or 178 = 178
or 179 = 179
or 180 = 180
or 181 = 181
or 182 = 182
or 183 = 183
or 184 = 184
or 185 = 185
or 186 = 186
or 187 = 187
or 188 = 188
or 189 = 189
or 190 = 190
or 191 = 191
or 192 = 192
or 193 = 193
or 194 = 194
or 195 = 195
or 196 = 196
or 197 = 197
or 198 = 198
or 199 = 199
or 200 = 200
or 201 = 201
or 202 = 202
or 203 = 203
or 204 = 204
or 205 = 205
or 206 = 206
or 207 = 207
or 208 = 208
or 209 = 209
or 210 = 210
or 211 = 211
or 212 = 212
or 213 = 213
or 214 = 214
or 215 = 215
or 216 = 216
or 217 = 217
or 218 = 218
or 219 = 219
or 220 = 220
or 221 = 221
or 222 = 222
or 223 = 223
or 224 = 224
or 225 = 225
or 226 = 226
or 227 = 227
or 228 = 228
or 229 = 229
or 230 = 230
or 231 = 231
or 232 = 232
or 233 = 233
or 234 = 234
or 235 = 235
or 236 = 236
or 237 = 237
or 238 = 238
or 239 = 239
or 240 = 240
or 241 = 241
or 242 = 242
or 243 = 243
or 244 = 244
or 245 = 245
or 246 = 246
or 247 = 247
or 248 = 248
or 249 = 249
or 250 = 250
or 251 = 251
or 252 = 252
or 253 = 253
or 254 = 254
or 255 = 255
or 256 = 256
or 257 = 257
or 258 = 258
or 259 = 259
or 260 = 260
or 261 = 261
or 262 = 262
or 263 = 263
or 264 = 264
or 265 = 265
or 266 = 266
or 267 = 267
or 268 = 268
or 269 = 269
or 270 = 270
or 271 = 271
or 272 = 272
or 273 = 273
or 274 = 274
or 275 = 275
or 276 = 276
or 277 = 277
or 278 = 278
or 279 = 279
or 280 = 280
or 281 = 281
or 282 = 282
or 283 = 283
or 284 = 284
or 285 = 285
or 286 = 286
or 287 = 287
or 288 = 288
or 289 = 289
or 290 = 290
or 291 = 291
or 292 = 292
or 293 = 293
or 294 = 294
or 295 = 295
or 296 = 296
or 297 = 297
or 298 = 298
or 299 = 299
or 300 = 300
or 301 = 301
or 302 = 302
or 303 = 303
or 304 = 304
or 305 = 305
or 306 = 306
or 307 = 307
or 308 = 308
or 309 = 309
or 310 = 310
or 311 = 311
or 312 = 312
or 313 = 313
or 314 = 314
or 315 = 315
or 316 = 316
or 317 = 317
or 318 = 318
or 319 = 319
or 320 = 320
or 321 = 321
or 322 = 322
or 323 = 323
or 324 = 324
or 325 = 325
or 326 = 326
or 327 = 327
or 328 = 328
or 329 = 329
or 330 = 330
or 331 = 331
or 332 = 332
or 333 = 333
or 334 = 334
or 335 = 335
or 336 = 336
or 337 = 337
or 338 = 338
or 339 = 339
or 340 = 340
or 341 = 341
or 342 = 342
or 343 = 343
or 344 = 344
or 345 = 345
or 346 = 346
or 347 = 347
or 348 = 348
or 349 = 349
or 350 = 350
or 351 = 351
or 352 = 352
or 353 = 353
or 354 = 354
or 355 = 355
or 356 = 356
or 357 = 357
or 358 = 358
or 359 = 359
or 360 = 360
or 361 = 361
or 362 = 362
or 363 = 363
or 364 = 364
or 365 = 365
or 366 = 366
or 367 = 367
or 368 = 368
or 369 = 369
or 370 = 370
or 371 = 371
or 372 = 372
or 373 = 373
or 374 = 374
or 375 = 375
or 376 = 376
or 377 = 377
or 378 = 378
or 379 = 379
or 380 = 380
or 381 = 381
or 382 = 382
or 383 = 383
or 384 = 384
or 385 = 385
or 386 = 386
or 387 = 387
or 388 = 388
or 389 = 389
or 390 = 390
or 391 = 391
or 392 = 392
or 393 = 393
or 394 = 394
or 395 = 395
or 396 = 396
or 397 = 397
or 398 = 398
or 399 = 399
or 400 = 400
or 401 = 401
or 402 = 402
or 403 = 403
or 404 = 404
or 405 = 405
or 406 = 406
or 407 = 407
or 408 = 408
or 409 = 409
or 410 = 410
or 411 = 411
or 412 = 412
or 413 = 413
or 414 = 414
or 415 = 415
or 416 = 416
or 417 = 417
or 418 = 418
or 419 = 419
or 420 = 420
or 421 = 421
or 422 = 422
or 423 = 423
or 424 = 424
or 425 = 425
or 426 = 426
or 427 = 427
or 428 = 428
or 429 = 429
or 430 = 430
or 431 = 431
or 432 = 432
or 433 = 433
or 434 = 434
or 435 = 435
or 436 = 436
or 437 = 437
or 438 = 438
or 439 = 439
or 440 = 440
or 441 = 441
or 442 = 442
or 443 = 443
or 444 = 444
or 445 = 445
or 446 = 446
or 447 = 447
or 448 = 448
or 449 = 449
or 450 = 450
or 451 = 451
or 452 = 452
or 453 = 453
or 454 = 454
or 455 = 455
or 456 = 456
or 457 = 457
or 458 = 458
or 459 = 459
or 460 = 460
or 461 = 461
or 462 = 462
or 463 = 463
or 464 = 464
or 465 = 465
or 466 = 466
or 467 = 467
or 468 = 468
or 469 = 469
or 470 = 470
or 471 = 471
or 472 = 472
or 473 = 473
or 474 = 474
or 475 = 475
or 476 = 476
or 477 = 477
or 478 = 478
or 479 = 479
or 480 = 480
or 481 = 481
or 482 = 482
or 483 = 483
or 484 = 484
or 485 = 485
or 486 = 486
or 487 = 487
or 488 = 488
or 489 = 489
or 490 = 490
or 491 = 491
or 492 = 492
or 493 = 493
or 494 = 494
or 495 = 495
or 496 = 496
or 497 = 497
or 498 = 498
or 499 = 499
or 500 = 500
or 501 = 501
or 502 = 502
or 503 = 503
or 504 = 504
or 505 = 505
or 506 = 506
or 507 = 507
or 508 = 508
or 509 = 509
or 510 = 510
or 511 = 511
or 512 = 512
or 513 = 513
or 514 = 514
or 515 = 515
or 516 = 516
or 517 = 517
or 518 = 518
or 519 = 519
or 520 = 520
or 521 = 521
or 522 = 522
or 523 = 523
or 524 = 524
or 525 = 525
or 526 = 526
or 527 = 527
or 528 = 528
or 529 = 529
or 530 = 530
or 531 = 531
or 532 = 532
or 533 = 533
or 534 = 534
or 535 = 535
or 536 = 536
or 537 = 537
or 538 = 538
or 539 = 539
or 540 = 540
or 541 = 541
or 542 = 542
or 543 = 543
or 544 = 544
or 545 = 545
or 546 = 546
or 547 = 547
or 548 = 548
or 549 = 549
or 550 = 550
or 551 = 551
or 552 = 552
or 553 = 553
or 554 = 554
or 555 = 555
or 556 = 556
or 557 = 557
or 558 = 558
or 559 = 559
or 560 = 560
or 561 = 561
or 562 = 562
or 563 = 563
or 564 = 564
or 565 = 565
or 566 = 566
or 567 = 567
or 568 = 568
or 569 = 569
or 570 = 570
or 571 = 571
or 572 = 572
or 573 = 573
or 574 = 574
or 575 = 575
or 576 = 576
or 577 = 577
or 578 = 578
or 579 = 579
or 580 = 580
or 581 = 581
or 582 = 582
or 583 = 583
or 584 = 584
or 585 = 585
or 586 = 586
or 587 = 587
or 588 = 588
or 589 = 589
or 590 = 590
or 591 = 591
or 592 = 592
or 593 = 593
or 594 = 594
or 595 = 595
or 596 = 596
or 597 = 597
or 598 = 598
or 599 = 599
or 600 = 600
or 601 = 601
or 602 = 602
or 603 = 603
or 604 = 604
or 605 = 605
or 606 = 606
or 607 = 607
or 608 = 608
or 609 = 609
or 610 = 610
or 611 = 611
or 612 = 612
or 613 = 613
or 614 = 614
or 615 = 615
or 616 = 616
or 617 = 617
or 618 = 618
or 619 = 619
or 620 = 620
or 621 = 621
or 622 = 622
or 623 = 623
or 624 = 624
or 625 = 625
or 626 = 626
or 627 = 627
or 628 = 628
or 629 = 629
or 630 = 630
or 631 = 631
or 632 = 632
or 633 = 633
or 634 = 634
or 635 = 635
or 636 = 636
or 637 = 637
or 638 = 638
or 639 = 639
or 640 = 640
or 641 = 641
or 642 = 642
or 643 = 643
or 644 = 644
or 645 = 645
or 646 = 646
or 647 = 647
or 648 = 648
or 649 = 649
or 650 = 650
or 651 = 651
or 652 = 652
or 653 = 653
or 654 = 654
or 655 = 655
or 656 = 656
or 657 = 657
or 658 = 658
or 659 = 659
or 660 = 660
or 661 = 661
or 662 = 662
or 663 = 663
or 664 = 664
or 665 = 665
or 666 = 666
or 667 = 667
or 668 = 668
or 669 = 669
or 670 = 670
or 671 = 671
or 672 = 672
or 673 = 673
or 674 = 674
or 675 = 675
or 676 = 676
or 677 = 677
or 678 = 678
or 679 = 679
or 680 = 680
or 681 = 681
or 682 = 682
or 683 = 683
or 684 = 684
or 685 = 685
or 686 = 686
or 687 = 687
or 688 = 688
or 689 = 689
or 690 = 690
or 691 = 691
or 692 = 692
or 693 = 693
or 694 = 694
or 695 = 695
or 696 = 696
or 697 = 697
or 698 = 698
or 699 = 699
or 700 = 700
or 701 = 701
or 702 = 702
or 703 = 703
or 704 = 704
or 705 = 705
or 706 = 706
or 707 = 707
or 708 = 708
or 709 = 709
or 710 = 710
or 711 = 711
or 712 = 712
or 713 = 713
or 714 = 714
or 715 = 715
or 716 = 716
or 717 = 717
or 718 = 718
or 719 = 719
or 720 = 720
or 721 = 721
or 722 = 722
or 723 = 723
or 724 = 724
or 725 = 725
or 726 = 726
or 727 = 727
or 728 = 728
or 729 = 729
or 730 = 730
or 731 = 731
or 732 = 732
or 733 = 733
or 734 = 734
or 735 = 735
or 736 = 736
or 737 = 737
or 738 = 738
or 739 = 739
or 740 = 740
or 741 = 741
or 742 = 742
or 743 = 743
or 744 = 744
or 745 = 745
or 746 = 746
or 747 = 747
or 748 = 748
or 749 = 749
or 750 = 750
or 751 = 751
or 752 = 752
or 753 = 753
or 754 = 754
or 755 = 755
or 756 = 756
or 757 = 757
or 758 = 758
or 759 = 759
or 760 = 760
or 761 = 761
or 762 = 762
or 763 = 763
or 764 = 764
or 765 = 765
or 766 = 766
or 767 = 767
or 768 = 768
or 769 = 769
or 770 = 770
or 771 = 771
or 772 = 772
or 773 = 773
or 774 = 774
or 775 = 775
or 776 = 776
or 777 = 777
or 778 = 778
or 779 = 779
or 780 = 780
or 781 = 781
or 782 = 782
or 783 = 783
or 784 = 784
or 785 = 785
or 786 = 786
or 787 = 787
or 788 = 788
or 789 = 789
or 790 = 790
or 791 = 791
or 792 = 792
or 793 = 793
or 794 = 794
or 795 = 795
or 796 = 796
or 797 = 797
or 798 = 798
or 799 = 799
or 800 = 800
or 801 = 801
or 802 = 802
or 803 = 803
or 804 = 804
or 805 = 805
or 806 = 806
or 807 = 807
or 808 = 808
or 809 = 809
or 810 = 810
or 811 = 811
or 812 = 812
or 813 = 813
or 814 = 814
or 815 = 815
or 816 = 816
or 817 = 817
or 818 = 818
or 819 = 819
or 820 = 820
or 821 = 821
or 822 = 822
or 823 = 823
or 824 = 824
or 825 = 825
or 826 = 826
or 827 = 827
or 828 = 828
or 829 = 829
or 830 = 830
or 831 = 831
or 832 = 832
or 833 = 833
or 834 = 834
or 835 = 835
or 836 = 836
or 837 = 837
or 838 = 838
or 839 = 839
or 840 = 840
or 841 = 841
or 842 = 842
or 843 = 843
or 844 = 844
or 845 = 845
or 846 = 846
or 847 = 847
or 848 = 848
or 849 = 849
or 850 = 850
or 851 = 851
or 852 = 852
or 853 = 853
or 854 = 854
or 855 = 855
or 856 = 856
or 857 = 857
or 858 = 858
or 859 = 859
or 860 = 860
or 861 = 861
or 862 = 862
or 863 = 863
or 864 = 864
or 865 = 865
or 866 = 866
or 867 = 867
or 868 = 868
or 869 = 869
or 870 = 870
or 871 = 871
or 872 = 872
or 873 = 873
or 874 = 874
or 875 = 875
or 876 = 876
or 877 = 877
or 878 = 878
or 879 = 879
or 880 = 880
or 881 = 881
or 882 = 882
or 883 = 883
or 884 = 884
or 885 = 885
or 886 = 886
or 887 = 887
or 888 = 888
or 889 = 889
or 890 = 890
or 891 = 891
or 892 = 892
or 893 = 893
or 894 = 894
or 895 = 895
or 896 = 896
or 897 = 897
or 898 = 898
or 899 = 899
or 900 = 900
or 901 = 901
or 902 = 902
or 903 = 903
or 904 = 904
or 905 = 905
or 906 = 906
or 907 = 907
or 908 = 908
or 909 = 909
or 910 = 910
or 911 = 911
or 912 = 912
or 913 = 913
or 914 = 914
or 915 = 915
or 916 = 916
or 917 = 917
or 918 = 918
or 919 = 919
or 920 = 920
or 921 = 921
or 922 = 922
or 923 = 923
or 924 = 924
or 925 = 925
or 926 = 926
or 927 = 927
or 928 = 928
or 929 = 929
or 930 = 930
or 931 = 931
or 932 = 932
or 933 = 933
or 934 = 934
or 935 = 935
or 936 = 936
or 937 = 937
or 938 = 938
or 939 = 939
or 940 = 940
or 941 = 941
or 942 = 942
or 943 = 943
or 944 = 944
or 945 = 945
or 946 = 946
or 947 = 947
or 948 = 948
or 949 = 949
or 950 = 950
or 951 = 951
or 952 = 952
or 953 = 953
or 954 = 954
or 955 = 955
or 956 = 956
or 957 = 957
or 958 = 958
or 959 = 959
or 960 = 960
or 961 = 961
or 962 = 962
or 963 = 963
or 964 = 964
or 965 = 965
or 966 = 966
or 967 = 967
or 968 = 968
or 969 = 969
or 970 = 970
or 971 = 971
or 972 = 972
or 973 = 973
or 974 = 974
or 975 = 975
or 976 = 976
or 977 = 977
or 978 = 978
or 979 = 979
or 980 = 980
or 981 = 981
or 982 = 982
or 983 = 983
or 984 = 984
or 985 = 985
or 986 = 986
or 987 = 987
or 988 = 988
or 989 = 989
or 990 = 990
or 991 = 991
or 992 = 992
or 993 = 993
or 994 = 994
or 995 = 995
or 996 = 996
or 997 = 997
or 998 = 998
or 999 = 999
or 1000 = 1000
or 1001 = 1001
or 1002 = 1002
or 1003 = 1003
or 1004 = 1004
or 1005 = 1005
or 1006 = 1006
or 1007 = 1007
or 1008 = 1008
or 1009 = 1009
or 1010 = 1010
or 1011 = 1011
or 1012 = 1012
or 1013 = 1013
or 1014 = 1014
or 1015 = 1015
or 1016 = 1016
or 1017 = 1017
or 1018 = 1018
or 1019 = 1019
or 1020 = 1020
or 1021 = 1021
or 1022 = 1022
or 1023 = 1023
or 1024 = 1024
or 1025 = 1025
or 1026 = 1026
or 1027 = 1027
or 1028 = 1028
or 1029 = 1029
or 1030 = 1030
or 1031 = 1031
or 1032 = 1032
or 1033 = 1033
or 1034 = 1034
or 1035 = 1035
or 1036 = 1036
or 1037 = 1037
or 1038 = 1038
or 1039 = 1039
or 1040 = 1040
or 1041 = 1041
or 1042 = 1042
or 1043 = 1043
or 1044 = 1044
or 1045 = 1045
or 1046 = 1046
or 1047 = 1047
or 1048 = 1048
or 1049 = 1049
or 1050 = 1050
or 1051 = 1051
or 1052 = 1052
or 1053 = 1053
or 1054 = 1054
or 1055 = 1055
or 1056 = 1056
or 1057 = 1057
or 1058 = 1058
or 1059 = 1059
or 1060 = 1060
or 1061 = 1061
or 1062 = 1062
or 1063 = 1063
or 1064 = 1064
or 1065 = 1065
or 1066 = 1066
or 1067 = 1067
or 1068 = 1068
or 1069 = 1069
or 1070 = 1070
or 1071 = 1071
or 1072 = 1072
or 1073 = 1073
or 1074 = 1074
or 1075 = 1075
or 1076 = 1076
or 1077 = 1077
or 1078 = 1078
or 1079 = 1079
or 1080 = 1080
or 1081 = 1081
or 1082 = 1082
or 1083 = 1083
or 1084 = 1084
or 1085 = 1085
or 1086 = 1086
or 1087 = 1087
or 1088 = 1088
or 1089 = 1089
or 1090 = 1090
or 1091 = 1091
or 1092 = 1092
or 1093 = 1093
or 1094 = 1094
or 1095 = 1095
or 1096 = 1096
or 1097 = 1097
or 1098 = 1098
or 1099 = 1099
or 1100 = 1100
or 1101 = 1101
or 1102 = 1102
or 1103 = 1103
or 1104 = 1104
or 1105 = 1105
or 1106 = 1106
or 1107 = 1107
or 1108 = 1108
or 1109 = 1109
or 1110 = 1110
or 1111 = 1111
or 1112 = 1112
or 1113 = 1113
or 1114 = 1114
or 1115 = 1115
or 1116 = 1116
or 1117 = 1117
or 1118 = 1118
or 1119 = 1119
or 1120 = 1120
or 1121 = 1121
or 1122 = 1122
or 1123 = 1123
or 1124 = 1124
or 1125 = 1125
or 1126 = 1126
or 1127 = 1127
or 1128 = 1128
or 1129 = 1129
or 1130 = 1130
or 1131 = 1131
or 1132 = 1132
or 1133 = 1133
or 1134 = 1134
or 1135 = 1135
or 1136 = 1136
or 1137 = 1137
or 1138 = 1138
or 1139 = 1139
or 1140 = 1140
or 1141 = 1141
or 1142 = 1142
or 1143 = 1143
or 1144 = 1144
or 1145 = 1145
or 1146 = 1146
or 1147 = 1147
or 1148 = 1148
or 1149 = 1149
or 1150 = 1150
or 1151 = 1151
or 1152 = 1152
or 1153 = 1153
or 1154 = 1154
or 1155 = 1155
or 1156 = 1156
or 1157 = 1157
or 1158 = 1158
or 1159 = 1159
or 1160 = 1160
or 1161 = 1161
or 1162 = 1162
or 1163 = 1163
or 1164 = 1164
or 1165 = 1165
or 1166 = 1166
or 1167 = 1167
or 1168 = 1168
or 1169 = 1169
or 1170 = 1170
or 1171 = 1171
or 1172 = 1172
or 1173 = 1173
or 1174 = 1174
or 1175 = 1175
or 1176 = 1176
or 1177 = 1177
or 1178 = 1178
or 1179 = 1179
or 1180 = 1180
or 1181 = 1181
or 1182 = 1182
or 1183 = 1183
or 1184 = 1184
or 1185 = 1185
or 1186 = 1186
or 1187 = 1187
or 1188 = 1188
or 1189 = 1189
or 1190 = 1190
or 1191 = 1191
or 1192 = 1192
or 1193 = 1193
or 1194 = 1194
or 1195 = 1195
or 1196 = 1196
or 1197 = 1197
or 1198 = 1198
or 1199 = 1199
or 1200 = 1200
or 1201 = 1201
or 1202 = 1202
or 1203 = 1203
or 1204 = 1204
or 1205 = 1205
or 1206 = 1206
or 1207 = 1207
or 1208 = 1208
or 1209 = 1209
or 1210 = 1210
or 1211 = 1211
or 1212 = 1212
or 1213 = 1213
or 1214 = 1214
or 1215 = 1215
or 1216 = 1216
or 1217 = 1217
or 1218 = 1218
or 1219 = 1219
or 1220 = 1220
or 1221 = 1221
or 1222 = 1222
or 1223 = 1223
or 1224 = 1224
or 1225 = 1225
or 1226 = 1226
or 1227 = 1227
or 1228 = 1228
or 1229 = 1229
or 1230 = 1230
or 1231 = 1231
or 1232 = 1232
or 1233 = 1233
or 1234 = 1234
or 1235 = 1235
or 1236 = 1236
or 1237 = 1237
or 1238 = 1238
or 1239 = 1239
or 1240 = 1240
or 1241 = 1241
or 1242 = 1242
or 1243 = 1243
or 1244 = 1244
or 1245 = 1245
or 1246 = 1246
or 1247 = 1247
or 1248 = 1248
or 1249 = 1249
or 1250 = 1250
or 1251 = 1251
or 1252 = 1252
or 1253 = 1253
or 1254 = 1254
or 1255 = 1255
or 1256 = 1256
or 1257 = 1257
or 1258 = 1258
or 1259 = 1259
or 1260 = 1260
or 1261 = 1261
or 1262 = 1262
or 1263 = 1263
or 1264 = 1264
or 1265 = 1265
or 1266 = 1266
or 1267 = 1267
or 1268 = 1268
or 1269 = 1269
or 1270 = 1270
or 1271 = 1271
or 1272 = 1272
or 1273 = 1273
or 1274 = 1274
or 1275 = 1275
or 1276 = 1276
or 1277 = 1277
or 1278 = 1278
or 1279 = 1279
or 1280 = 1280
or 1281 = 1281
or 1282 = 1282
or 1283 = 1283
or 1284 = 1284
or 1285 = 1285
or 1286 = 1286
or 1287 = 1287
or 1288 = 1288
or 1289 = 1289
or 1290 = 1290
or 1291 = 1291
or 1292 = 1292
or 1293 = 1293
or 1294 = 1294
or 1295 = 1295
or 1296 = 1296
or 1297 = 1297
or 1298 = 1298
or 1299 = 1299
or 1300 = 1300
or 1301 = 1301
or 1302 = 1302
or 1303 = 1303
or 1304 = 1304
or 1305 = 1305
or 1306 = 1306
or 1307 = 1307
or 1308 = 1308
or 1309 = 1309
or 1310 = 1310
or 1311 = 1311
or 1312 = 1312
or 1313 = 1313
or 1314 = 1314
or 1315 = 1315
or 1316 = 1316
or 1317 = 1317
or 1318 = 1318
or 1319 = 1319
or 1320 = 1320
or 1321 = 1321
or 1322 = 1322
or 1323 = 1323
or 1324 = 1324
or 1325 = 1325
or 1326 = 1326
or 1327 = 1327
or 1328 = 1328
or 1329 = 1329
or 1330 = 1330
or 1331 = 1331
or 1332 = 1332
or 1333 = 1333
or 1334 = 1334
or 1335 = 1335
or 1336 = 1336
or 1337 = 1337
or 1338 = 1338
or 1339 = 1339
or 1340 = 1340
or 1341 = 1341
or 1342 = 1342
or 1343 = 1343
or 1344 = 1344
or 1345 = 1345
or 1346 = 1346
or 1347 = 1347
or 1348 = 1348
or 1349 = 1349
or 1350 = 1350
or 1351 = 1351
or 1352 = 1352
or 1353 = 1353
or 1354 = 1354
or 1355 = 1355
or 1356 = 1356
or 1357 = 1357
or 1358 = 1358
or 1359 = 1359
or 1360 = 1360
or 1361 = 1361
or 1362 = 1362
or 1363 = 1363
or 1364 = 1364
or 1365 = 1365
or 1366 = 1366
or 1367 = 1367
or 1368 = 1368
or 1369 = 1369
or 1370 = 1370
or 1371 = 1371
or 1372 = 1372
or 1373 = 1373
or 1374 = 1374
or 1375 = 1375
or 1376 = 1376
or 1377 = 1377
or 1378 = 1378
or 1379 = 1379
or 1380 = 1380
or 1381 = 1381
or 1382 = 1382
or 1383 = 1383
or 1384 = 1384
or 1385 = 1385
or 1386 = 1386
or 1387 = 1387
or 1388 = 1388
or 1389 = 1389
or 1390 = 1390
or 1391 = 1391
or 1392 = 1392
or 1393 = 1393
or 1394 = 1394
or 1395 = 1395
or 1396 = 1396
or 1397 = 1397
or 1398 = 1398
or 1399 = 1399
or 1400 = 1400
or 1401 = 1401
or 1402 = 1402
or 1403 = 1403
or 1404 = 1404
or 1405 = 1405
or 1406 = 1406
or 1407 = 1407
or 1408 = 1408
or 1409 = 1409
or 1410 = 1410
or 1411 = 1411
or 1412 = 1412
or 1413 = 1413
or 1414 = 1414
or 1415 = 1415
or 1416 = 1416
or 1417 = 1417
or 1418 = 1418
or 1419 = 1419
or 1420 = 1420
or 1421 = 1421
or 1422 = 1422
or 1423 = 1423
or 1424 = 1424
or 1425 = 1425
or 1426 = 1426
or 1427 = 1427
or 1428 = 1428
or 1429 = 1429
or 1430 = 1430
or 1431 = 1431
or 1432 = 1432
or 1433 = 1433
or 1434 = 1434
or 1435 = 1435
or 1436 = 1436
or 1437 = 1437
or 1438 = 1438
or 1439 = 1439
or 1440 = 1440
or 1441 = 1441
or 1442 = 1442
or 1443 = 1443
or 1444 = 1444
or 1445 = 1445
or 1446 = 1446
or 1447 = 1447
or 1448 = 1448
or 1449 = 1449
or 1450 = 1450
or 1451 = 1451
or 1452 = 1452
or 1453 = 1453
or 1454 = 1454
or 1455 = 1455
or 1456 = 1456
or 1457 = 1457
or 1458 = 1458
or 1459 = 1459
or 1460 = 1460
or 1461 = 1461
or 1462 = 1462
or 1463 = 1463
or 1464 = 1464
or 1465 = 1465
or 1466 = 1466
or 1467 = 1467
or 1468 = 1468
or 1469 = 1469
or 1470 = 1470
or 1471 = 1471
or 1472 = 1472
or 1473 = 1473
or 1474 = 1474
or 1475 = 1475
or 1476 = 1476
or 1477 = 1477
or 1478 = 1478
or 1479 = 1479
or 1480 = 1480
or 1481 = 1481
or 1482 = 1482
or 1483 = 1483
or 1484 = 1484
or 1485 = 1485
or 1486 = 1486
or 1487 = 1487
or 1488 = 1488
or 1489 = 1489
or 1490 = 1490
or 1491 = 1491
or 1492 = 1492
or 1493 = 1493
or 1494 = 1494
or 1495 = 1495
or 1496 = 1496
or 1497 = 1497
or 1498 = 1498
or 1499 = 1499
or 1500 = 1500;
And it works:
SQL> @h:\sql\many_ors.sql
D
X
1 row selected.
Plan:
SQL> select * from table(dbms_xplan.display_cursor(null, null, 'ALLSTATS LAST'));
PLAN_TABLE_OUTPUT
SQL_ID  7m3z724nhj0ft, child number 0
select /*+ gather_plan_statistics */        * from   dual where 1 = 1
or 2 = 2 or 3 = 3 or 4 = 4 or 5 = 5 or 6 = 6 or 7 = 7 or 8 = 8 or 9 = 9
or 10 = 10 or 11 = 11 or 12 = 12 or 13 = 13 or 14 = 14 or 15 = 15 or 16
= 16 or 17 = 17 or 18 = 18 or 19 = 19 or 20 = 20 or 21 = 21 or 22 = 22
or 23 = 23 or 24 = 24 or 25 = 25 or 26 = 26 or 27 = 27 or 28 = 28 or 29
= 29 or 30 = 30 or 31 = 31 or 32 = 32 or 33 = 33 or 34 = 34 or 35 = 35
or 36 = 36 or 37 = 37 or 38 = 38 or 39 = 39 or 40 = 40 or 41 = 41 or 42
= 42 or 43 = 43 or 44 = 44 or 45 = 45 or 46 = 46 or 47 = 47 or 48 = 48
or 49 = 49 or 50 = 50 or 51 = 51 or 52 = 52 or 53 = 53 or 54 = 54 or 55
= 55 or 56 = 56 or 57 = 57 or 58 = 58 or 59 = 59 or 60 = 60 or 61 = 61
or 62 = 62 or 63 = 63 or 64 = 64 or 65 = 65 or 66 = 66 or 67 = 67 or 68
= 68 or 69 = 69 or 70 = 70 or 71 = 71 or 72 = 72 or 73 = 73 or 74 = 74
or 75 = 75 or 76 = 76 or 77 = 77 or 78 = 78 or 79 = 79 or 80 = 80 or 81
= 81 or 82 = 82 or 83 = 83 or 84 = 84 or 85 = 85 or 86 = 86 or 87 = 87
Plan hash value: 272002086
| Id  | Operation         | Name | Starts | E-Rows | A-Rows |   A-Time   | Buffers |
|   0 | SELECT STATEMENT  |      |      1 |        |      1 |00:00:00.01 |       2 |
|   1 |  TABLE ACCESS FULL| DUAL |      1 |      1 |      1 |00:00:00.01 |       2 |
26 rows selected.
SQL>
Not sure why it ends already at 87....

Similar Messages

  • How to write sql query with many parameter in ireport

    hai,
    i'm a new user in ireport.how to write sql query with many parameters in ireport's report query?i already know to create a parameter like(select * from payment where entity=$P{entity}.
    but i don't know to create query if more than 1 parameter.i also have parameter such as
    $P{entity},$P{id},$P{ic}.please help me for this.
    thanks

    You are in the wrong place. The ireport support forum may be found here
    http://www.jasperforge.org/index.php?option=com_joomlaboard&Itemid=215&func=showcat&catid=9

  • Query with order by clause

    Hi,
    I found a query with order by clause in procedure which is taking long time.
    Stats are upto date.
    Total Rows :650000.
    It is ordered by primary key column.
    select * from table_name order by col1;
    col1 is a primary key.No of cpu's used is 4.
    can anyone suggest me a better solution to improve the performance of a query.
    Is it better to use parallel hint for above scenario.
    Any help really apprecaited.
    Thanks in advance.

    Hi,
    Thanks for ur immediate reply.
    It doesn't have where clause.
    below is the plan
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    Plan hash value: 619071987
    | Id  | Operation                   | Name                 | Rows  | Bytes | Cos
    |   0 | SELECT STATEMENT            |                      |   671K|   255M| 125
    |   1 |  TABLE ACCESS BY INDEX ROWID| FULL_ITEM_FACILITIES |   671K|   255M| 125
    |   2 |   INDEX FULL SCAN           | FIF_PK               |   671K|       |
    9 rows selected
    Executed in 0.094 secondsThanks in advance
    Edited by: unique on Jun 22, 2009 8:26 AM

  • Hierarchical query with many-to-many relationship

    I have read with interest the creative solutions to complex hierarchical queries posted previously; they have been instructive but have not quite addressed this scenario.
    We have a hierarchy table H, with columns for ID, name, parentID, and other attributes.
    Within this table are a number of independent hierarchies, each existing for a different purpose.
    We have a master list of hierarchies in table T which describes the purpose of each hierarchy, provides some default attributes which the nodes can inherit, and stores a unique id for each hierarchy and a pointer to the root node of the corresponding hierarchy in table H.
    We have a master list of items M, with identically named columns to those in H, along with many other attributes.
    The members of table M ALL belong to EACH of the Hierarchies. So we have a link table I to define the intersection of H and M.
    So the leaf nodes of H are really containers for the list of elements from M which may be attached to them.
    The universe of M is very volatile, with new members being added, old ones deleted, and existing ones being reclassified frequently from node to node within each hierarchy. Since the hierarchies have to be built to handle every possible scenario, so that the members of M can always find a suitable node to reside in, quite often, in fact more often than not, the majority of leaf nodes for each hierarchy are empty at any given moment.
    Therefore, although we always know the root sector of a given hierarchy and can traverse downwards from there, if we worked our way up from the intersection table, we could eliminate up to 70% of the nodes of any given hierarchy from further consideration, as they don't need to be (in fact, must not be) included in reports.
    As implied by the above, rows in M are structurally similar (in terms of columns, but not in any real world sense) and are a superset of rows in H. But combining them into the one table doesn't seem to help the reporting process due to the many-to-many relationship which prevents the ID/parentID relationship from being carried through to this level.
    There are a number of other considerations of which the most pertinent is that the people using this database generally have an interest in only a subset of the master list of items in M. This relationship is also dynamic but important enough and rigid enough that another link table P exists to combine the Users in table U with the subset of M in which they are interested. (The users are also grouped into hierarchies of a totally different nature, but this aspect is secondary for now.)
    The reporting is reasonably straightforward for any single combination of User and Hierarchy; they want to see all the items they are interested in, listed in hierarchical sequence, totalled on change of level with the individual items M listed beneath the nodes of H. This is unfortunately required in real time, so retrieval performance is paramount.
    Some statistics might help to determine the optimum approach:
    The largest hierarchy has 10,000 nodes. The smallest about 100.
    The largest would have 70% or more of its nodes unused at any point in time, and even the smallest would have 25% unused.
    The hierarchies tend to be broad rather than deep, the maximum number of levels being about 5; but the larger ones should be twice as deep as this if performance was not compromised.
    There are dozens of hierarchies, but it may be possible to sharply reduce this number by exploiting the Order Siblings By clause.
    The number of rows in M varies between 500,000 and 50,000; depending upon how long historical data is retained on-line (and performance permitting, it would be retained indefinitely).
    The number of users varies between 1000 and 2000 but the range of M in which they are interested varies greatly; from as few as 100 to as many as 10,000+. So it is almost always worth beginning by eliminating the items in which they are not interested, implying once again that the hierarchy should be traversed upwards rather than down from the root.
    The current system is very old and survives by a tactic of building what are essentially materialised views of the database structure for each user overnight using, ahem, non-relational technology. This is inefficient and not easily scaled (but it works) and hence this redevelopment project needs to (a) work, and (b) work better and faster.
    I am happy to provide some DDL scripts if that helps explain the problem better than this narrative.
    I can't help feeling that the solution lies in somehow extending the hierarchical query past the many-to-many link table so that the Master list can be merged directly into the hierarchy such that the M items become the leaf nodes rather than the design outlined above - but I don't know how to do that. But I am sure everyone reading this does! :)
    All advice appreciated. Database version is not an issue; we are currently using version 10XE for experimentation, but production usage could be on 11 if that contains helpful features.
    Thank you
    CS

    Hi,
    ChrisS. wrote:
    I am happy to provide some DDL scripts if that helps explain the problem better than this narrative.Yes, please do.
    The problem seems interesting, I'm sure many people here (including myself) are willing to help you in this matter.
    So yes, post DDL for the tables, as well as INSERTs to populate them with representative data. Please also include the output you require along with detailed explanations about the logic to get it.
    Don't forget to put lines of code between {code} tags in order to preserve formatting and readability, like this :
    SELECT sysdate FROM dual;Thanks.

  • Not able to migrate a query with not exist clause

    Hi all,
    I'm using Toplink 10.1.3 and I am trying to rewrite the following query with Expression Framework:
    select distinct r.e_ogg_oper_k_oggetto
    FROM regola_accettazione_oper_banc r, oggetto_operazione_bancaria o
    where not exists (
    select 1
    FROM limitaz_ogg_tipo_oper_banc l
    where nvl(l.d_fine_validita,trunc(sysdate)+1)>trunc(sysdate)
    and l.d_inizio_validita <= trunc(sysdate)
    and l.e_tpodv_k_tipo_operazione=:appoggio.tipo_operaz
    and l.e_ogg_oper_k_oggetto=r.e_ogg_oper_k_oggetto
    and l.e_uni_oper_k_unita_oper_util= :appoggio.e_uni_oper_k_unita_oper_esegui )
    and r.e_oper_ban_k_operaz_bancaria=:appoggio.form
    and r.e_ogg_oper_k_oggetto=o.k_oggetto
    and o.e_ogg_oper_k_oggetto is null
    and o.k_oggetto != nvl(:appoggio.oggetto_autom,,'0')
    and o.k_oggetto like substr(:appoggio.oggetto,1,2)||'%'
    and r.d_inizio_validita <= :appoggio.d_contab
    and to_date(nvl(to_char(r.d_fine_validita,DD/MM/YYYY'),31/12/3999'),'DD/MM/YYYY')> :appoggio.d_contab
    and o.f_natura_oggetto in ('G','P') and r.f_oggetto_automatizzato!='S'
    I'm not able to "attach" the not exist clause to the rest of query.
    How can I do it?
    Thank you very much.

    Not exists can be used in an expression through using a ReportQuery sub-query.
    i.e.
    ExpressionBuilder outerBuilder = new ExpressionBuilder();
    ReadAllQuery outerQuery = new ReadAllQuery(Employee.class, outerBuilder);
    ExpressionBuilder subBuilder = new ExpressionBuilder();
    ReportQuery subQuery = new ReportQuery(Address.class, subBuilder);
    subQuery.addAttribute("id");
    subQuery.setSelectionCriteria(
    subBuilder.get("city").equal(outerBuilder.get("address").get("city")
    .and(subBuilder.notEqual(outerBuilder.get("address")))));
    outerQuery.setSelectionCriteria(
    outerBuilder.notExists(subQuery));
    List results = (List) session.executeQuery(outerQuery);
    Refer to the documentation section on sub-queries for more information.
    I would suggest simlpifying the where clause until you get the sub-query working to start.
    You can also always use a custom SQL query in TopLink.

  • Query with 'different from' clause in Sqlite

    My question is very simple:
    How can I submit a query with a 'different from' clause into a table.
    In AIR, I would like to query :
    "select * from myTable where myField <> 'value' ";
    but it does'nt work !
    Nor
    "select * from myTable where myField != 'value' ";
    nor
    "select * from myTable where myField is not 'value' ";
    is it impossible to query with a 'different from' clause in Sqlite wih Adobe Air

    Hello,
    SQLite in AIR does support 'different from' and '<>' is the correct operator. Take the following emp table for example:
    id
    name
    age
    1
    A
    26
    2
    B
    30
    3
    C
    28
    If you want to query the records whose name isn't A. The following SQL is correct:
    select * from emp where name <> 'A'
    Thanks,
    Yang

  • QUESTION:  HOW TO WRITE QUERY  WITH MANY TO MANY RELATIONSHIPS

    Could someone help me out here?
    I was sitting here looking at some tables ie table_name and synonyms and wondering.
    If a table can belong to many synonyms and a synonym can belong to many tables how would one write a query where I would like to know which tables belong to each synonym or on the other hand which synonym belongs to what tables?
    Would I try to develop an outside join for this, a corrolated query or a query with a subquery or would there be another format that would work better?
    What would be the best method of attack on this?
    Thanks for your thoughts on this.
    al

    Actually, the relationship is not many to many. A table can have many synonyms, but a synonym within a namespace (i.e. a PUBLIC synonym, or a private synonym created by a user) can only point to one table. The xxx_synonmys tables already contain the information about the table_name and table_owner.
    John

  • DocumentClient query with Int64 where clause is incorrect when converted and sent to Azure

    The code below constructs a query with a lambda expression involving an Int64. When the query is converted and sent to Azure, it is incorrect. I captured the request to Azure using Fiddler for the example below, and the body contained:
    {"query":"SELECT * FROM root WHERE (root.car.id = 1.01036229983142E+16) "}
    Notice the constant does not match that of the code. Is this a bug in Azure DocumentDB library? If so, where can I submit a bug?
    long carId = 10103622998314238;
    IQueryable<MyDocument> query = documentClient.CreateDocumentQuery<MyDocument>("<collectionLinkGoesHere>", new FeedOptions { MaxItemCount = 1 });
    query = query.Where((MyDocument d) => d.Car.Id == carId);
    await query.AsDocumentQuery().ExecuteNextAsync<T>();

    @kurifodo1, DocumentDB follows the JSON standard for numbers, which is http://en.wikipedia.org/wiki/IEEE_754 notation. So any long integer gets serialized to a double stored as IEE754, and will lose some precision. While this isn't the most intuitive behavior,
    it's important in order to be compliant with other tools and platforms that speak JSON.
    If you'd like to just perform equality queries, consider storing this as a string. If you'd like to perform range queries, consider breaking up the number into two parts (high and low), similar to the BigInteger structure in C#.
    Hope this helps.

  • Strange behavior in inner query with group by clause

    Hi All,
    I found a very strange behaviour with Inner query having a group by clause.
    Please look the sample code
    Select b,c,qty from (select a,b,c,sum(d) qty from tab_xyz group by b,c);
    This query gives output by summing b,c wise. But when i run the inner query it gives error as "not a group by expression "
    My question is - though the inner query is wrong, how is it possible that this query gives output.
    it behaves like -
    Select b,c,qty from (select b,c,sum(d) qty from tab_xyz group by b,c);
    Is it a normal behaviour ?
    If it is a normal behaviour, then how group by behaves inside a inner query.
    Thanks !!

    This case I have tested already and it throws error.
    But why the initial posted query is not throwing
    error even the inner query is wrong.
    In what way oracle behaves for the initial posted
    query?what is the scenario that throws the error? is it at the time when you only run the inner query or the whole query?

  • Need help with writing a query with dynamic FROM clause

    Hi Folks,
    I need help with an query that should generate the "FROM" clause dynamically.
    My main query is as follows
    select DT_SKEY, count(*)
    from *???*
    where DT_SKEY between 20110601 and 20110719
    group by DT_SKEY
    having count(*) = 0
    order by 1; The "from" clause of the above query should be generated as below
    select 'Schema_Name'||'.'||TABLE_NAME
    from dba_tables
    where OWNER = 'Schema_Name'Simply sticking the later query in the first query does not work.
    Any pointers will be appreciated.
    Thanks
    rogers42

    Hi,
    rogers42 wrote:
    Hi Folks,
    I need help with an query that should generate the "FROM" clause dynamically.
    My main query is as follows
    select DT_SKEY, count(*)
    from *???*
    where DT_SKEY between 20110601 and 20110719
    group by DT_SKEY
    having count(*) = 0
    order by 1; The "from" clause of the above query should be generated as below
    select 'Schema_Name'||'.'||TABLE_NAME
    from dba_tables
    where OWNER = 'Schema_Name'
    Remember that anything inside quotes is case-sensitive. Is the owner really "Schema_Name" with a capital S and a capital N, and 8 lower-case letters?
    Simply sticking the later query in the first query does not work.Right; the table name must be given when you compile the query. It's not an expression that you can generate in the query itself.
    Any pointers will be appreciated.In SQL*Plus, you can do something like the query bleow.
    Say you want to count the rows in scott.emp, but you're not certain that the name is emp; it could be emp_2011 or emp_august, or anything else that starts with e. (And the name could change every day, so you can't just look it up now and hard-code it in a query that you want to run in the future.)
    Typically, how dynamic SQL works is that some code (such as a preliminary query) gets some of the information you need to write the query first, and you use that information in a SQL statement that is compiled and run after that. For example:
    -- Preliminary Query:
    COLUMN     my_table_name_col     NEW_VALUE my_table_name
    SELECT     table_name     AS my_table_name_col
    FROM     all_tables
    WHERE     owner          = 'SCOTT'
    AND     table_name     LIKE 'E%';
    -- Main Query:
    SELECT     COUNT (*)     AS cnt
    FROM     scott.&my_table_name
    ;This assumes that the preliminary query will find exactly one row; that is, it assumes that SCOTT has exactly one table whose name starts with E. Could you have 0 tables in the schema, or more than 1? If so, what results would you want? Give a concrete example, preferably suing commonly available tables (like those in the SCOTT schema) so that the poepl who want to help you can re-create the problem and test their ideas.
    Edited by: Frank Kulash on Aug 11, 2011 2:30 PM

  • Query with many sub-selects on the same table

    Hi,
    Please consider the example below (Oracle 11g):
    create TABLE test1 (order_id number, CODE VARCHAR2(10), VALUE NUMBER);
    insert into test1 VALUES (1, 'A', 100);
    insert into test1 VALUES (1, 'B', 200);
    insert into test1 VALUES (1, 'C', 300);
    insert into test1 VALUES (1, 'D', 400);
    insert into test1 VALUES (2, 'A', 10);
    insert into test1 VALUES (2, 'B', 20);
    SELECT order_id,
           CODE,
           VALUE,
           (SELECT VALUE FROM test1 t1
           WHERE t1.order_id = t.order_id
           AND   t1.code = 'B') b_Value,
           (SELECT SUM(VALUE)/COUNT(*) FROM test1 t1
           WHERE t1.order_id = t.order_id
           AND   t1.code IN ('C', 'D')) cd_Value,
           (SELECT COUNT(*) FROM test1 t1
           WHERE t1.order_id = t.order_id
           AND   t1.code IN ('C', 'D')) cd_qty
    FROM   TEST1 t
    WHERE  CODE = 'A';In my real-life case, I don't have 3 but tens of sub-query columns like those. The performance is OK but I was wondering whether there were a better way in terms of performance and maintainability to write this query.
    I thought of the WITH clause but couldn't see how it could help much.
    Please note that some sub-queries can be more complex than just looking up a column, like in column cd_value/cd_qty.
    Any suggestions?
    Thanks
    Luis

    Simpler, but will go for two table scans. You will have to use outer joins according to your requirement.
    select t1.order_id,
           t1.CODE,
           t1.VALUE,
           max(decode(t2.code,'B',t2.value)) b_value,
           sum(decode(t2.code,'C',t2.value,'D',t2.value,0))/nullif(sum(decode(t2.code,'C',1,'D',1,0)),0)  cd_value,
           sum(decode(t2.code,'C',1,'D',1,0))  cd_qty 
    from TEST1 t1,test1 t2
    where t1.CODE = 'A'
    and t1.ORDER_ID = t2.order_id
    group by t1.order_id,
           t1.CODE,
           t1.VALUEEdited by: jeneesh on Feb 7, 2012 11:54 AM

  • Incorrect warning when parsing query with group by clause

    I am using SQL Developer 4.0.0.13.80 with JDK 1.7.0_51 x64 on Windows 8.1
    I have the following SQL, which works perfectly:
    select substr(to_char(tot_amount), 0, 1) as digit, count(*)
    from transactions
    where tot_amount <> 0
    group by substr(to_char(tot_amount), 0, 1)
    order by digit;
    However, SQL Developer is yellow-underlining the first line, telling me that:
    SELECT list is inconsistent with GROUP BY; amend GROUP BY clause to: substr(to_char(rep_tot_amount), 0, 1), substr(to_char(rep_tot_amount),
    which is clearly wrong.
    Message was edited by: JamHan
    Added code formatting.

    Hello,
    I also have found the same issue with the GROUP BY hint. Another problem I found is that the hint suggests to amend the GROUP BY members to add also constant values that are included in the SELECTed columns and whenever those constants include strings with spaces, it generates an invalid query. Normally, constant values won't affect grouping functions and as such they can be omitted from the GROUP BY members, but it seems SQL Dev thinks it differently.
    For example, if you try the following query:
    SELECT d.DNAME, sum(e.sal) amt, 'Total salary' report_title, 100 report_nr
    FROM scott.emp e, scott.dept d
    WHERE e.DEPTNO = d.DEPTNO
    GROUP BY d.DNAME;
    when you hover the mouse pointer on the yellow hint, a popup will show the following message:
    SELECT list inconsistent with GROUP BY; amend GROUP BY clause to:
    d.DNAME, 'Total, 100
    If you click on the hint, it will amend the group by members to become:
    GROUP BY d.DNAME, 'Total, 100;
    that is clearly incorrect syntax. You may notice that after the change the yellow hint is still there, suggesting to amend further the GROUP BY members. If you click again on the hint, you will end with the following:
    GROUP BY d.DNAME, 'Total, 100;
    , 'Total, 100
    and so on.
    I am not sure if this behaviour was already known (Vadim??), but it would be nice if somebody could file a bug against it.
    Finally when writing big queries with complex functions and constant columns, those yellow lines extend all over the select list and they are visually annoying, so I wonder if there is a way to disable the GROUP BY hint until it gets fixed.
    Thanks for any suggestion,
    Paolo

  • Oracle query tuning : query with Order-by clause

    Hi
    I am having a query in my database :
    SELECT * FROM SAPR3.HRP1001 WHERE "MANDT" = 990
    ORDER BY
    "MANDT" , "OTYPE" , "OBJID" , "PLVAR" , "RSIGN" , "RELAT" , "ISTAT" , "PRIOX" , "BEGDA" , "ENDDA" ,"VARYF" , "SEQNR" ;
    Autotrace output is :
    Execution Plan
    0 SELECT STATEMENT Optimizer=CHOOSE (Cost=4649 Card=171895 Byt
    es=22862035)
    1 0 SORT (ORDER BY) (Cost=4649 Card=171895 Bytes=22862035)
    2 1 TABLE ACCESS (FULL) OF 'HRP1001' (Cost=1170 Card=171895
    Bytes=22862035)
    Statistics
    0 recursive calls
    5 db block gets
    12157 consistent gets
    11543 physical reads
    0 redo size
    38253080 bytes sent via SQL*Net to client
    376841 bytes received via SQL*Net from client
    34201 SQL*Net roundtrips to/from client
    0 sorts (memory)
    1 sorts (disk)
    512992 rows processed
    Since it is a issue with order by , it seems a PGA memory issue. there is 12GB PGA available but only 3GB gets allocated. pga_aggregate target is set in the DB. There is a index created for al the columns on order by, but it is not getting used.
    pleas suggest me as I am running into major problems, i can post the output of any query u require from my side. Any help wil be highly apprciated.
    Rishi

    > The query was alwasy spilling over to the One-Parse execution . It can be seen thru ST04N ->resource consumption-> sql work area trace.
    >
    > An undocumented oracle parameter smmmax_size was set which allowed for more usage of physical memory by single process and there was no spillover to the TEMP tablespaces.
    >
    > Also the File read time was analysed from Unix level ( From SAP thru ST04 ->filesystem wait s-> Avg rd (ms) and Ang writes (ms) which showed that reading from the File was not happening well. )
    Hi Rishi,
    the provided execution statistics prove the opposite:
    >Statistics
    >...
    >0 sorts (memory)
    > 1 sorts (disk)
    >512992 rows processed
    This indeed was a single-pass sort, which means it had to use the temp tablespace for one pass of the sorting/grouping.
    Remember that Oracle distinguishes three kinds of sorts: 1. "in memory", 2. "single-pass" and 3. "multi-pass".
    Only the first one won't need to spill out data to the disks. The others do this by definition.
    BTW: the file read times in ST04 are aquired through Oracle V$ views and not directly from the OS - that can make a big difference sometimes.
    regards,
    Lars

  • Query with group by clause

    Hi all,
    I am struggling with one query.So Just i am giving the example..
    CREATE TABLE test(num NUMBER,val NUMBER,description VARCHAR2(100))
    table having the following data
    num val description
    1 100 first
    1 200 second
    1 300 third
    Now i want to take the sum and discription based on num field..
    i should get like ==> 1 600 first
    my query is...
    SELECT SUM(val),description
    FROM test
    GROUP BY description
    But it's giving all records.because description field is there in select statement..
    I tried two cursors for this case..its o.k
    But Is there any way instead of using two cursors.
    Thanks,

    Not sure what you are trying to achieve here. For the same value of NUM (say 1), you have 3 different values of VAL & DESCRIPTION. Do you want to sum up the VAL values for a particular value of NUM? In that case, what will be the corresponding DESCRIPTION?
    How did you arrive at the result --- 1 600 first
    -- whereas the DESCRIPTION is different for the 3 VAL values?

  • EJB finder query with ORDER BY clause

    Hi,
    How to query the data in ordered list using Order By clause in the entity Bean.
    Here is the part of My code in which i am interrested.
    /* @ejbgen:finder
    * signature = "Collection findAllData()"
    * ejb-ql = "SELECT OBJECT(z) FROM DataProfileBean AS z"
    abstract public class DataProfileBean extends EntityAdapter {
    * @ejbgen:cmp-field column = DATA_PREFIX
    * @ejbgen:primkey-field
    * @ejbgen:local-method transaction-attribute = Required
    public abstract Integer getDataPrefix();
    public abstract void setDataPrefix(Integer DataPrefix);
    Now what modification needs to be done in the ejb-ql query to find the DataPrefix in the sorted list.
    Regards,
    Dilip

    I don't think the current spec for EJBs support ORDER BY. But Weblogic has an extension that you can use (that is, if you're using it). Here's the info: http://e-docs.bea.com/wls/docs61/ejb/cmp.html#1076421

Maybe you are looking for

  • Problems with servlets and packages

    "im trying to use a package called C:\Acme which includes a GifEncoder C:\Acme\JPM\Encoders the problem is that weblogic 6.1 doesnt seem to find it, this is the error i get in the console           <Dec 8, 2001 2:46:20 PM PST> <Error> <HTTP> <[WebApp

  • How to automate the process of adding members into the planning workflow and assigning owners to it?

    Hi, We have a workflow XYZ. After every two-three days our entity structure is getting refreshed - so new entities comes in. Every time we have to manually add these new entities to the workflow and assign owners to it. Please let me know if there is

  • Need help with my Report Header

    Hi I have this report that I had to add a column to. which i did. but the problem is I can't find where the report getting its header information from so that I can shift it so that it apears correct format. Here is the code *& Report  ZSALES        

  • Linking 2 Accounts

    My wife and I have seperate iTunes accounts on seperate computers. We use the same credit card for purchases in the AppStore, specifically for out iPhone 4's. My question is, can we link these accounts so purchases she makes can be downloaded by me a

  • NEO 4 platinum questions

    hello all, been lookin thru the posts and havent come many answers  so i figured id start this specs are in sig the first board i recieved was crap ..the sata would not turn off regagrdless of what drives i used  serial or ide , emailed msi and after