Comments on SQL Preference

I am running into a number of people who are using conditions in a Join that I believe should be used in a where clause. Curious on your comments on what is preferred and why. Below is an example, it is not important the tables that are joined, but the method.
Focus on the Joins...
SELECT SINVOICE.INVDAT_0 AS INVDATE, SINVOICE.NUM_0 AS INVNUM, SINVOICE.ROWID as LINENUM, 0 as CUSTPO, BPCUSTOMER.BPCGRU_0 as GROUPCUST,
BPGROUP.BPCNAM_0 as GROUPNAME, SINVOICE.BPCORD_0 as CUSTOMER, BPCUSTOMER.BPCNAM_0 as CUSTNAME, SINVOICE.ITMREF_0 as ITEMNUM,
ITMMASTER.ITMDES1_0 as ITEMDESC, ITMMASTER.ITMDES2_0 as LONGITEMDESC, (SINVOICE.GROPRI_0 * SINVOICE.QTY_0) as GROSS$$,
(SINVOICE.NETPRI_0 * SINVOICE.QTY_0) as NET$$, SINVOICE.GROPRI_0 as ITEMPRICE, SINVOICE.NETPRI_0 as NETITEMPRICE, SINVOICE.QTY_0 as QTY,
ITMMASTER.SAU_0 as UM, ITMMASTER.SAUSTUCOE_0 as UMWEIGHT, '' as ORDERNUM, '03/28/2014' as INVSYSDATE,
SINVOICE.SHIDAT_0 as SHIPDATE, '1' as FISCALWEEK, PERIOD.PERNUM_0 as FISCALMONTH, '1' as FISCALQTR, PERIOD.FIYNUM_0 as FISCALYEAR,
BPCUSTOMER.REP_0 as SALESREP, CSALESREP.REPNAM_0 as REPNAME, BPCUSTOMER.REP_1 as SBROKER, CBROKER.REPNAM_0 as BROKERNAME,
BPGROUP.REP_0 as GROUPREP, GSALESREP.REPNAM_0 as GREPNAME, BPGROUP.REP_1 as GBROKER, GBROKER.REPNAM_0 as GBROKERNAME,
ITMMASTER.SAU_0 as SALESUNIT, ITMMASTER.SAUSTUCOE_0 as SALESWEIGHT, ITMMASTER.PCU_0 as PAKCUNIT1, ITMMASTER.PCU_1 as PACKUNIT2,
ITMMASTER.PCUSTUCOE_0 as PU1WEIGHT, ITMMASTER.PCUSTUCOE_1 as PU2WEIGHT, ITMMASTER.Z_PALNUM_0 as PALQTY,
(ITMMASTER.Z_PALNUM_0 * IIf(ITMMASTER.PCUSTUCOE_1 > 0, ITMMASTER.PCUSTUCOE_1,ITMMASTER.PCUSTUCOE_0)) as PALWEIGHT,
CCHANNEL.DES_0 as SALESCHANNEL, GCHANNEL.DES_0 as GROUPCHANNEL, IPRODUCT.DES_0 as PRODUCT, IGRAIN.DES_0 as GRAIN,
IPRODCAT.DES_0 as PRODCAT, ITMMASTER.ITMDES3_0 as BRAND, BPADDRESS.BPAADDLIG_0 as ADDLN1, BPADDRESS.BPAADDLIG_1 as ADDLN2, BPADDRESS.CTY_0 as CITY,
BPADDRESS.SAT_0 as ADDSTATE,BPADDRESS.POSCOD_0 as ZIPCODE
FROM
[x3v6].PRODUCTION.ZPRISMINVD as SINVOICE  Left Outer Join [x3v6].PRODUCTION.PERIOD as PERIOD on (SINVOICE.INVDAT_0 Between PERIOD.PERSTR_0 And PERIOD.PEREND_0)
 Inner Join [x3v6].PRODUCTION.ITMMASTER as ITMMASTER on (SINVOICE.ITMREF_0 = ITMMASTER.ITMREF_0)
 Left Outer Join [x3v6].PRODUCTION.CACCE as IPRODUCT on (ITMMASTER.CCE_2 = IPRODUCT.CCE_0 And IPRODUCT.DIE_0 = 'PRD')
 Left Outer Join [x3v6].PRODUCTION.CACCE as IGRAIN on (ITMMASTER.CCE_3 = IGRAIN.CCE_0 And IGRAIN.DIE_0 = 'PRG')
 Left Outer Join [x3v6].PRODUCTION.CACCE as IPRODCAT on (ITMMASTER.CCE_6 = IPRODCAT.CCE_0 And IPRODCAT.DIE_0 = 'PRC')
 Inner Join [x3v6].PRODUCTION.BPCUSTOMER as BPCUSTOMER on (SINVOICE.BPCORD_0 = BPCUSTOMER.BPCNUM_0)
 Left Outer Join [x3v6].PRODUCTION.CACCE as CCHANNEL on (BPCUSTOMER.BCGCOD_0 = CCHANNEL.CCE_0 And CCHANNEL.DIE_0 = 'CUS')
 Left Outer Join [x3v6].PRODUCTION.BPCUSTOMER as BPGROUP on (BPCUSTOMER.BPCGRU_0 = BPGROUP.BPCNUM_0)
 Left Outer Join [x3v6].PRODUCTION.CACCE as GCHANNEL on (BPGROUP.BCGCOD_0 = GCHANNEL.CCE_0 And GCHANNEL.DIE_0 = 'CUS')
 Left Outer Join [x3v6].PRODUCTION.SALESREP as CSALESREP on (BPCUSTOMER.REP_0 = CSALESREP.REPNUM_0)
 Left Outer Join [x3v6].PRODUCTION.SALESREP as CBROKER on (BPCUSTOMER.REP_1 = CBROKER.REPNUM_0)
 Left Outer Join [x3v6].PRODUCTION.SALESREP as GSALESREP on (BPGROUP.REP_0 = GSALESREP.REPNUM_0)
 Left Outer Join [x3v6].PRODUCTION.SALESREP as GBROKER on (BPGROUP.REP_1 = GBROKER.REPNUM_0)
 Left Outer Join [x3v6].PRODUCTION.BPADDRESS as BPADDRESS on (BPCUSTOMER.BPCNUM_0 = BPADDRESS.BPANUM_0 And BPCUSTOMER.BPDADD_0 = BPADDRESS.BPAADD_0)
Order by INVDATE, INVNUM
My preference would be ...
SELECT SINVOICE.INVDAT_0 AS INVDATE, SINVOICE.NUM_0 AS INVNUM, SINVOICE.ROWID as LINENUM, 0 as CUSTPO, BPCUSTOMER.BPCGRU_0 as GROUPCUST,
BPGROUP.BPCNAM_0 as GROUPNAME, SINVOICE.BPCORD_0 as CUSTOMER, BPCUSTOMER.BPCNAM_0 as CUSTNAME, SINVOICE.ITMREF_0 as ITEMNUM,
ITMMASTER.ITMDES1_0 as ITEMDESC, ITMMASTER.ITMDES2_0 as LONGITEMDESC, (SINVOICE.GROPRI_0 * SINVOICE.QTY_0) as GROSS$$,
(SINVOICE.NETPRI_0 * SINVOICE.QTY_0) as NET$$, SINVOICE.GROPRI_0 as ITEMPRICE, SINVOICE.NETPRI_0 as NETITEMPRICE, SINVOICE.QTY_0 as QTY,
ITMMASTER.SAU_0 as UM, ITMMASTER.SAUSTUCOE_0 as UMWEIGHT, '' as ORDERNUM, SINVOICE.INVDAT_0 as INVSYSDATE,
SINVOICE.SHIDAT_0 as SHIPDATE, Null as FISCALWEEK, PERIOD.PERNUM_0 as FISCALMONTH, Null as FISCALQTR, PERIOD.FIYNUM_0 as FISCALYEAR,
BPCUSTOMER.REP_0 as SALESREP, CSALESREP.REPNAM_0 as REPNAME, BPCUSTOMER.REP_1 as SBROKER, CBROKER.REPNAM_0 as BROKERNAME,
BPGROUP.REP_0 as GROUPREP, GSALESREP.REPNAM_0 as GREPNAME, BPGROUP.REP_1 as GBROKER, GBROKER.REPNAM_0 as GBROKERNAME,
ITMMASTER.SAU_0 as SALESUNIT, ITMMASTER.SAUSTUCOE_0 as SALESWEIGHT, ITMMASTER.PCU_0 as PAKCUNIT1, ITMMASTER.PCU_1 as PACKUNIT2,
ITMMASTER.PCUSTUCOE_0 as PU1WEIGHT, ITMMASTER.PCUSTUCOE_1 as PU2WEIGHT, ITMMASTER.Z_PALNUM_0 as PALQTY,
(ITMMASTER.Z_PALNUM_0 * IIf(ITMMASTER.PCUSTUCOE_1 > 0, ITMMASTER.PCUSTUCOE_1,ITMMASTER.PCUSTUCOE_0)) as PALWEIGHT,
CCHANNEL.DES_0 as SALESCHANNEL, GCHANNEL.DES_0 as GROUPCHANNEL, IPRODUCT.DES_0 as PRODUCT, IGRAIN.DES_0 as GRAIN,
IPRODCAT.DES_0 as PRODCAT, ITMMASTER.ITMDES3_0 as BRAND, BPADDRESS.BPAADDLIG_0 as ADDLN1, BPADDRESS.BPAADDLIG_1 as ADDLN2, BPADDRESS.CTY_0 as CITY,
BPADDRESS.SAT_0 as ADDSTATE,BPADDRESS.POSCOD_0 as ZIPCODE
FROM [x3v6].PRODUCTION.ZPRISMINVD as SINVOICE
 Left Outer Join [x3v6].PRODUCTION.PERIOD as PERIOD on (SINVOICE.INVDAT_0 Between PERIOD.PERSTR_0 And PERIOD.PEREND_0)
 Inner Join [x3v6].PRODUCTION.ITMMASTER as ITMMASTER on (SINVOICE.ITMREF_0 = ITMMASTER.ITMREF_0)
 Left Outer Join [x3v6].PRODUCTION.CACCE as IPRODUCT on (ITMMASTER.CCE_2 = IPRODUCT.CCE_0)
 Left Outer Join [x3v6].PRODUCTION.CACCE as IGRAIN on (ITMMASTER.CCE_3 = IGRAIN.CCE_0)
 Left Outer Join [x3v6].PRODUCTION.CACCE as IPRODCAT on (ITMMASTER.CCE_6 = IPRODCAT.CCE_0)
 Inner Join [x3v6].PRODUCTION.BPCUSTOMER as BPCUSTOMER on (SINVOICE.BPCORD_0 = BPCUSTOMER.BPCNUM_0)
 Left Outer Join [x3v6].PRODUCTION.CACCE as CCHANNEL on (BPCUSTOMER.BCGCOD_0 = CCHANNEL.CCE_0)
 Left Outer Join [x3v6].PRODUCTION.BPCUSTOMER as BPGROUP on (BPCUSTOMER.BPCGRU_0 = BPGROUP.BPCNUM_0)
 Left Outer Join [x3v6].PRODUCTION.CACCE as GCHANNEL on (BPGROUP.BCGCOD_0 = GCHANNEL.CCE_0)
 Left Outer Join [x3v6].PRODUCTION.SALESREP as CSALESREP on (BPCUSTOMER.REP_0 = CSALESREP.REPNUM_0)
 Left Outer Join [x3v6].PRODUCTION.SALESREP as CBROKER on (BPCUSTOMER.REP_1 = CBROKER.REPNUM_0)
 Left Outer Join [x3v6].PRODUCTION.SALESREP as GSALESREP on (BPGROUP.REP_0 = GSALESREP.REPNUM_0)
 Left Outer Join [x3v6].PRODUCTION.SALESREP as GBROKER on (BPGROUP.REP_1 = GBROKER.REPNUM_0)
 Left Outer Join [x3v6].PRODUCTION.BPADDRESS as BPADDRESS on (BPCUSTOMER.BPCNUM_0 = BPADDRESS.BPANUM_0 And BPCUSTOMER.BPDADD_0 = BPADDRESS.BPAADD_0)
Where IPRODUCT.DIE_0 = 'PRD' AND IGRAIN.DIE_0 = 'PRG' AND IPRODCAT.DIE_0 = 'PRC' And CCHANNEL.DIE_0 = 'CUS' And GCHANNEL.DIE_0 = 'CUS'
Order by INVDATE, INVNUM
Lee

Stylistically, I prefer your version with those bolded elements in the where clause.  Is that enough focus on the point you are making?
I also prefer that my queries not take up half a page.  So I think that your queries are both bad.  You need to eliminate all of the joins, because it looks ugly and is hard to read.  Get rid of half of the table references.
While you are at it, those column names stink.  If the column name doesn't make sense, leave it out of the query entirely.  It makes the query hard to read.
This is all tongue in cheek. First you need to write the query in a way that returns the results you need.  If you can write it in a way that is easier to read and get the results you need, write it that way.
Would your compatriots write the same query with the same choice of on clause if they were using inner joins?  If they would, I would suggest that the second version with those conditions in the where clause is easier to read.  It won't affect
the execution plan to use either syntax (with INNER JOINS).
Russel Loski, MCT, MCSE Data Platform/Business Intelligence. Twitter: @sqlmovers; blog: www.sqlmovers.com

Similar Messages

  • How to comment my SQL in PL/SQL so that the comment carries to AWR?

    Is there anything about using comments as in /* some comment */ in a SQL statement in a PL SQL procedure and expecting that to be carried thru to AWR?
    Right now it seems my comments are not visible in the AWR history. I'm wondering if they are compiled out when they are in PL/SQL blocks or not?
    Is there a way to preserve them such that they remain without using dynamic sql?

    steffi wrote:
    Is there anything about using comments as in /* some comment */ in a SQL statement in a PL SQL procedure and expecting that to be carried thru to AWR?Comments are stripped from (static) SQL code written in PL/SQL, unless that comment is a CBO hint.
    It is a "+Good Thing+" as it reduces the memory footprint of the cursor in the shared pool. It also ensures a greater potential degree of cursor sharing as the very same SQL statement with different comments will wind up as a single re-usable cursor.
    Why exactly do you want to see comments in SQL cursors in AWR reports? This is just a high level overview - not sure what enlightenment SQL comments will bring.

  • SQL Developer - Adding a column comment via SQL

    When I add a comment in SQL*Plus via SQL, such as COMMENT ON COLUMN "MY_OWNER"."MY_TABLE"."MY_COLUMN" IS 'column comment' it works fine. When I try the same thing in SQL Developer I receive a message "No SQL statement entered".
    I realize this can be done in SQL Developer via action buttons in the user interface; but I need to be able to do it via SQL since my procedure generates this code for hundreds of columns at one time.
    Is there a SQL way to do this in SQL Developer? Alternatively, can SQL Developer call SQL*Plus to run commands?

    This is a current bug when executing as statement (F9).
    Good news is it does work when running as script (F5).
    Have fun,
    K.

  • Vote/Comment on SQL Developer Add-in: CopyAsHtml

    Hi,
    I'm not sure if this is against any rules, but I wanted to make the SQL Developer community aware of this feature request and would ask you to simply add a vote/comment on this if you used this feature from SQL Developer 3 to allow you to copy code out of SQL Developer with full syntax highlighting, font, and indentations into 3rd party programs.
    Vote here:
    https://apex.oracle.com/pls/apex/f?p=43135:7:4683410243712::NO::P7_ID:41621
    Thanks.

    Ok its working again... Initial build of SQL Developer 1.5 (5338) was not showing the geom layers on the georaptor....
    I am happy to report that with SQL Developer 1.5.1 (5440) Georaptor layers on the Spatial view are working again.
    Thanks to the anonymous developers that fixed it!

  • Can't find Comment tool nor preferences nor Getting Started nor the version etc

    I am starting to try and work with Adobe Reader for Windows 8.1 but I find it so streamlined as to be unworkable. I have checked some You Tube videos and the support subjects but apparently everything I need is hidden away somewhere.
    I can't find what version I am using.
    I can't find where my preferences are
    I can't find Getting Started
    I can't find the Annotations Panel
    I can't find the Comment Tool
    I can't find the Commenting Panel
    I believe the apps bar to be along the bottom but when I pull that up and click options I can access "info" and that is it. On the upper right hand corner I can minimalize or close. That is it. I can change from single to double page and I can set it for continuous but nothing else. And disconcertingly when I enter these questions in the support search they are not found. Streamline is good but this isn't Thanks,

    Dear Pat -
                  It's official. This is the worst program I have ever seen. You and I have gone back and forth many times and the amount of time I am wasting trying to get the most elemental tasks accomplished is not to be believed. How is Adobe still in business?
                    The first and MOST IMPORTANT thing is where is the MANUAL . I cannot anything that helps me. and NO I can not find in the Control panel the version I am supposed to be using. But AGAIN  the MAIN THING is for me to get some help with the rudimentary aspects of the program. Unfortunately your program came with my windows package but because you guys decided to hide all the functionality I can't use it. I can't print, Your help and support is utterly worthless since it starts from the premise that I can find the buttons or controls necessary. I cannot. I can now find how to add a note, but I discovered that accidentally. I NEED TO KNOW WHERE THE MANUAL is or, if there is none and it could be dicey since I CAN'T FIND THE VERSION i AM using is there a tutorial or ANYBODY OUT THERE who can help me figure out how to do the basic stuff. My organization is trying to persuade me that we have to use this program but I am fighting back. Unless and until someone can demonstrate ANY USEFULLNESS, I hate Reader.

  • Comments to be displayed in SQL*PLUS....

    Hi ,
    When i issue the following command in PL/SQL Developer(third-party tool) - as user SCOTT :
    SQL> desc user_extents;
    Name            Type              Nullable Default Comments                                           
    SEGMENT_NAME    VARCHAR2(81 BYTE) Y                Name of the segment associated with the extent     
    PARTITION_NAME  VARCHAR2(30 BYTE) Y                Partition/Subpartition Name, if any, of the segment
    SEGMENT_TYPE    VARCHAR2(18 BYTE) Y                Type of the segment                                
    TABLESPACE_NAME VARCHAR2(30 BYTE) Y                Name of the tablespace containing the extent       
    EXTENT_ID       NUMBER            Y                Extent number in the segment                       
    BYTES           NUMBER            Y                Size of the extent in bytes                        
    BLOCKS          NUMBER            Y                Size of the extent in ORACLE blocks    Whereas when i issue the same command in SQL*PLUS....
    SQL> desc user_extents;
    ¼íïìá                                     Null;    Ôýðïò
    SEGMENT_NAME                                       VARCHAR2(81)
    PARTITION_NAME                                     VARCHAR2(30)
    SEGMENT_TYPE                                       VARCHAR2(18)
    TABLESPACE_NAME                                    VARCHAR2(30)
    EXTENT_ID                                          NUMBER
    BYTES                                              NUMBER
    BLOCKS                                             NUMBERHow can i get the comments in SQL*PLUS as well...?????
    I use ORA10g v.2
    Thanks....
    Sim

    Plsql developer probably issue something like this in the background:
    select col.column_name,data_type,nullable,data_default,comments
    from all_tab_columns col,all_col_comments com
    where col.table_name=com.table_name
    and col.owner=com.owner
    and col.column_name=com.column_name
    and col.owner='SYS'
    and col.table_name = 'USER_EXTENTS'You could save similar code in script in your SQLPATH and pass the object that should be described via substitution variable.
    There are really [url http://www.adp-gmbh.ch/blog/2005/september/25.html]interesting approaches on the net regarding describe customization.
    Best regards
    Maxim

  • Sql Developer Launcher Not Working In Linux

    Hello,
    System Details:
    Fedora 19
    Sql Developer Version: Version 4.0.0.12
    Java Version:  OpenJDK 1.7.0-40
    I can launch Sql Developer from the command line successfully.
    /opt/sqldeveloper/sqldeveloper.sh
    But when I attempt to use the launcher icon, I receive a SIGSEGV error.  Here is the top of the hs_error.log file.
    # A fatal error has been detected by the Java Runtime Environment:
    #  SIGSEGV (0xb) at pc=0x000000317a062e00, pid=7680, tid=140636646749952
    # JRE version: OpenJDK Runtime Environment (7.0_40-b60) (build 1.7.0_40-mockbuild_2013_10_02_16_56-b00)
    # Java VM: OpenJDK 64-Bit Server VM (24.0-b56 mixed mode linux-amd64 compressed oops)
    # Problematic frame:
    # C  0x000000317a062e00
    The ~/.sqldeveloper/jdk file contains the following:
    /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.2.7.fc19.x86_64
    And my /usr/share/applications/sqldeveloper.desktop file contains the following:
    [Desktop Entry]
    Encoding=UTF-8
    Name=SQL Developer
    Comment=Oracle SQL Developer
    Icon=/opt/sqldeveloper/icon.png
    Exec=/opt/sqldeveloper/sqldeveloper.sh
    Terminal=true
    Type=Application
    Categories=GNOME;Oracle;
    I'm just switching from Ubuntu to Fedora so this has not worked in the past.
    Thank you for any help,
    Ann

    The solution in https://forums.oracle.com/thread/2594033 worked.  I added the 2nd line below to /opt/sqldeveloper/sqldeveloper.sh.
    #!/bin/bash
    unset -v GNOME_DESKTOP_SESSION_ID
    cd "`dirname $0`"/sqldeveloper/bin && bash sqldeveloper $*
    Previously, I incorrectly updated ~/.bashrc to unset GNOME_DESKTOP_SESSION_ID.  That's why running Sql Developer from the command line worked, but not from the launcher.
    Thanks su.

  • Problem with posting comments of a specific picture

    So I have been able to post the comment in the page I am creating and that comment is also saved in the comment table in the database with the id of the picture but when i am in the first picture and I comment the comments are posted saved in the database with the id 1 and then i go to the second the comments are also posted and saved in the tabel comment with the id of the picture 2. But my problem is that when i go to the second picture i can also see the comments of the first picture. So in all of my pictures I can see comments of pictures with other id. How can i manage to solve this problem. Please suggest me sth
    I'll describe a little bit my database
    name of database is art
    picture tabel I have named piktur(id_piktur,Titulli,Pershkrimi,Piktur_url) rsGallery is picture recordset
    the comment tabel I have named komente(id_koment,id_piktur,Tekst)rsKomente is comment recordset
    Tekst is the column where the comment is save
    I'm using the session variable so i can get the id of the picture from the picture table and insert it in id picture column of the comment tabel
    this is the piece of code i guess i should make some conditions but i have tried sth myself but I have not managed to solve my problem. The pictures in my page are organised with paging and repeat region only showing 1 picture at a time. the comment are also repeat region showing all the comments at a time.
    <p>
          <?php  while ($row_rsKomente = mysql_fetch_assoc($rsKomente)) { ?>
            <?php
    $id_piktur=$row_rsGallery['Id_piktur']; $_SESSION['id_piktur']=$id_piktur;
              echo $row_rsKomente['Tekst']."<br/>" ;?>
            <?php } ?>
      </p>
    my entire code is shown below if you don't think this code is enough for solving the problem gallery.php Thank you in advance
    gallery.php
    <?php require_once('Connections/art.php'); ?>
    <?php session_start() ?>
    <?php
    if (!function_exists("GetSQLValueString")) {//this is some code i don't shown in here because it has nothing to do with the problem i want to solve}
    if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1") &&(isset($_SESSION['id_piktur'])) ) {
      $insertSQL = sprintf("INSERT INTO komente (Tekst,id_piktur) VALUES (%s,'".$_SESSION['id_piktur']."')", GetSQLValueString($_POST['tekst'], "text"));
      mysql_select_db($database_art, $art);
      $Result1 = mysql_query($insertSQL, $art) or die(mysql_error());
    $maxRows_rsGallery = 1;
    $pageNum_rsGallery = 0;
    if (isset($_GET['pageNum_rsGallery'])) {
      $pageNum_rsGallery = $_GET['pageNum_rsGallery'];
    $startRow_rsGallery = $pageNum_rsGallery * $maxRows_rsGallery;
    mysql_select_db($database_art, $art);
    $query_rsGallery = "SELECT Pershkrim, Piktur_url, Rankim,id_piktur FROM piktur";
    $query_limit_rsGallery = sprintf("%s LIMIT %d, %d", $query_rsGallery, $startRow_rsGallery, $maxRows_rsGallery);
    $rsGallery = mysql_query($query_limit_rsGallery, $art) or die(mysql_error());
    $row_rsGallery = mysql_fetch_assoc($rsGallery);
    if (isset($_GET['totalRows_rsGallery'])) {
      $totalRows_rsGallery = $_GET['totalRows_rsGallery'];
    } else {
      $all_rsGallery = mysql_query($query_rsGallery);
      $totalRows_rsGallery = mysql_num_rows($all_rsGallery);
    $totalPages_rsGallery = ceil($totalRows_rsGallery/$maxRows_rsGallery)-1;
    $maxRows_rsKomente = 10; $pageNum_rsKomente = 0; if (isset($_GET['pageNum_rsKomente'])) {   $pageNum_rsKomente = $_GET['pageNum_rsKomente']; } $startRow_rsKomente = $pageNum_rsKomente * $maxRows_rsKomente;
    mysql_select_db($database_art, $art); $query_rsKomente = "SELECT Tekst,id_piktur FROM komente"; $query_limit_rsKomente = sprintf("%s LIMIT %d, %d", $query_rsKomente, $startRow_rsKomente, $maxRows_rsKomente); $rsKomente = mysql_query($query_limit_rsKomente, $art) or die(mysql_error()); $row_rsKomente = mysql_fetch_assoc($rsKomente);   if (isset($_GET['totalRows_rsKomente'])) {   $totalRows_rsKomente = $_GET['totalRows_rsKomente']; } else {   $all_rsKomente = mysql_query($query_rsKomente);   $totalRows_rsKomente = mysql_num_rows($all_rsKomente); } $totalPages_rsKomente = ceil($totalRows_rsKomente/$maxRows_rsKomente)-1;
    $queryString_rsGallery = "";
    if (!empty($_SERVER['QUERY_STRING'])) {
      $params = explode("&", $_SERVER['QUERY_STRING']);
      $newParams = array();
      foreach ($params as $param) {
        if (stristr($param, "pageNum_rsGallery") == false &&
            stristr($param, "totalRows_rsGallery") == false) {
          array_push($newParams, $param);
      if (count($newParams) != 0) {
        $queryString_rsGallery = "&" . htmlentities(implode("&", $newParams));
    $queryString_rsGallery = sprintf("&totalRows_rsGallery=%d%s", $totalRows_rsGallery, $queryString_rsGallery);
    $queryString_rsKomente = "";
    if (!empty($_SERVER['QUERY_STRING'])) {
      $params = explode("&", $_SERVER['QUERY_STRING']);
      $newParams = array();
      foreach ($params as $param) {
        if (stristr($param, "pageNum_rsKomente") == false &&
            stristr($param, "totalRows_rsKomente") == false) {
          array_push($newParams, $param);
      if (count($newParams) != 0) {
        $queryString_rsKomente = "&" . htmlentities(implode("&", $newParams));
    $queryString_rsKomente = sprintf("&totalRows_rsKomente=%d%s", $totalRows_rsKomente, $queryString_rsKomente);
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Paintings</title>
    <link href="style_gallery.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
      </div>
    <div id="logo_wrapper">
    <!-- For the example logo, we used a font called "Ink Burrow", which is free from the major font sites. -->
    <div id="logo"><img src="_images/logo.png" width="600" height="79" align="right" /></div>
    </div>
    <div id="main_container">
    <div id="menu_container">
    <div id="menu">
    <ul id="base_menu" >
    <li><a href="index.php">Home</a></li>
    <li><a href="#">About</a></li>
    <li><a href="gallery.php">Gallery</a></li>
    <ul class="sub_menu">
    <li><a href="#" title="Charcoal" >Charcoal </a></li>
            <li><a href="#" title="Oil paintings" >Oil paintings</a></li>
            <li><a href="#" title="Sketches" >Sketches </a></li>
            <li><a href="#" title="Our latest podcast" >Video Podcast</a></li>
    </ul>
    <li><a href="#">Contact </a></li>
    <li><a href="#">Events</a></li>
    <li><a href="login.php">Log in</a></li>
    </ul>
    </div>
    </div>
    <div id="mainArticle">
        <h1>Painting Gallery</h1>
          <p>Welcome !</p>
        <p>
          <?php do{ ?>
       <?php   $id_piktur=$row_rsGallery['id_piktur']; $_SESSION['id_piktur']=$id_piktur;             echo $row_rsKomente['Tekst']."<br/>" ;                      ?>         <?php }  while ($row_rsKomente = mysql_fetch_assoc($rsKomente)); ?>  </p>
          <form id="form1" name="form1" method="POST" action="<?php echo $editFormAction; ?>">
            <p>
              <label for="comment">Comment : </label>
            </p>
            <p>
              <textarea name="tekst" id="tekst" cols="45" rows="5"></textarea>
            </p>
            <input name="comment" type="submit" value="Comment" />
            <input type="hidden" name="MM_insert" value="form1" />
          </form>
          <p> </p>
          <p>
            <a href="<?php printf("%s?pageNum_rsGallery=%d%s", $currentPage, 0, $queryString_rsGallery); ?>">First</a>
            <a href="<?php printf("%s?pageNum_rsGallery=%d%s", $currentPage, max(0, $pageNum_rsGallery - 1), $queryString_rsGallery); ?>">Previous</a>
            <a href="<?php printf("%s?pageNum_rsGallery=%d%s", $currentPage, min($totalPages_rsGallery, $pageNum_rsGallery + 1), $queryString_rsGallery); ?>">Next</a>
            <a href="<?php printf("%s?pageNum_rsGallery=%d%s", $currentPage, $totalPages_rsGallery, $queryString_rsGallery); ?>">Last</a>
    <p class="galleryText"><img src="_images/<?php echo $row_rsGallery['Piktur_url']; ?>" alt="golden gate bridge" class="galleryImage" />    <?php do { ?>     <?php echo $row_rsGallery['Pershkrim']; ?>     <?php } while ($row_rsGallery = mysql_fetch_assoc($rsGallery)); ?> </p>
      </div>
    <p> </p>
    </div>
    </body>
    </html>
    <?php
    mysql_free_result($rsGallery);
    mysql_free_result($rsKomente);
    ?>

    >thnx yeah i fixed the problem this time i understood you.
    Glad you got it working.
    >you confused me the first time with the explanation because you mentioned loops
    Yeah. Normally with a repeating region you would need to use nested loops; an outer loop for the picture and an inner loop for the related comments. During each iteration of the outer loop you would execute the sql to retrieve the inner loop recordset. However, since you are using paging with only one recordset per page, the comment recordset SQL does not have to execute inside the picture loop. Hope that makes sense.

  • How to pass a variable for a SQL query in OLEDB source?

    Hi All,
    I am new to SSIS and working on it past few days. Can anyone please help me getting through a scenario where I need to pass a variable in the SQL statement in OLEDB source connection. Please find below for the details.
    eg:
    1) I have a SQL table with the columns SerialNumber, Name, IsValid, FileName with multiple rows.
    2) I have the file Name in a variable called Variable1.
    3) I want to read the data from my SQL table filtering based on the FileName (Variable1) within a data flow task and pull that data to the destination table.
    Question: In the data flow task, added source and destination DB connection with a script component in between to perform my validations. When trying to retrieve the data from source using the variable (i.e. SQL Query with variable), I am not able to add
    the query as the SQL statement box is disabled. How to filter the data based on the variable in the source DB ?
    Any help/suggestions would be of great help.
    Thanks,
    Sri

    Just to add with Vaibhav comment .
    SQL Command  : SQL query either with SQL variable or any condition  or simple Sql statement
    Like ;
    Select * from dimcustomer
    SQL Command using Varible :
    Sometimes we design our dynamic query in variable and directly use that variable name in oledb source.
    If you Sql query needs a condition based on SSIS variable .
    you can find a Example here :
    http://www.toadworld.com/platforms/sql-server/b/weblog/archive/2013/01/17/ssis-replace-dynamic-sql-with-variables.aspx
    http://www.select-sql.com/mssql/how-to-use-a-variable-inside-sql-in-ssis-data-flow-tasks.html
    Thanks
    Please Mark This As Answer or vote for Helpful Post if this helps you to solve your question/problem. http://techequation.com

  • SQL Server 2014 Express (32 bit) issues with Microsoft OLE DB Provider for Visual FoxPro

    Hello, I am trying to create a sample data warehouse and some reports etc to demonstrate SQL server and subsequent automation to a company I am working for.  I am trying to import data from the company's VFP based software into a new SQL Server database.
     (please note, this is not custom developed software, so i am unable to push the data from VPF)
    I keep getting errors and SQL server crashes when i try to access the Microsofl OLE DB Provider for Visual Fox Pro similar to this thread https://social.msdn.microsoft.com/Forums/en-US/88296548-553e-4402-93e3-6f26f5de343d/dtswizard-importexport-utility-error-trying-to-use-vfp-oledb-provider?forum=sqldataaccess
     however, the solution outlined in that thread will not work, as i cannot create an SSIS package in Express.
    I have also attempted to use the OLE DB in Excel as well to test it, and it crashes Excel the same way.  
    results of the following query Exec master.dbo.xp_msver
    Index Name
    Internal_Value Character_Value
    1 ProductName
    NULL Microsoft SQL Server
    2 ProductVersion
    786432 12.0.2000.8
    3 Language
    1033 English (United States)
    4 Platform
    NULL NT INTEL X86
    5 Comments
    NULL SQL
    6 CompanyName
    NULL Microsoft Corporation
    7 FileDescription
    NULL SQL Server Windows NT
    8 FileVersion
    NULL 2014.0120.2000.08 ((SQL14_RTM).140220-1752)
    9 InternalName
    NULL SQLSERVR
    10 LegalCopyright
    NULL Microsoft Corp. All rights reserved.
    11 LegalTrademarks
    NULL Microsoft SQL Server is a registered trademark of Microsoft Corporation.
    12 OriginalFilename
    NULL SQLSERVR.EXE
    13 PrivateBuild
    NULL NULL
    14 SpecialBuild
    131072008 NULL
    15 WindowsVersion
    131072008 6.1 (7601)
    16 ProcessorCount
    8 8
    17 ProcessorActiveMask
    255 000000ff
    18 ProcessorType
    586 PROCESSOR_INTEL_PENTIUM
    19 PhysicalMemory
    4055 4055 (4252094464)
    20 Product ID
    NULL NULL
    Any guidance is appreciated.  thanks!

    No, I attempted to use the Microsofl OLE DB Provider for Visual Fox Pro to access the .dbf from Excel,
    and it behaved identically to the way it did in SQL Server.
    I can use the Microsoft Excel Data source in SQL Server to link an excel file to SQL Server perfectly fine. 

  • Problem Printing Content from added comments

    Using Adobe Reader Version 10.1.2 on both 32 and 64 bit Windows 7 installations
    it is not possible to print the text from comments added to PDF's.
    When there is one comment this works fine.
    Where there are many comments they all print on the summary page one on top of another.
    Does anyone have or know of a solution?
    Thankx in advance

    I believe you are trying to do file->print->summarize comments which summarizes all the comments on a separate page and then prints it. It is the intended behavior.
    If you would like to print comments as they appear on screen. Then you would have to enable the “pop up notes” from commenting pane in preference. However, all pop-up notes have to be expanded(by explicityly clicking on them) if you want to see them in your prints as is and then click print and not summarize comments. I hope this description helps.
    Thanks,
    Atul

  • Does Reader allow one to make comments?

    I just downloaded Reader onto new MacBook.  I was asked to review and comment on a document send to me as pdf.  Thought I would have to print it and mark it up by hand, but it appears that reader allows comments and/or sticky notes to be attached.  Is this so?  If so, I don't appear to be able to control the identification attached to the comments.  Under preferences > identification, it is a term I used when migrating info from old computer, and then eliminated even before I downloaded Reader.  So: Can one attach comments using Reader?  And if so, how may one change the identity characteristics?

    Yes, the current version of Adobe Reader can now place sticky notes and highlights on any unsecured PDF file - though to use the full range of markup tools (drawing, text corrections, etc.) the file must have been rights-extended using a copy of Acrobat Pro.
    The identity used on comments is your operating system login name by default. You can change it via the Reader menu, first open the Preferences > Commenting panel and turn off "Always use Log-in name..." then enter your name in the preferences > Identity panel.

  • Returning composite datatype(record) to an SQL Query

    I have a function called get_customer_address() that takes customer id and returns the customer address as a record type.
    TYPE cust_address_type IS RECORD
    (address1 VARCHAR2(25),
    address2 VARCHAR2(25),
    city VARCHAR2(25),
    zipcode VARCHAR(10),
    STATE VARCHAR(10));
    cust_address cust_address_type;
    My function is returning cust_address.
    I want to modify below exising query and call this function from the query to get address.
    select cust_id, address1, address2, city, zipcode from customer_table;
    Instead of using address1, address2, city, zipcode if I want to the record type variable cust_id returned from the function, can I use it in my query? How do I modify the above query to call the function get_customer_address and get the same values as in the above query?

    To add to Elic's comment - PL/SQL record structures can be defined as SQL objects, as long as SQL data types are used and not non-supported PL/SQL types like boolean.
    E.g. create or replace type TCustAddress is object
    (  address1 VARCHAR2(25),
       address2 VARCHAR2(25),
       city     VARCHAR2(25),
       zipcode  VARCHAR2(10),
       state    VARCHAR2(10)
    );This provides a lot more flexibility than using PL/SQL record types. This is essentially an object class definition - and you can add constructors and methods to it.
    It works seamlessly across both SQL and PL/SQL.

  • Sql Loader by using shell script, not able to insert data

    Hi,
    I am trying to dump the data by using shell script.(in shell script i am having sqlldr command)(its a host excutable method cocurrent program)
    When i am loading the data, by placing my files(.ctl,.prog,.csv,symbolink file for .prog) in $Custom_top/bin, it is loading exactly. 17000 records inserted.
    But if i am loading the data by placing my files in $custom_top/custom_folders. unable to insert total data. only 43 records inserting.
    Please any one can help me.
    Thanks in advance.
    Rama.

    Srini, Thanks a lot for ur reply,
    Oracle Apps version R12,
    Microsoft windows XP profissional
    Version 2002 service Pack 3
    My Control file Script is:
    load data
    infile '$XADP_TOP/data/CPIU/in/XXOKS_Price_Increase.csv'
    append
    into table XXOKS_CONTRACT_PRICE_INCR_DTLS
    fields terminated BY ',' optionally enclosed by '"'
    TRAILING NULLCOLS
    (EXCLUSION_FLAG,
    LEGACY_NUMBER,
    CUSTOMER_NUMBER,
    CUSTOMER_NAME,
    REQUEST_ID,
    CONTRACT_NUMBER,
    CONTRACT_START_DATE,
    CONTRACT_END,
    REQUEST_LINE_ID,
    LINE_START_DATE,
    LINE_END_DATE,
    ITEM_NUMBER,
    ITEM_DESCRIPTION,
    UNIT_PRICE,
    QTY,
    NEW_UNIT_PRICE,
    LINE_AMOUNT,
    NEW_LINE_AMOUNT,
    PRICE_INCREASED_DATE,
    PERCENTAGE_INCREASED,
    ORIGINAL_CONTRACT_AMOUNT,
    NEW_CONTRACT_AMOUNT,
    PRICE_INCREASE_AMOUNT)
    My .prog File is: Please fidn that i created symbolink file also for my .prog.
    if [ -z $XADP_TOP ];then
    echo "XADP_TOP environment variable is not set!"
    exit 1
    fi
    cd $XADP_TOP/data/CPIU/in
    DATE=`date +%y%m%d:%H%M`
    i_program_name="$0"
    i_ora_pwd="$1"
    i_user_id="$2"
    i_user_name="$3"
    i_request_id="$4"
    i_ftp_host_name="$5"
    i_ftp_user_name="$6"
    i_ftp_user_password="$7"
    ftp_prog() {
    # FTP Function to reuse the FTP Commands
    if [ $# -ne 6 ];then
    echo "Usage : ftp_prog <Hostname> <User name> <Password> <Remote Directory> <command> <filename>"
    exit 2
    fi
    l_ftp_host_name="$1"
    l_ftp_user_name="$2"
    l_ftp_user_password="$3"
    l_ftpdir="$4"
    l_ftp_command="$5"
    l_ftp_filename="$6"
    ftp -v -n ${l_ftp_host_name} <<EOF
    user ${l_ftp_user_name} ${l_ftp_user_password}
    ascii
    cd ${l_ftpdir}
    ${l_ftp_command} ${l_ftp_filename}
    quit
    EOF
    #exit $?
    # setting the ftp directory
    #ftpdir="/`echo ${TWO_TASK:-$ORACLE_SID}|tr "[A-Z]" "[a-z]"`/CPIU"
    ##ftpdir="/FinTEST/quoting/PS/ar"
    ftpdir="$XADP_TOP/data/CPIU/in"
    # setting the in directory and out directory
    indir="$XADP_TOP/data/CPIU/in"
    outdir="$XADP_TOP/data/CPIU/out"
    ftp_prog ${i_ftp_host_name} ${i_ftp_user_name} ${i_ftp_user_password} ${ftpdir} get XXOKS_Price_Increase.csv
    echo $ftpdir
    echo "Converting the data file into unix mode"
    dos2unix XXOKS_Price_Increase.csv XXOKS_Price_Increase.csv
    chmod 777 XXOKS_Price_Increase.csv
    cd $XADP_TOP/bin
    echo "Trying to excute sqlldr and entering into the into control file"
    $ORACLE_HOME/bin/sqlldr userid=$i_ora_pwd control=XXOKS_PRICE_INCR_LOAD log=$XADP_TOP/log/XXOKS_PRICE_INCR_LOAD_${DATE}.log;
    exit_status=$?
    echo "Checking the status and giving permissions to the data file which in in dir"
    if [ $exit_status -eq 0 ]; then
    cd $XADP_TOP/data/CPIU/in
         chmod 777 XXOKS_Price_Increase.csv
    echo "try to move data file into out dir"
    # Moving the file to out directory
    mv XXOKS_Price_Increase.csv ${outdir}/XXOKS_Price_Increase.csv_${DATE}
    #echo "ready to zip file in out dir step6"
    # Zipping the file
    #gzip -f ${outdir}/XXOKS_Price_Increase.csv_${DATE}
    echo "deleting the file which is in dir"
    # Deleting the file from in directory
    /bin/rm -f ${indir}/XXOKS_Price_Increase.csv
    # Deleting from the remote directory
    ftp_prog ${i_ftp_host_name} ${i_ftp_user_name} ${i_ftp_user_password} ${ftpdir} delete XXOKS_Price_Increase.csv
    echo "sqlloader finished successfully."
    else
    echo "Error in loader"
    ##echo "Loader error in Price Increase Detials File ${i_file}"
    fi
    exit $exit_status
    And My Log file Comments are
    SQL*Loader: Release 10.1.0.5.0 - Production on Thu Dec 3 01:32:08 2009
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Control File: XXOKS_PRICE_INCR_LOAD.ctl
    Data File: /oesapp/applmgr/GIS11/apps/apps_st/appl/xadp/12.0.0/data/CPIU/in/XXOKS_Price_Increase.csv
    Bad File: XXOKS_Price_Increase.bad
    Discard File: none specified
    (Allow all discards)
    Number to load: ALL
    Number to skip: 0
    Errors allowed: 50
    Bind array: 64 rows, maximum of 256000 bytes
    Continuation: none specified
    Path used: Conventional
    Table XXOKS_CONTRACT_PRICE_INCR_DTLS, loaded from every logical record.
    Insert option in effect for this table: APPEND
    TRAILING NULLCOLS option in effect
    Column Name Position Len Term Encl Datatype
    EXCLUSION_FLAG FIRST * , O(") CHARACTER
    LEGACY_NUMBER NEXT * , O(") CHARACTER
    CUSTOMER_NUMBER NEXT * , O(") CHARACTER
    CUSTOMER_NAME NEXT * , O(") CHARACTER
    REQUEST_ID NEXT * , O(") CHARACTER
    CONTRACT_NUMBER NEXT * , O(") CHARACTER
    CONTRACT_START_DATE NEXT * , O(") CHARACTER
    CONTRACT_END NEXT * , O(") CHARACTER
    REQUEST_LINE_ID NEXT * , O(") CHARACTER
    LINE_START_DATE NEXT * , O(") CHARACTER
    LINE_END_DATE NEXT * , O(") CHARACTER
    ITEM_NUMBER NEXT * , O(") CHARACTER
    ITEM_DESCRIPTION NEXT * , O(") CHARACTER
    UNIT_PRICE NEXT * , O(") CHARACTER
    QTY NEXT * , O(") CHARACTER
    NEW_UNIT_PRICE NEXT * , O(") CHARACTER
    LINE_AMOUNT NEXT * , O(") CHARACTER
    NEW_LINE_AMOUNT NEXT * , O(") CHARACTER
    PRICE_INCREASED_DATE NEXT * , O(") CHARACTER
    PERCENTAGE_INCREASED NEXT * , O(") CHARACTER
    ORIGINAL_CONTRACT_AMOUNT NEXT * , O(") CHARACTER
    NEW_CONTRACT_AMOUNT NEXT * , O(") CHARACTER
    PRICE_INCREASE_AMOUNT NEXT * , O(") CHARACTER
    value used for ROWS parameter changed from 64 to 43
    Table XXOKS_CONTRACT_PRICE_INCR_DTLS:
    43 Rows successfully loaded.
    0 Rows not loaded due to data errors.
    0 Rows not loaded because all WHEN clauses were failed.
    0 Rows not loaded because all fields were null.
    Space allocated for bind array: 255162 bytes(43 rows)
    Read buffer bytes: 1048576
    Total logical records skipped: 0
    Total logical records read: 43
    Total logical records rejected: 0
    Total logical records discarded: 0
    Run began on Thu Dec 03 01:32:08 2009
    Run ended on Thu Dec 03 01:32:08 2009
    Elapsed time was: 00:00:00.19
    CPU time was: 00:00:00.04
    Plz srini help me.
    Thanks in advance
    Rama..

  • Print comments

    I just installed Reader 8.1.2. I have a document with comments (sticky notes and other) that I cannot print. Help says to go to Preferences and then to Commenting but I have no Commenting in my Preference. Can anyone help?

    I just get the document, with no comments.
    This is with 2 HP Laserjets, and a Kyocera FS9530DN.
    I really need an answer to this, else i'm gonna install my 10 user licence on all 100 Macs, just so they can print with comments!!

Maybe you are looking for

  • Use of TFTP to upgrade CE XR router via mgmt vrf from PE XR router

    I have a few CE routers that require an extra module loading. These routers have no access to the default vrf on a core router, they can only be accessed for management via that vrf. Is there any way to upload via TFTP (or any other protocol) an imag

  • IMac problem with Lion.

    Just installed Lion on iMac 2.66 GHz Intel Core 2 Duo, 4GB 1067 MHz DDR3. How do i get System Information to run? Won't load from More Info..., won't load with option Apple, and won't load from Utilities?

  • How do I cut and paste a link into firefox?

    Can't seem to get it right

  • 10.6.5 didn't solve my problem

    I've been seeing all the news that 10.6.5 supposedly solves the display problem. Well, I just got a grey-yellow screen, which is the 4th episode overall of my MBA 13" freezing overall. Anyone else still seeing this issue?

  • How to uninstall the patch?

    i'm upgrading from portal v3.0.9.8.0 to v3.0.9.8.3 but there's some major error, portal is not showing! anyway to uninstall the patches? thx