How to return the record count of a query to a number variable

How would I get the record count from a query without using a cursor to step through the query and count the records individually?
query: select * from table1 where column1 = column2
How would I get the record count of the query above?
thanks,
michelle

I figured it out
select count(*) into theCount
from ( select * from table1 where column1=column2 );
thanks,
michelle

Similar Messages

  • Get the record count from a query

    Hi,
    does anyone know how to get the record count from a sql query?
    e.g: I've got a ResultSet from the Statement.excuteQuery(), and I want to know how many records this ResultSet contains, how to get this?
    I'd read thoughout the documents of Statement and ResultSet, but couldn't find a solution, do I have to use another seperate query such as "select count(*)" to do this?
    thanks.
    Yang Liu

    If you are not using a scrollable result set then the following is the best way to do it.
    there are several key words in SQL that can be used, the one you are interested in is count();
    so if your query at the moment is
    "select col1, col2, col3 from my_table where col2=? and col3=?"you can work out how many rows will be returned by executing this command first
    "select count(col1) from my_table where col2=? and col3=?"this will return a result set with one row and one column, you can get the row count as follows:
    ResultSet rs = ps.executeQuery();
    int rowCount = rs.getInt(1);I hope this helps :)

  • How to caculate the records count for a measurement with a filter?

    I have a fact table which add relationship to a datetime dimension. I create a measurement based on the fact table, like [MeasureA]. I want to calculate the record counts of [measureA] of today, how to write the mdx query? Thanks!

    Hi Lavandula,
    According to your description, you want to calculate the numbers of the record of a measure for a specific day, right? In this case, you can use
    Count function which returns the number of cells in a set to achieve you requirement. Here is a sample query on Adventure Works for your reference.
    WITH
    MEMBER [Measures].[SetCount] AS
    COUNT([Product].[Product].[Product].Members)
    SELECT
    {[Measures].[SetCount]} ON COLUMNS
    FROM
    [Adventure Works]
    Besides, if you want to count the cell numbers with a condition, you can use
    Filter funtion inside the Count function.
    WITH MEMBER [Measures].[High Volume Products Count] AS
    Count(Filter([Product].[Product].[Product], [Measures].[Internet Order Quantity] > 5))
    SELECT [Customer].[Customer Geography].[Country] ON 0
    , [Date].[Calendar].[Date].MEMBERS ON 1
    FROM [Adventure Works]
    WHERE [Measures].[High Volume Products Count]
    Regards,
    Charlie Liao
    TechNet Community Support

  • How to get the record count printed for the report in the Dashboards

    Hi,
    I would like to get the record count printed at the bottom of every dashboard report like:
    < 1 - 25 of 6300 > instead of < 1 - 25 >
    Any help is appreciated
    Regards
    B

    I have tried the following formula which identifies the lowest grain but it does not seem to give me correct result.. I am not getting the correct count. I am getting as 3.A work order can be updated only once at one point of time.hence the formula
    MAX(RCOUNT(CAST("SR Wo Fact"."Crm Wo Number" AS CHAR) ||CAST("SR Wo Fact"."PSC Timestamp" as char)))
    I tried only MAX(RCOUNT(1)), but I was able to get the record count as corect for Administrator but not for other users.
    Has anyone come across this scenario.
    Thanks Shravan
    Edited by: 786443 on Aug 19, 2010 10:22 AM

  • How can I get record count with a query?

    In Client/Server pplication,the client send a query to server.
    How can server get record count by oracle call interface?
    Is it need execute "select count(*) from ...."?

    Yes.
    Either that or increment a counter for each record fetched and
    loop round until you hit the last record.
    The first method would be more efficient on large datasets.

  • How to implement the record count on the page

    Dear,
    I have a basic search page, results region with a simple table.
    I need to show the total number of records returned by a search query.
    Suppose I create messageStyledText "counter" bean to show the result.
    The result will be calculated in the ProcessFormRequest, how would I set the value of the the "counter" bean then? I can not do that in PFR.
    Thank you
    Anatoliy

    In the PFR method of controller, get the row count of VO when user click on search button and then set its value in the counter bean.
    Here the dummy code.. check syntax error & other compile time error
    if(pageContext.getParameter("SearchBtn") != null)
    OAViewObject vo = (OAViewObject)am.findViewObject("SearchVO1")
    if (vo!= null)
    String fetchedRowCount = vo.getFetchedRowCount();
    OAMessageStyleTextBean msb = (OAMessageStyleTextBean)webBean.findChildRecursive("CounterBean");
    if(msb != null)
    msb.setvalue(pageContext, fetchedRowCount);
    }Thanks
    --Anil
    http://oracleanil.blogspot.com

  • How to return to record after updating (ie add a url with variable)

    I want to put a link in to return to the page displaying the record after updating.  I followed the Dreamweaver insrtuctio an added this after the page url in the update behaviours:
    ?recordID=<?php echo $row_recordsetName['fieldName']; ?>
    However the page does not load but gives this error:
    Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\UwAmp\www\testmypms\update_spec_rx.php on line 77
    Here's the page code:
    <?php require_once('Connections/testmypms.php'); ?>
    <?php
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
      $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "updateSpecRx")) {
      $updateSQL = sprintf("UPDATE spec_rx SET spec_rx_date=%s, FK_user_id=%s, spec_rx_rsph=%s, spec_rx_rcyl=%s, spec_rx_raxis=%s, spec_rx_rhprism=%s, spec_rx_rhprismbase=%s, spec_rx_rvprism=%s, spec_rx_rvprismbase=%s, spec_rx_rnadd=%s, spec_rx_rnhprism=%s, spec_rx_rnhprismbase=%s, spec_rx_rnvprism=%s, spec_rx_rnvprismbase=%s, spec_rx_rintadd=%s, spec_rx_rinthprism=%s, spec_rx_rinthprismbase=%s, spec_rx_rintvprism=%s, spec_rx_rintvprismbase=%s, spec_rx_lsph=%s, spec_rx_lcyl=%s, spec_rx_laxis=%s, spec_rx_lhprism=%s, spec_rx_lhprismbase=%s, spec_rx_lvprism=%s, spec_rx_lvprismbase=%s, spec_rx_lintadd=%s, spec_rx_linthprism=%s, spec_rx_linthprismbase=%s, spec_rx_lintvprism=%s, spec_rx_lintvprismbase=%s, spec_rx_lnadd=%s, spec_rx_lnhprism=%s, spec_rx_lnhprismbase=%s, spec_rx_lnvprism=%s, spec_rx_lnvprismbase=%s, ext_rx=%s WHERE spec_rx_id=%s",
                           GetSQLValueString($_POST['rHprism'], "date"),
                           GetSQLValueString($_POST['userID'], "int"),
                           GetSQLValueString($_POST['rsph'], "double"),
                           GetSQLValueString($_POST['rcyl'], "double"),
                           GetSQLValueString($_POST['raxis'], "double"),
                           GetSQLValueString($_POST['rHprism'], "double"),
                           GetSQLValueString($_POST['rHprismbase'], "text"),
                           GetSQLValueString($_POST['rVprism'], "double"),
                           GetSQLValueString($_POST['rVprismbase'], "text"),
                           GetSQLValueString($_POST['rNradd'], "double"),
                           GetSQLValueString($_POST['rNrHprism'], "double"),
                           GetSQLValueString($_POST['rNrHprismbase'], "text"),
                           GetSQLValueString($_POST['rNrVprism'], "double"),
                           GetSQLValueString($_POST['rNrVprismbase'], "text"),
                           GetSQLValueString($_POST['rIntadd'], "double"),
                           GetSQLValueString($_POST['rIntHprism'], "double"),
                           GetSQLValueString($_POST['rIntHprismbase'], "text"),
                           GetSQLValueString($_POST['rIntVprism'], "double"),
                           GetSQLValueString($_POST['rIntVprismbase'], "text"),
                           GetSQLValueString($_POST['lsph'], "double"),
                           GetSQLValueString($_POST['lcyl'], "double"),
                           GetSQLValueString($_POST['laxis'], "double"),
                           GetSQLValueString($_POST['lHprism'], "double"),
                           GetSQLValueString($_POST['lHprismbase'], "text"),
                           GetSQLValueString($_POST['lVprism'], "double"),
                           GetSQLValueString($_POST['lVprismbase'], "text"),
                           GetSQLValueString($_POST['lIntadd'], "double"),
                           GetSQLValueString($_POST['lIntHprism'], "double"),
                           GetSQLValueString($_POST['lIntHprismbase'], "text"),
                           GetSQLValueString($_POST['lIntVprism'], "double"),
                           GetSQLValueString($_POST['lIntVprismbase'], "text"),
                           GetSQLValueString($_POST['lNradd'], "double"),
                           GetSQLValueString($_POST['lNrHprism'], "double"),
                           GetSQLValueString($_POST['lNrHprismbase'], "text"),
                           GetSQLValueString($_POST['lNrVprism'], "double"),
                           GetSQLValueString($_POST['rNrVprismbase'], "text"),
                           GetSQLValueString(isset($_POST['extRx']) ? "true" : "", "defined","1","0"),
                           GetSQLValueString($_POST['SpecRxID'], "int"));
      mysql_select_db($database_testmypms, $testmypms);
      $Result1 = mysql_query($updateSQL, $testmypms) or die(mysql_error());
      $updateGoTo = "spec_rx4.php";
      if (isset($_SERVER['QUERY_STRING'])) {
        $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
        $updateGoTo .= $_SERVER['QUERY_STRING'];
      header(sprintf("Location: %s", $updateGoTo));
    /*   date_default_timezone_set('Europe/London');
    $date = strtotime($_POST['specRxDate']);
         $_POST['specRxDate'] = date("Y-m-d",$date); */
    $currentPage = $_SERVER["PHP_SELF"];
    $maxRows_spec_rx = 1;
    $pageNum_spec_rx = 0;
    if (isset($_GET['pageNum_spec_rx'])) {
      $pageNum_spec_rx = $_GET['pageNum_spec_rx'];
    $startRow_spec_rx = $pageNum_spec_rx * $maxRows_spec_rx;
    $colname_spec_rx = "1";
    if (isset($_GET['spec_RxID'])) {
      $colname_spec_rx = (get_magic_quotes_gpc()) ? $_GET['spec_RxID'] : addslashes($_GET['spec_RxID']);
    mysql_select_db($database_testmypms, $testmypms);
    $query_spec_rx = sprintf("SELECT demographics.px_id, demographics.FK_title_id, demographics.firstname, demographics.surname, title.title, title.title_id, spec_rx.spec_rx_id, spec_rx.FK_px_id, DATE_FORMAT(spec_rx.spec_rx_date, '%%d-%%m-%%Y') as formatted_rx_date, spec_rx.FK_user_id, spec_rx.spec_rx_rsph, spec_rx.spec_rx_rcyl, spec_rx.spec_rx_raxis, spec_rx.spec_rx_rhprism, spec_rx.spec_rx_rhprismbase, spec_rx.spec_rx_rvprism, spec_rx.spec_rx_rvprismbase, spec_rx.spec_rx_rnadd, spec_rx.spec_rx_rnhprism, spec_rx.spec_rx_rnhprismbase, spec_rx.spec_rx_rnvprism, spec_rx.spec_rx_rnvprismbase, spec_rx.spec_rx_rintadd, spec_rx.spec_rx_rinthprism, spec_rx.spec_rx_rinthprismbase, spec_rx.spec_rx_rintvprism, spec_rx.spec_rx_rintvprismbase, spec_rx.spec_rx_lsph, spec_rx.spec_rx_lcyl, spec_rx.spec_rx_laxis, spec_rx.spec_rx_lhprism, spec_rx.spec_rx_lhprismbase, spec_rx.spec_rx_lvprism, spec_rx.spec_rx_lvprismbase, spec_rx.spec_rx_lintadd, spec_rx.spec_rx_linthprism, spec_rx.spec_rx_linthprismbase, spec_rx.spec_rx_lintvprism, spec_rx.spec_rx_lintvprismbase, spec_rx.spec_rx_lnadd, spec_rx.spec_rx_lnhprism, spec_rx.spec_rx_lnhprismbase, spec_rx.spec_rx_lnvprism, spec_rx.spec_rx_lnvprismbase, spec_rx.ext_rx FROM spec_rx, demographics, title WHERE spec_rx.spec_rx_id = %s AND spec_rx.FK_px_id = demographics.px_id AND demographics.FK_title_id = title.title_id", $colname_spec_rx);
    $query_limit_spec_rx = sprintf("%s LIMIT %d, %d", $query_spec_rx, $startRow_spec_rx, $maxRows_spec_rx);
    $spec_rx = mysql_query($query_limit_spec_rx, $testmypms) or die(mysql_error());
    $row_spec_rx = mysql_fetch_assoc($spec_rx);
    if (isset($_GET['totalRows_spec_rx'])) {
      $totalRows_spec_rx = $_GET['totalRows_spec_rx'];
    } else {
      $all_spec_rx = mysql_query($query_spec_rx);
      $totalRows_spec_rx = mysql_num_rows($all_spec_rx);
    $totalPages_spec_rx = ceil($totalRows_spec_rx/$maxRows_spec_rx)-1;
    mysql_select_db($database_testmypms, $testmypms);
    $query_users = "SELECT users.user_id, users.username FROM users";
    $users = mysql_query($query_users, $testmypms) or die(mysql_error());
    $row_users = mysql_fetch_assoc($users);
    $totalRows_users = mysql_num_rows($users);
    $queryString_spec_rx = "";
    if (!empty($_SERVER['QUERY_STRING'])) {
      $params = explode("&", $_SERVER['QUERY_STRING']);
      $newParams = array();
      foreach ($params as $param) {
        if (stristr($param, "pageNum_spec_rx") == false &&
            stristr($param, "totalRows_spec_rx") == false) {
          array_push($newParams, $param);
      if (count($newParams) != 0) {
        $queryString_spec_rx = "&" . htmlentities(implode("&", $newParams));
    $queryString_spec_rx = sprintf("&totalRows_spec_rx=%d%s", $totalRows_spec_rx, $queryString_spec_rx);
    ?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Amend Spec Rx</title>
    </head>
    <body>
    <p>Amend Spec Rx</p>
    <p><?php echo $row_spec_rx['px_id']; ?></p>
    <p><?php echo $row_spec_rx['title']; ?><?php echo $row_spec_rx['firstname']; ?><?php echo $row_spec_rx['surname']; ?> </p>
    <form action="<?php echo $editFormAction; ?>" method="POST" name="updateSpecRx" id="updateSpecRx">
      <table border="1" cellpadding="5" cellspacing="1">
        <tr>
          <td> </td>
          <td>
         <td><?php date_default_timezone_set('Europe/London'); ?>
        <input name="specRxDate" type="text" id="specRxDate" value="<?php echo $row_spec_rx['formatted_rx_date']; ?>" size="10" maxlength="10" <?php echo 'value="'.date("d-m-Y").'"'; ?>></td>
          <td><input name="SpecRxID" type="text" id="SpecRxID" value="<?php echo $row_spec_rx['spec_rx_id']; ?>" size="2" maxlength="2"></td>
          <td> </td>
          <td> </td>
          <td> </td>
          <td> </td>
          <td> </td>
          <td> </td>
          <td> </td>
          <td> </td>
          <td> </td>
          <td> </td>
          <td> </td>
          <td> </td>
          <td> </td>
          <td> </td>
          <td> </td>
        </tr>
        <tr>
          <td> </td>
          <td>Sph</td>
          <td>Cyl</td>
          <td>Axis</td>
          <td>HPrism</td>
          <td>HPrismBase</td>
          <td>VPrism</td>
          <td>VPrismBase</td>
          <td>NrAdd</td>
          <td>NrHPrism </td>
          <td>NrHPrismBase</td>
          <td>NrVPrism</td>
          <td>NrVPrismBase</td>
          <td>IntAdd</td>
          <td>IntHPrism</td>
          <td>IntHPrismBase</td>
          <td>IntVPrism</td>
          <td>IntVPrismBase</td>
        </tr>
        <tr>
          <td>R</td>
          <td><input name="rsph" type="text" id="rsph" value="<?php echo $row_spec_rx['spec_rx_rsph']; ?>" size="6" maxlength="6">
          </td>
          <td><input name="rcyl" type="text" id="rcyl" value="<?php echo $row_spec_rx['spec_rx_rcyl']; ?>" size="6" maxlength="6">
          </td>
          <td><input name="raxis" type="text" id="raxis" value="<?php echo $row_spec_rx['spec_rx_raxis']; ?>" size="5" maxlength="5"></td>
          <td><input name="rHprism" type="text" id="rHprism" value="<?php echo $row_spec_rx['spec_rx_rhprism']; ?>" size="5" maxlength="5"></td>
          <td>        <select name="rHprismbase" id="rHprismbase">
            <option value="" <?php if (!(strcmp("", $row_spec_rx['spec_rx_rhprismbase']))) {echo "SELECTED";} ?>> </option>
            <option value="OUT" <?php if (!(strcmp("OUT", $row_spec_rx['spec_rx_rhprismbase']))) {echo "SELECTED";} ?>>OUT</option>
            <option value="IN" <?php if (!(strcmp("IN", $row_spec_rx['spec_rx_rhprismbase']))) {echo "SELECTED";} ?>>IN</option>
            </select></td>
          <td><input name="rVprism" type="text" id="rVprism" value="<?php echo $row_spec_rx['spec_rx_rvprism']; ?>" size="5" maxlength="5">
          </td>
          <td><select name="rVprismbase" id="rVprismbase">
            <option value="" <?php if (!(strcmp("", $row_spec_rx['spec_rx_rnvprismbase']))) {echo "SELECTED";} ?>> </option>
            <option value="UP" <?php if (!(strcmp("UP", $row_spec_rx['spec_rx_rnvprismbase']))) {echo "SELECTED";} ?>>UP</option>
            <option value="DN" <?php if (!(strcmp("DN", $row_spec_rx['spec_rx_rnvprismbase']))) {echo "SELECTED";} ?>>DN</option>
          </select></td>
          <td><input name="rNradd" type="text" id="rNradd" value="<?php echo $row_spec_rx['spec_rx_rnadd']; ?>" size="6" maxlength="6"></td>
          <td><input name="rNrHprism" type="text" id="rNrHprism" value="<?php echo $row_spec_rx['spec_rx_rnhprism']; ?>" size="5" maxlength="5"></td>
          <td><select name="rNrHprismbase" id="rNrHprismbase">
            <option value="" <?php if (!(strcmp("", $row_spec_rx['spec_rx_rnhprismbase']))) {echo "SELECTED";} ?>> </option>
            <option value="OUT" <?php if (!(strcmp("OUT", $row_spec_rx['spec_rx_rnhprismbase']))) {echo "SELECTED";} ?>>OUT</option>
            <option value="IN" <?php if (!(strcmp("IN", $row_spec_rx['spec_rx_rnhprismbase']))) {echo "SELECTED";} ?>>IN</option>
          </select></td>
          <td><input name="rNrVprism" type="text" id="rNrVprism" value="<?php echo $row_spec_rx['spec_rx_rnvprism']; ?>" size="5" maxlength="5"></td>
          <td><select name="rNrVprismbase" id="rNrVprismbase">
            <option value="" <?php if (!(strcmp("", $row_spec_rx['spec_rx_rnvprismbase']))) {echo "SELECTED";} ?>> </option>
            <option value="UP" <?php if (!(strcmp("UP", $row_spec_rx['spec_rx_rnvprismbase']))) {echo "SELECTED";} ?>>UP</option>
            <option value="DN" <?php if (!(strcmp("DN", $row_spec_rx['spec_rx_rnvprismbase']))) {echo "SELECTED";} ?>>DN</option>
          </select></td>
          <td><input name="rIntadd" type="text" id="rIntadd" value="<?php echo $row_spec_rx['spec_rx_rintadd']; ?>" size="6" maxlength="6"></td>
          <td><input name="rIntHprism" type="text" id="rIntHprism" value="<?php echo $row_spec_rx['spec_rx_rinthprism']; ?>" size="5" maxlength="5"></td>
          <td><select name="rIntHprismbase" id="rIntHprismbase">
            <option value="" <?php if (!(strcmp("", $row_spec_rx['spec_rx_rinthprismbase']))) {echo "SELECTED";} ?>> </option>
            <option value="OUT" <?php if (!(strcmp("OUT", $row_spec_rx['spec_rx_rinthprismbase']))) {echo "SELECTED";} ?>>OUT</option>
            <option value="IN" <?php if (!(strcmp("IN", $row_spec_rx['spec_rx_rinthprismbase']))) {echo "SELECTED";} ?>>IN</option>
          </select></td>
          <td><input name="rIntVprism" type="text" id="rIntVprism" value="<?php echo $row_spec_rx['spec_rx_rintvprism']; ?>" size="5" maxlength="5"></td>
          <td><select name="rIntVprismbase" id="rIntVprismbase">
            <option value="" <?php if (!(strcmp("", $row_spec_rx['spec_rx_rintvprismbase']))) {echo "SELECTED";} ?>> </option>
            <option value="UP" <?php if (!(strcmp("UP", $row_spec_rx['spec_rx_rintvprismbase']))) {echo "SELECTED";} ?>>UP</option>
            <option value="DN" <?php if (!(strcmp("DN", $row_spec_rx['spec_rx_rintvprismbase']))) {echo "SELECTED";} ?>>DN</option>
          </select></td>
        </tr>
        <tr>
          <td>L</td>
          <td><input name="lsph" type="text" id="lsph" value="<?php echo $row_spec_rx['spec_rx_lsph']; ?>" size="6" maxlength="6">
          </td>
          <td><input name="lcyl" type="text" id="lcyl" value="<?php echo $row_spec_rx['spec_rx_lcyl']; ?>" size="6" maxlength="6">
          </td>
          <td><input name="laxis" type="text" id="laxis" value="<?php echo $row_spec_rx['spec_rx_laxis']; ?>" size="5" maxlength="5"></td>
          <td><input name="lHprism" type="text" id="lHprism" value="<?php echo $row_spec_rx['spec_rx_lhprism']; ?>" size="5" maxlength="5"></td>
          <td><select name="lHprismbase" id="lHprismbase">
            <option value="" <?php if (!(strcmp("", $row_spec_rx['spec_rx_lhprismbase']))) {echo "SELECTED";} ?>> </option>
            <option value="OUT" <?php if (!(strcmp("OUT", $row_spec_rx['spec_rx_lhprismbase']))) {echo "SELECTED";} ?>>OUT</option>
            <option value="IN" <?php if (!(strcmp("IN", $row_spec_rx['spec_rx_lhprismbase']))) {echo "SELECTED";} ?>>IN</option>
          </select></td>
          <td><input name="lVprism" type="text" id="lVprism" value="<?php echo $row_spec_rx['spec_rx_lvprism']; ?>" size="5" maxlength="5">
          </td>
          <td><select name="lVprismbase" id="lVprismbase">
            <option value="" <?php if (!(strcmp("", $row_spec_rx['spec_rx_rvprismbase']))) {echo "SELECTED";} ?>> </option>
            <option value="UP" <?php if (!(strcmp("UP", $row_spec_rx['spec_rx_rvprismbase']))) {echo "SELECTED";} ?>>UP</option>
            <option value="DN" <?php if (!(strcmp("DN", $row_spec_rx['spec_rx_rvprismbase']))) {echo "SELECTED";} ?>>DN</option>
          </select></td>
          <td><input name="lNradd" type="text" id="lNradd" value="<?php echo $row_spec_rx['spec_rx_lnadd']; ?>" size="6" maxlength="6"></td>
          <td><input name="lNrHprism" type="text" id="lNrHprism" value="<?php echo $row_spec_rx['spec_rx_lnhprism']; ?>" size="5" maxlength="5"></td>
          <td><select name="lNrHprismbase" id="lNrHprismbase">
            <option value="" <?php if (!(strcmp("", $row_spec_rx['spec_rx_lnhprismbase']))) {echo "SELECTED";} ?>> </option>
            <option value="OUT" <?php if (!(strcmp("OUT", $row_spec_rx['spec_rx_lnhprismbase']))) {echo "SELECTED";} ?>>OUT</option>
            <option value="IN" <?php if (!(strcmp("IN", $row_spec_rx['spec_rx_lnhprismbase']))) {echo "SELECTED";} ?>>IN</option>
          </select></td>
          <td><input name="lNrVprism" type="text" id="lNrVprism" value="<?php echo $row_spec_rx['spec_rx_lnvprism']; ?>" size="5" maxlength="5"></td>
          <td><select name="rNrVprismbase" id="rNrVprismbase">
            <option value="" <?php if (!(strcmp("", $row_spec_rx['spec_rx_lnvprismbase']))) {echo "SELECTED";} ?>> </option>
            <option value="UP" <?php if (!(strcmp("UP", $row_spec_rx['spec_rx_lnvprismbase']))) {echo "SELECTED";} ?>>UP</option>
            <option value="DN" <?php if (!(strcmp("DN", $row_spec_rx['spec_rx_lnvprismbase']))) {echo "SELECTED";} ?>>DN</option>
          </select></td>
          <td><input name="lIntadd" type="text" id="lIntadd" value="<?php echo $row_spec_rx['spec_rx_lintadd']; ?>" size="6" maxlength="6"></td>
          <td><input name="lIntHprism" type="text" id="lIntHprism" value="<?php echo $row_spec_rx['spec_rx_linthprism']; ?>" size="5" maxlength="5"></td>
          <td><select name="lIntHprismbase" id="lIntHprismbase">
            <option value=""> </option>
            <option value="OUT">OUT</option>
            <option value="IN">IN</option>
          </select></td>
          <td><input name="lIntVprism" type="text" id="lIntVprism" value="<?php echo $row_spec_rx['spec_rx_lintvprism']; ?>" size="5" maxlength="5"></td>
          <td><select name="lIntVprismbase" id="lIntVprismbase">
            <option value="" <?php if (!(strcmp("", $row_spec_rx['spec_rx_lintvprismbase']))) {echo "SELECTED";} ?>> </option>
            <option value="UP" <?php if (!(strcmp("UP", $row_spec_rx['spec_rx_lintvprismbase']))) {echo "SELECTED";} ?>>UP</option>
            <option value="DN" <?php if (!(strcmp("DN", $row_spec_rx['spec_rx_lintvprismbase']))) {echo "SELECTED";} ?>>DN</option>
          </select></td>
        </tr>
        <tr>
          <td> </td>
          <td><input name="pxID" type="text" id="pxID" value="<?php echo $row_spec_rx['px_id']; ?>" size="3" maxlength="3"></td>
          <td colspan="4"><input name="Update" type="submit" id="Update" value="Update"></td>
          <td><select name="userID" id="userID">
            <?php
    do { 
    ?>
            <option value="<?php echo $row_users['user_id']?>"><?php echo $row_users['username']?></option>
            <?php
    } while ($row_users = mysql_fetch_assoc($users));
      $rows = mysql_num_rows($users);
      if($rows > 0) {
          mysql_data_seek($users, 0);
          $row_users = mysql_fetch_assoc($users);
    ?>
          </select></td>
          <td>External
          <input <?php if (!(strcmp($row_spec_rx['ext_rx'],1))) {echo "checked";} ?> name="extRx" type="checkbox" id="extRx" value="checkbox"></td>
          <td> </td>
          <td> </td>
          <td> </td>
          <td> </td>
          <td> </td>
          <td> </td>
          <td> </td>
          <td> </td>
          <td> </td>
          <td> </td>
        </tr>
      </table>
        <input type="hidden" name="MM_update" value="updateSpecRx">
    </form>
    <p> </p>
    </body>
    </html>
    <?php
    mysql_free_result($spec_rx);
    mysql_free_result($users);
    ?>
    Thanks for any help

    This post solves it:
    How do I pass URL parameter after Update record?

  • How to get the record count before fetch

    CREATE PACKAGE demo_cur_pkg AS
    TYPE EmpName IS RECORD (name VARCHAR2(10));
    TYPE cur_type IS REF CURSOR RETURN EmpName;
    PROCEDURE open_emp_cur (
    curs IN OUT cur_type,
    dept_num IN NUMBER);
    END;
    CREATE PACKAGE BODY demo_cur_pkg AS
    CREATE PROCEDURE open_emp_cur (
    curs IN OUT cur_type,
    dept_num IN NUMBER) IS
    BEGIN
    OPEN curs FOR
    SELECT ename FROM emp
    WHERE deptno = dept_num
    ORDER BY ename ASC;
    END;
    END;
    After this package has been stored, you can open the cursor curs by calling the open_emp_cur stored procedure from your Pro*C/C++ program, and FETCH from the cursor in the program. For example:
    sql_cursor emp_cursor;
    char emp_name[11];
    EXEC SQL ALLOCATE :emp_cursor; /* allocate the cursor variable */
    /* Open the cursor on the server side. */
    EXEC SQL EXECUTE
    begin
    demo_cur_pkg.open_emp_cur(:emp_cursor, :dept_num);
    end;
    EXEC SQL WHENEVER NOT FOUND DO break;
    for (;;)
    EXEC SQL FETCH :emp_cursor INTO :emp_name;
    printf("%s\n", emp_name);
    Any solutioon is welcome

    Fail to understand why you want to introduce exception processing - e.g. use methodA for less than 10,000 rows and use methodB for 10,000 and more.
    Why not use methodC - optimal support for fetching, irrespective of whether there are 1 row to fetch, or a 100,000 rows?
    There is no best way for fetching a small number of rows versus a different best way for fetching more rows. There is a single optimal method - and this remains the same irrespective of the number of rows being returned.

  • How to display a record count in a text field?

    I am trying to return a record count of a query and place that count in a text field on my search page in APEX. I have that text field defined under Items on the search page. How do I get a query record count to display in my text field?
    Thanks,
    John
    Edited by: user7381760 on Jan 22, 2009 3:47 PM

    Hi Dan,
    Thank you for your reply and yes I was able to select "Source Type" and "SQL Query". The SQL expression I used was:
    SELECT COUNT(ID) FROM master_table;
    This worked great to count the total number of records from the master_table. However what I am trying to do is to get a record count each time I complete a search from my search page. I have input fields on this page and a GO button which executes the query. The SQL query is location in one place under Regions/Display Point. My display field on my search page is named P16_COUNT2 and I was trying to make this work inside the main query code. I tryed something like this, COUNT(ID) INTO :P16_COUNT2, to pass the record count each time I execute the GO botton to P16_COUNT2 field. This I could not get to work. Any ideas how to proceed?
    Regards,
    John

  • Getting a record count in a query using UNIQUE

    I need to know how to grab a record count for a query so I can pass it back into the recordset.
    This select query uses UNIQUE to rollup the 555 records to 125 unique rows.
    But how would I do a record count.
    Do I pass the query to a cursor and then count the records in the cursor?
    Please detail your help please.
    Thank you in advance.

    SELECT unique
         CE.DATE_OF_SERVICE AS DOS_FROM
         ,CE.SERVICE_END_DATE AS DOS_TO
         ,CE.EVENT_SERVICE AS SERVICE_TYPE
         ,CN.CREATE_DATE_TIME
         ,CN.CASE_NOTE_ID
         ,CN.CASE_ID
         ,CN.EVENT_ID
         ,CN.REASON
         ,CN.CREATOR_USER_ID AS CREATOR_ID_USED
         ,CN.ROWID AS ROW_ID
         ,(SELECT Retrieve_Note2(CN.CASE_ID,CN.CASE_NOTE_ID) from DUAL) AS NOTE
    FROM
         MEMBER_TO_PATIENT MTA,
         CARE_EVENT CE,
         CASE_NOTES CN
    WHERE
         MTA.SUBSCRIBER_LID = '1260016473015' AND
         MTA.CASE_ID = CN.CASE_ID AND
         CN.EVENT_ID = CE.EVENT_ID
    ORDER BY
         CN.CASE_NOTE_ID DESC

  • What event should I use to grab the record count of a DataGrid?

    I have a "Go" button on a search form.  It works correctly, fetching records from a CF data service into a data bound DataGrid.  However, using the code shown below, the record count always shows zero.  I've tried putting the "..Provider.length" line shown below, into various events on the grid, so that it will always update the count at the correct time, but I get "null" object errors at run time. There seems to be no event that fires "AfterDataLoad".
                protected function btnGo_clickHandler(event:MouseEvent):void
                     getSBJsResult.token = baa_data_svc.getSBJs(cmbSrch.text);
                     tabSbjs.label = 'Subjects: ' + grdSBJs.dataProvider.length;    //  This always returns zero.  Why?

    For example, this doesn't work.  The grid is told to loaded data on line 1, but this must just be only a message send to the Flash Player 10, because the processing doesn't stop and wait for the loading of data to complete, it just continues on to line 2, at which point '...Provider.length' is always zero the first time through.   So... the NEXT time the user clicks the Go button, line 2 is processed for the DataGrid which is holding data from the PREVIOUS search, so it updates the tabSbjs.label with the count from the previous search, not the current search.  The count of records is always for the previous data set.
                protected function btnGo_clickHandler(event:MouseEvent):void
    1               getSBJsResult.token = baa_data_svc.getSBJs(cmbSrch.text);  // edtSrch.text
    2               tabSbjs.label = 'Subjects: ' + grdSBJs.dataProvider.length;                                                                            
    All I'm trying to do is (which seems like a very difficult thing to do in FB4):
    -Display a DataGrid popluated with data records
    -Display a count of how many records are in the data grid
    If I rely on CF9 functions, which can only return a single value, then I have to make two CF9  functions, with the exact same SQL, one that returns data, and one that returns a count of the records.... which is non-sensicle.
    There must be a simple way to do this, but I'm going around in circles.

  • Get the record count

    The Query below is part of a huge query. The snipet is just the part that I need to make a change.
    For the query below, how can I get the recordcount in the select inside the case statement? I want to only output the r_text when the record count of the select is zero (0) else make the output to r_text null
    select
    distinct a.style_id, b.sty, b.season, a.cust, a.ad_d, b.code,
    (case when b.code = 'MAKE' then
    (select min(t.value) from sn.age r, sn.text t
    where r.t_id = '18' and r.name = 'MTGNSL'
         and r.t_id = t.t_id
         and r.name = t.name and r.text_id = t.text_id
         and r.id_1 = a.id
    ) end) r_text,
    (case when b.code is null then 'Blank Code'
    when b.code = 'MAKE' then 'MAKE' end) err
         

    If you are not using a scrollable result set then the following is the best way to do it.
    there are several key words in SQL that can be used, the one you are interested in is count();
    so if your query at the moment is
    "select col1, col2, col3 from my_table where col2=? and col3=?"you can work out how many rows will be returned by executing this command first
    "select count(col1) from my_table where col2=? and col3=?"this will return a result set with one row and one column, you can get the row count as follows:
    ResultSet rs = ps.executeQuery();
    int rowCount = rs.getInt(1);I hope this helps :)

  • How to return the correct row of data using diffferent conditions?

    I am having some problems with an sql query and I hope someone can help please?
    The data I am using is customers with multiple transactions. If a customer contains one transaction where the transaction type = 'W' then I need to set the output value to be transaction.ValueA. If the customer does not contain any transactions where the transaction type is 'W' then I need to set the output value to be
    the most recent transaction.ValueB where transaction.transaction_date <= customer.cust_mod_date.
    Here is an example of the data. For each test customer 10 and 20 I have put a star against the value I want to return
    CUSTOMER_ID CUST_MOD_DATE TX_DATE      TX_TYPE TX_VALUEA TX_VALUEB
    10          15/07/2009 16/07/2009     A     110      95
    10          15/07/2009 14/07/2009     A     100      90(*)          
    10          15/07/2009 13/07/2009     A     90          10
    10          15/07/2009 12/07/2009     A     80          5
    20          15/07/2009 15/07/2009     A     60          10
    20          15/07/2009 14/07/2009     W     50(*)     20
    20          15/07/2009 13/07/2009     A     40          30
    ie
    CREATE TABLE
    TMP_CUSTOMER (CUSTOMER_ID NUMBER, CUST_MOD_DATE DATE);
    insert into tmp_customer
    values(10, to_date('15/07/2009','dd/mm/yyyy'));
    insert into tmp_customer
    values(20, to_date('15/07/2009','dd/mm/yyyy'));
    CREATE TABLE
    TMP_TRANSACTION (TX_ID NUMBER, CUSTOMER_ID NUMBER, TX_DATE DATE, TX_TYPE VARCHAR2(1), TX_VALUEA NUMBER, TX_VALUEB NUMBER);
    INSERT INTO TMP_TRANSACTION
    VALUES (1,10, to_date('16/07/2009','dd/mm/yyyy'),'A',110,95);
    INSERT INTO TMP_TRANSACTION
    VALUES (2,10, to_date('14/07/2009','dd/mm/yyyy'),'A',100,90);
    INSERT INTO TMP_TRANSACTION
    VALUES (3,10, to_date('13/07/2009','dd/mm/yyyy'),'A',90,10);
    INSERT INTO TMP_TRANSACTION
    VALUES (4,10, to_date('12/07/2009','dd/mm/yyyy'),'A',80,5);
    INSERT INTO TMP_TRANSACTION
    VALUES (5,20, to_date('15/07/2009','dd/mm/yyyy'),'A',60,10);
    INSERT INTO TMP_TRANSACTION
    VALUES (6,20, to_date('14/07/2009','dd/mm/yyyy'),'W',50,20);
    INSERT INTO TMP_TRANSACTION
    VALUES (7,20, to_date('13/07/2009','dd/mm/yyyy'),'A',40,30);
    The query I have so far is
    (SELECT CUSTOMER_ID, CUST_MOD_DATE, TX_DATE, TYPE_FLAG, TX_VALUEA, TX_VALUEB, RN
    FROM (SELECT CUST.CUSTOMER_ID, CUST.CUST_MOD_DATE,TRANS.TX_DATE, TRANS.TYPE_FLAG, TRANS.TX_VALUEA,TRANS.TX_VALUEB,
    ROW_NUMBER() OVER (partition BY TRANS.CUSTOMER_ID ORDER BY TRANS.TX_DATE DESC) RN
    FROM TMP_CUSTOMER CUST,
    --- Return all transactions creating a type_flag field where Y = type W, else N ---
    SELECT CUST.CUSTOMER_ID, TX.TX_DATE, TX.TX_VALUEA, TX.TX_VALUEB, CUST.CUST_MOD_DATE, TX.TX_TYPE,
    CASE WHEN NVL(TX.TX_TYPE,'0') <> 'W' THEN 'N'
    WHEN NVL(TX.TX_TYPE,'0') = 'W' THEN 'Y'
    ELSE 'N'
    END AS TYPE_FLAG
    FROM TMP_TRANSACTION TX, TMP_CUSTOMER CUST
    WHERE TX.CUSTOMER_ID = CUST.CUSTOMER_ID
    AND CUST.CUSTOMER_ID in
    '10','20'
    ) TRANS
    WHERE CUST.CUSTOMER_ID = TRANS.CUSTOMER_ID
    --AND   TRANS.TX_DATE <= CUST.CUST_MOD_DATE
    AND CUST.CUSTOMER_ID in
    ('10','20'
    Can anyone please help with how I extract the record I am looking for
    ie customer 10 has amount 90
    customer 20 has amount 50.
    Thanks :-)
    GB

    SQL> select c_id
      2  ,      cust_mod_date
      3  ,      tx_date
      4  ,      tx_type
      5  ,      tx_valuea
      6  ,      tx_valueb
      7  from ( select c.customer_id c_id
      8         ,      c.cust_mod_date
      9         ,      t.tx_date
    10         ,      t.tx_type
    11         ,      t.tx_valuea
    12         ,      t.tx_valueb
    13         ,      row_number() over (partition by c.customer_id order by t.customer_id, t.tx_date desc) rn
    14         from   tmp_customer c
    15         ,      tmp_transaction t
    16         where  t.customer_id = c.customer_id     
    17         and    t.tx_date <= c.cust_mod_date
    18       )
    19  where case
    20          when tx_type = 'W' then 1
    21          when rn = 1
    22          and  not exists ( select null
    23                            from   tmp_transaction t2
    24                            where  t2.customer_id = c_id
    25                            and    t2.tx_type = 'W'
    26                          )
    27          then 1
    28        end = 1;
          C_ID CUST_MOD_ TX_DATE   T  TX_VALUEA  TX_VALUEB
            10 15-JUL-09 14-JUL-09 A        100         90
            20 15-JUL-09 14-JUL-09 W         50         20
    2 rows selected.

  • How to return the name (or ID) of the Task FLow in Script

    Sitaution; two task flows created which can be accessed via Tools > TaskFlows within FDQM
    Task Flow "1.1 Multi Load - Import" --> Should run Batch Process Up to Import (enmBatchProcessLevel: 2)
    Task Flow "2.1 Multi Load - Import Up To Validate" --> Should run Batch Process Up to Validate (enmBatchProcessLevel: 4)
    I have developed one generic script which I would like to use for each task flow.
    Only the enmBatchProcessLevel differs between the task flows and therefore I would like to parse this enmBatchProcessLevel as a parameter my generic script.
    To be able to do this, the script needs to know on which task flow a user has clicked. So, I am looking for a function or statement which returns the name (or ID) of the task flow. Based on this name (or ID) a conditional statement can be performed in which a variable is dynamically filled. This variable can then be parsed as a parameter to my generic script.
    For instance:
    Sub GenericRoutine
         Dim strTaskFlow
         Dim intBatchProcessLevel
         '--Get the Task Flow Name
         strTaskFlow = ......<How to return the TaskFlow name or ID?>
         '--Validate the task flow and fill variable intBatchProcessLevel dynamically
         Select Case strTaskFlow
              Case "1.1 Multi Load - Import"
                   intBatchProcessLevel = 2
              Case "2.1 Multi Load - Import Up To Validate"
                   intBatchProcessLevel = 4
         End Select
         '--Execute generic script
         '--Call Batch script and parse intBatchProcessLevel as a parameter:
         Call sBatchProcess(intBatchProcessLevel)
         '--Execute generic script
    End Sub
    Sub sBatchProcess(Byval intBatchProcessLevel)
         Dim lngProcessLevel
         Dim strDelimiter
         Dim blnAutoMapCorrect
         '--Use intBatchProcessLevel to fill lngProcessLevel
         lngProcessLevel = intBatchProcessLevel
         strDelimiter = "_"
         blnAutoMapCorrect = 0
         Set BATCHENG.PcolFiles = BATCHENG.fFileCollectionCreate(CStr(strDelimiter))
         BATCHENG.mFileCollectionProcess BATCHENG.PcolFiles, CLng(lngProcessLevel), , CBool(blnAutoMapCorrect)
    End Sub
    Edited by: user13642656 on Jul 21, 2011 4:55 AM

    Hi, thanks for your reply.
    The Generic script contains 600+ records, which I would like to maintain once, when having multiple Task Flows for Import, UpToValidate, ValidateOnly, UpToExport, ExportOnly etc.
    Is there a central storage in FDQM workbench for script, like a "Module" in Excel VisualBasic environment? Thanks!

  • Getting the record count from result set

    i'm retreiving the result set using the executeQuery method, now i want to know how many records are there in the result set, that is the record count of the result set.
    one solution to that is to first use the executeUpdate and then use the executeQuery but i think that is not the right way.
    so please tell me is there any method in jdbc to get that thing done
    Tanx

    Hi
    Do you know if your DB supports "insensitive scrolling"?
    SQL generally do, but some don't - I had the same problem with the
    open source version of Interbase from Phoenix...
    Anyway - try creating your statement this way:
    public Statement createStatement(int resultSetType, int resultSetConcurrency)
    throws SQLException
    ...where resultset type should be:
    ResultSet.TYPE_SCROLL_INSENSITIVE
    Then you can do this:
    ResultSet rs = stm.executeQuery(q);
    int size = rs.last(); //this what you looking for?
    rs.beforeFirst();
    while(rs.next()){
    }

Maybe you are looking for

  • Changes in 10.6.3?

    Hello. I'm using Applescript to make some items run at startup: tell application "System Events" make new login item at end of login items with properties {path"path to my file", hidden:false} end tell which works perfectly on 10.5.x. On 10.6.x is dr

  • How to measure two frequency simultaniously in a PCI 6014

    Hi I am measuring RPM of two gear drives by measuring the pulse/second(Measure frequency.vi). I have interlinked the gate of counter1 to the output of counter2. Similarly I have connected the gate of counter2 to output of counter1. to measure frequen

  • How to install Dual OS(solaris 10 and Windows XP)?

    I have got a 80 gb sata hard disk and i am not able to install Dual OS(solaris and Windows XP ) on it.My Partitions are as follows: Primary partition-5GB Remaining are extended Partition. Extended partition details 8 gb NTFS partition(installed windo

  • How to correct fields in a fillable form?

    I have created a form that has approximately 70 check boxes.  The fillable form is showing them as text boxes.  Is there an easy way to convert them to check boxes without having to create new fields for each entry?

  • SuperDrive on Mac Mini

    I can't use my SuperDrive on my new Mac Mini (2010/2/22). I never tried it before but today ... When I load a CD or DVD (both new or written), I hear the drive but it can't open the CD or DVD and reject it !!! Thank you for answer ...