How to-query to recordset

HI, I'm having a hard time building a locations of service form for users to insert, update the cities, counties, zip codes based on the states selected.
so I found this  query that works great if I use basic  menus and text boxes, but can't use to make comma separated menus because it is nat a record set.
The problem is that I have a table called zip_codes, with the following fields: state_label, Zip_b, county, city.
zip codes correspond to the cities, counties and states.
example:
Colorado,  Colorado Springs, El Paso,  80918
Users make a selection of state or states and the recordset is filtered by user selection.
I manage the part of making a select mutiple drop menu that passes the values to my query page like this.
Choose State(s)
hold Control key to select multiple states
And the query I need to convert into a recordset looks like this
Any way that was my attempt to converting the query into a recordset.
any help, or samples will be appreciated.

JBWebWorks wrote:
> Using PHP want to know how to write the ORDER BY sql
query
> run time value coming from list/menu form field
('sort_menu') and the list
> values are columns from the database
Unfortunately, you can't use the Dreamweaver Recordset dialog
box to set
a table column as a variable. You need to adapt the code by
hand, and
once you do so, the recordset might no longer be recognized
by
Dreamweaver. So, you need to lay out the page first, in case
the
Bindings panel no longer displays the fields from your
recordset.
Start by creating the Recordset without the ORDER BY clause,
and lay out
your page as you want it. When everything is done, add the
following
code at the top of the page:
<?php
// create an array of column names that can be used for the
sort order
$permitted = array('price', 'area');
// check whether the sort_menu variable contains a valid
column name
if (isset($_GET['sort_menu']) &&
in_array($_GET['sort_menu'], $permitted)) {
$sort = $_GET['sort_menu'];
} else {
// set a default column for sorting
$sort = 'price';
?>
This assumes that the columns for sorting are called price
and area.
Change these values to suit your setup.
Now you can add ORDER BY $sort to the SQL in the recordset.
David Powers
Adobe Community Expert, Dreamweaver
http://foundationphp.com

Similar Messages

  • Drop Down Menu selection query for recordset.

    I am looking to utilize a dynamic drop down menu to query a recordset...I am using Colfusion to import an MS Access database that contains the following fields: "Model Date", "Name", "Points" and "Target".  Each time the database updates, the "Model Date" field contains the date and time the model was run.  I have figured out how to create a dynamic drop down using SELECT DISTINCT "model date" and have also figured out how to create the dynamic recordset to be displayed showing the "Name", "Points" and "Target" data. 
    I want the user to select the "Model Date" from the drop down, hit a submit button and then have the appropriate "Name", "Points" and "Target" data queried and shown below.
    The query should take the selection from the "model date" dropdown and then query the "name", "points" and "target" fields for that particular "model date"
    I admit my knowledge of SQL and Coldfusion is not the best, but it seems like this is a somewhat simple task and I am just missing one or two pieces of the cog to put it all together.
    The database basically looks like this:
    Model Date...........Name..........Points........Target
    8/1/2010 08:00......John Doe.....1,250.........5.55%
    8/1/2010 08:00......Jane Doe.....850............2.35%
    8/1/2010 08:00......Bill Smith....11,832........-123.23%
    8/2/2010 09:02......John Doe.....1,323.........6.67%
    8/2/2010 09:02......Jane Doe.....1,001.........3.21%
    8/2/2010 09:02......Bill Smith....10,235........-110.26%
    The dropdown will only show the "model dates"
    8/1/2010 08:00
    8/2/2010 09:02
    For example, if 8/1/2010 08:00 was selected from the dropdown, I want the following displayed:
    Name..................Points...................Target
    John Doe.............1,250....................5.55%
    Jane Doe.............850.......................2.35%
    Bill Smith............11,832...................-123.23%
    Any help or suggestions would be greatly appreciated!!!
    Thanks,
    Mike

    My second paragraph talks about just displaying the filtered data, so I'm assuming that's what you're looking for, but still not quite sure based on what the other responses are. 
    But I head on anyway -
    On your first page, make note of the instance name of your drop down menu, such as "ModelDate".  Make sure it's in a Form and set the form action to the page where you want to display your data, set the form action to POST.
    On the results page, create a table with cells for each of the data elements you want to display. Create a recordset which you can do in Simple mode. Leave it at select all, and set the filter drop down to the database field which contains your Model Date. In the box to the right, select "=". the next dropdown selct "Form Variable" and the variable name type in the instance name of the drop down on the first page. 
    I may not have the terminology right, doing it from memory.
    From the data bindings tab, expand your recordset and locate each of the database fields you want to display.  Drag each one to the table cell on the page where you want it displayed.  The table cells have to be in a linear row.
    Now, select the table row buy selecting the TR tag in the tags just above the properties panel.  In the server behaviors tab, select repeat region and "All Records"
    Publish your pages and test!

  • How can I pass Recordsets as input parameter to a Function ?

    Hi Gurus,
    I want to create a function that receive recordsets as input parameter also returns recordsets as output.
    I have a requirement to do stock taking for all order items of one Order number in one single query execution (to avoid row by row basis).
    From the post in the forum I know that a function can return recordsets / query result using REF CURSOR or pipelined table function.
    My question is : how to pass the recordsets as input parameter to that function ?
    (because I could have 75 rows item in one order number)
    Below is the DDL and the query :
    create table stocks (Product char(4), Warehouse char(5), expireddate date, qty_available number)
    insert into stocks values('P001', 'WH001', '01-dec-2006', 30)
    insert into stocks values('P001', 'WH002', '01-dec-2006', 50)
    insert into stocks values('P001', 'WH002', '01-jan-2007', 50 )
    insert into stocks values('P001', 'WH001', '01-Mar-2007', 150)
    insert into stocks values('P002', 'WH003', '01-dec-2006', 25)
    insert into stocks values('P002', 'WH003', '15-Jan-2007', 50)
    insert into stocks values('P002', 'WH003', '01-Mar-2007', 75)
    insert into stocks values('P003', 'WH001', '01-dec-2006', 30)
    insert into stocks values('P003', 'WH002', '15-Jan-2007', 40)
    insert into stocks values('P003', 'WH003', '01-Mar-2007', 50)
    CREATE TABLE Order_Detail (PRODUCT_ORD CHAR(4), QTY_ORD number, Priority_WH CHAR(5) )
    INSERT INTO Order_Detail VALUES ('P001', 75, 'WH003') // previously 'WH002'
    INSERT INTO Order_Detail VALUES ('P002', 45, 'WH002')
    INSERT INTO Order_Detail VALUES ('P003', 55, NULL)
    The query for stock taking :
    select product,warehouse,expireddate, least(qty_available-(sm - qty_ord),qty_available) qty
    from ( select product,warehouse,expireddate,qty_available,qty_ord, sum(qty_available) over(partition by product order by s.product,expireddate,decode(warehouse,priority_wh,0,1),warehouse ) sm
    from stocks s,order_detail o
    where s.product = o.product_ord order by s.product,expireddate,decode(warehouse,priority_wh,0,1) )
    where (sm - qty_ord) < qty_available

    Hi,
    This my requirement :
    I have (simplified)Order_Detail as below :
    CREATE TABLE Order_Detail (PRODUCT_ORD CHAR(4), QTY_ORD number, Priority_WH CHAR(5) )
    INSERT INTO Order_Detail VALUES ('P001', 75, 'WH003') // previously 'WH002'
    INSERT INTO Order_Detail VALUES ('P002', 45, 'WH002')
    INSERT INTO Order_Detail VALUES ('P003', 55, NULL)
    Then I want to do stock taking from my STOCK table (described on my first post on this thread)
    create table stocks (Product char(4), Warehouse char(5), expireddate date, qty_available number)
    The rule is : The stok taking is on First In First Out basis, on expireddate.
    And I want to do it in single query.
    I want to make this a Function / Stored Procedure so that other transaction can also make use of this query.
    That is why I need to pass the 3 rows oy mr Order_Detail above, do the query, and return the result.
    Then INSERT the result into ORDER_DETAIL_PER_EXPIRED_DATE table.
    I hope this clear my requirement, is this possible ?
    Thank you,
    xtanto

  • How to query opening balance for all customer or Vendor for an speci. date

    Hi,
    How to query opening balance for all customer or Vendor for an specific date?
    Example:
    put any date and query will show all customer/ Vendor  that date opening/current balance.
    Regards,
    Mizan

    Hi mizan700 ,
    Try this
    SELECT T0.[DocNum] As 'Doc No.', T0.[CardCode] As 'Customer Code',
    T0.[CardName] As 'Customer Name',(T0.[DocTotal]-T0.[PaidSys]) As 'O/S Balance'
    FROM OINV T0 INNER JOIN OCRD T1 ON T0.CardCode = T1.CardCode
    INNER JOIN OCRG T2 on T1.GroupCode = T2.GroupCode
    INNER JOIN INV1 T3 ON T0.DocEntry = T3.DocEntry
    WHERE T0.[DocStatus] ='O'
    AND
    (T0.[DocDate] >='[%0]' AND T0.[DocDate] <='[%1]')
    Regards:
    Balaji.S

  • Looking for a simple example of how to query all the accounts

    I'm new to the web service model in oracle crm and have been trying to just get a list of the accounts in the system. I generated a .cs class from the account wsdl and added it to my asp.net project. I'm able to get a handle on the account class but not sure the right syntax to make a call out.. As a fyi - i also have been able to login thru the service and obtain a session id.. so I'm that far..
    Are they any existing code examples on how to query this? This is what I have so far but i throws an exception -
    Account act = new Account();
    act.Url = "https://"+dbcon.serverName+"/Services/Integration;jsessionid="+ sID;
    AccountWS_AccountQueryPage_Input qbe = new AccountWS_AccountQueryPage_Input();
    AccountWS_AccountQueryPage_Output qRet;
    qbe.ListOfAccount = new Account1[1];
    qbe.ListOfAccount[0] = new Account1();
    qbe.PageSize = "20";
    qbe.StartRowNum = "0";
    qbe.ListOfAccount[0].AccountId = "";
    qbe.ListOfAccount[0].Description = "";
    //act.CookieContainer = .... is this line needed?
    qRet = act.AccountQueryPage(qbe);
    return qRet.ToString();
    Thanks in advance for your help - Todd
    Edited by: user11139473 on May 6, 2009 6:33 PM

    Hi,
    I am doing the same thing but I am not sure what is Account1 in your case. Can you show me the implementation of Account1 class?
    Account act = new Account();
    act.Url = "https://"dbcon.serverName"/Services/Integration;jsessionid="+ sID;
    AccountWS_AccountQueryPage_Input qbe = new AccountWS_AccountQueryPage_Input();
    AccountWS_AccountQueryPage_Output qRet;
    qbe.ListOfAccount = new Account1[1]; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< qbe.ListOfAccount = new ListOfAccountQuery();
    qbe.ListOfAccount[0] = new Account1(); <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    qbe.PageSize = "20";
    qbe.StartRowNum = "0";
    qbe.ListOfAccount[0].AccountId = ""; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    qbe.ListOfAccount[0].Description = ""; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    //act.CookieContainer = .... is this line needed?
    qRet = act.AccountQueryPage(qbe);
    return qRet.ToString();
    On the right is my line of code. The ListOfAccount member of AccountQueryPage_Input has datatype ListOfAccountQuery. In my case, a NULL is returned after the call.
    Did you code work in the end?
    Thanks

  • Sender File Adapter Conversion problem - how to start new recordset?

    Hi guys!
    I have a source file like following:
    aaaakkkkkk
    uuuupppppp
    &&hhhhffffff
    6666uuuuuu
    3333rrrrrrrr
    &&kkkkoooooo
    which means - fixed length 4,6 and && starts new recordset.
    I need to get structure like:
    <recordset>
      <item>
        <a>aaaa</a>
        <b>kkkkkk</b>
      </item>
      <item>
        <a>uuuu</a>
        <b>pppppp</b>
      </item>
    </recordset>
    <recordset> ... with h,f and 6,u </recordset>
    <recordset>
      <item>
        <a>kkkk</a>
        <b>oooooo</b>
      </item>
    </recordset>
    Any ideas?
    Let's say, I can add && on the beginning of the file and other "lite" changes... but structure stays the same...
    so, how to start new recordset? with which conversion parameter? for items it is clear...
    Thanx a lot!
    Olian
    Message was edited by:
            Olian Saludew

    aaaakkkkkk<end_of_line>&&uuuuwwwwww<end_of_line>...
    then normal parameters should work fine,
    item.fieldFixedLengths==4,6
    Item.fieldNames=field1,field2
    item.endSeparator=<end_of_line>

  • How to query attributes with namespace in xmltable? thanks

    sample schema:
    <xsd:schema elementFormDefault="qualified" targetNamespace="http://www.tse.or.jp/jp/br/tdnet/ed/pt/2006-03-31">
    <xsd:element name="LocationOfHeadOffice" id="tse-ed-pt_LocationOfHeadOffice" type="xbrli:stringItemType" substitutionGroup="xbrli:item" abstract="false" nillable="true" xbrli:periodType="instant"/>
    <xsd:schema>
    My question is how to query the attribute xbrli:periodType using function xmltable.
    My query statement(it's just a part of it and it does not work):
    xmltable(XMLNamespaces('http://www.w3.org/2001/XMLSchema' as xs,
    'http://www.xbrl.org/2003/instance' as xbrli),
    '/xs:schema/xs:element'
    passing a.schema
    columns periodType varchar2(1000) path '@xbrli:periodType') b
    And the error message:
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00601: Invalid token in: '/*/@xs:nillable'
    In fact, with standard xpath "doc("taxonomy.xsd")/xs:schema/xs:element/@xbrli:periodType", we can use the namespace with attributes, but why the xmltable function does not support it?
    And, how can I query this attribute?
    Thanks a lot.

    sorry for the mistake, the error message:
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00601: Invalid token in: '/*/@xbrli:periodType'

  • How to query from the xml table a single, specified element.

    I'm quite new in Xml Db. Pleas, can anybody tell me how to query from the xml table below a single element (i.e. the element 'rapportoparentela = NIPOTE' related to the element 'codicefiscale = CRRVNC76R52G337R', or the element 'rapportoparentela = FIGLIO' related to the element 'codicefiscale = CRRRNT51L23G337Q')?
    - <dati xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <codiceinterno />
    <codicefiscaleassistito>CRRMNL81R31G337H</codicefiscaleassistito>
    - <famigliare>
    <codicefiscale>CRRVNC76R52G337R</codicefiscale>
    <rapportoparentela>NIPOTE</rapportoparentela>
    </famigliare>
    - <famigliare>
    <codicefiscale>CRRRNT51L23G337Q</codicefiscale>
    <rapportoparentela>FIGLIO</rapportoparentela>
    </famigliare>
    - <famigliare>
    <codicefiscale>CBRPRN15S65E080W</codicefiscale>
    <rapportoparentela>I.S.</rapportoparentela>
    </famigliare>
    - <famigliare>
    <codicefiscale>CRRMNL81R31G337H</codicefiscale>
    <rapportoparentela>NIPOTE</rapportoparentela>
    </famigliare>
    - <famigliare>
    <codicefiscale>BCCCML54C50I845G</codicefiscale>
    <rapportoparentela>NUORA</rapportoparentela>
    </famigliare>
    </dati>
    Using SELECT extractValue(value(t),'/rapportoparentela') into result FROM NF_XMLT X,
    TABLE ( xmlsequence (extract(value(X),'/dati/famigliare/rapportoparentela'))) t
    I get all the elements 'rapportoparentela' and I want to get only one specified.
    Regards.
    Piero

    Piero,
    you can add the condition "CRRVNC76R52G337R" to your xpath-expression like:
    SELECT extractValue(value(t),'/rapportoparentela')
    FROM NF_XMLT x
    ,TABLE ( xmlsequence (extract(value(X),'/dati/famigliare[rapportoparentela="CRRVNC76R52G337R"]'))) tto select only those famigliare-elements that have a child-element rapportoparentela with value "CRRVNC76R52G337R".
    When you stored your XML in an XMLType column in the table, i think the following queries are better:
    SELECT extractValue(x.your_XMLType_column,'/dati/famigliare/rapportoparentela')
    FROM NF_XMLT x
    WHERE extractValue(x.your_XMLType_column,'/dati/famigliare/codicefiscale')
    = 'CRRVNC76R52G337R'or
    SELECT extractValue(x.your_XMLType_column,'/dati/famigliare/rapportoparentela')
    FROM NF_XMLT x
    WHERE existsNode(x.your_XMLType_column,'/dati/famigliare[codicefiscale="CRRVNC76R52G337R"]')
    != 0

  • How to query uncommited transactions

    Hi Does anyone know how to query Oracle database from SQL*Plus to view uncommitted transactions?
    Thanks

    I noticed after I posted that I had used a package I found on the web called list that includes several useful functions. So in case someone wants it, here are the package and body:
    ***PACKAGE***
    CREATE OR REPLACE PACKAGE list AUTHID CURRENT_USER IS
    -- All of these functions and procedures have the following parameters:
    -- list_in - A delimited list to be parsed.
    -- delimiter - The delimiter to be used for parsing the list. Defaults
    -- to a comma.
    -- null_item - What to do with null items in the list. A null item is created
    -- by consecutive occurances of the delimiter. Valid values are
    -- 'KEEP' to allow items in the list to be null, or 'SKIP' to ignore
    -- null items, ie. treat consecutive occurances of delimiters as a
    -- single delimiter. The default is 'KEEP'.
    -- delimiter_use - How the delimiter is to be interpreted. Valid values are
    -- 'ANY' to treat the entire delimiter string as a single occurance
    -- of a delimiter which must be matched exactly, or 'ANY' to treat
    -- the delimiter string as a set of single character delimiters, any
    -- of which is a delimiter. The default is 'ANY'.
    -- Return the first item in a list.
    FUNCTION head(
    list_in IN VARCHAR2,
    delimiter IN VARCHAR2 DEFAULT ',',
    null_item IN VARCHAR2 DEFAULT 'KEEP',
    delimiter_use IN VARCHAR2 DEFAULT 'ANY') RETURN VARCHAR2;
    PRAGMA RESTRICT_REFERENCES (head,WNDS,WNPS);
    -- Return the remainder of a list after the first item and its delimiter.
    FUNCTION tail(
    list_in IN VARCHAR2,
    delimiter IN VARCHAR2 DEFAULT ',',
    null_item IN VARCHAR2 DEFAULT 'KEEP',
    delimiter_use IN VARCHAR2 DEFAULT 'ANY') RETURN VARCHAR2;
    PRAGMA RESTRICT_REFERENCES (tail,WNDS,WNPS);
    -- Return the nth item in a list.
    -- The parameter, item_num, denotes which item to return.
    FUNCTION item(
    list_in IN VARCHAR2,
    item_num IN INTEGER DEFAULT 1,
    delimiter IN VARCHAR2 DEFAULT ',',
    null_item IN VARCHAR2 DEFAULT 'KEEP',
    delimiter_use IN VARCHAR2 DEFAULT 'ANY') RETURN VARCHAR2;
    PRAGMA RESTRICT_REFERENCES (item,WNDS);
    -- Append an item to a list and return the new list.
    -- The parameter, item_in, contains the new item to append.
    FUNCTION append_item(
    list_in IN VARCHAR2,
    item_in IN VARCHAR2,
    delimiter IN VARCHAR2 DEFAULT ',') RETURN VARCHAR2;
    PRAGMA RESTRICT_REFERENCES (append_item,WNDS);
    -- Return the number of items in a list.
    FUNCTION num_items(
    list_in IN VARCHAR2,
    delimiter IN VARCHAR2 DEFAULT ',',
    null_item IN VARCHAR2 DEFAULT 'KEEP',
    delimiter_use IN VARCHAR2 DEFAULT 'ANY') RETURN INTEGER;
    PRAGMA RESTRICT_REFERENCES (num_items,WNDS);
    -- Search a list for an item, and give its location in the list,
    -- or zero IF not found.
    -- The parameter, item_in, gives the item to be found in the list.
    FUNCTION in_list(
    list_in IN VARCHAR2,
    item_in IN VARCHAR2,
    delimiter IN VARCHAR2 DEFAULT ',',
    null_item IN VARCHAR2 DEFAULT 'KEEP',
    delimiter_use IN VARCHAR2 DEFAULT 'ANY') RETURN INTEGER;
    PRAGMA RESTRICT_REFERENCES (in_list,WNDS);
    -- Convert an array to a delimited list.
    -- The array to be input is a DBMS_UTILITY.uncl_array so that
    -- the LIST package is compatible with the comma_to_table and
    -- table_to_comma built ins.
    -- In this function, delimiter is always treated as a single
    -- string.
    FUNCTION array_to_list(
    array_in IN DBMS_UTILITY.UNCL_ARRAY,
    arrlen_in IN INTEGER,
    delimiter IN VARCHAR2 DEFAULT ',') RETURN VARCHAR2;
    PRAGMA RESTRICT_REFERENCES (array_to_list,WNDS,WNPS);
    -- Print a list using DBMS_OUTPUT.
    PROCEDURE print_list(
    list_in IN VARCHAR2,
    delimiter IN VARCHAR2 DEFAULT ',',
    null_item IN VARCHAR2 DEFAULT 'KEEP',
    delimiter_use IN VARCHAR2 DEFAULT 'ANY');
    -- Convert a list to an array and return the array and its size.
    -- This is a procedure because it returns more than one value.
    -- The array to be returned is a DBMS_UTILITY.uncl_array so that
    -- the LIST package is compatible with the comma_to_table and
    -- table_to_comma built ins.
    PROCEDURE list_to_array(
    list_in IN VARCHAR2,
    arrlen OUT BINARY_INTEGER,
    array_out OUT DBMS_UTILITY.uncl_array,
    delimiter IN VARCHAR2 DEFAULT ',',
    null_item IN VARCHAR2 DEFAULT 'KEEP',
    delimiter_use IN VARCHAR2 DEFAULT 'ANY');
    -- Sort a list
    -- Null items are always skipped when sorting lists, since they would sort
    -- to the end of the list anyway. CMPFNC is the name of a function to compare
    -- two items. The default of '>' sorts in ascending order, '<' in descending order.
    -- If you write your own function to be used for sorting, it must:
    -- 1. Take two parameters of type VARCHAR2
    -- 2. Return an INTEGER
    -- 3. Return a negative number if the first item is to sort lower than
    -- the second, a zero if they are to sort as if equal, or a positive
    -- number if the first item is to sort higher than the second.
    -- 4. Be executable by the user running the sort. Normal naming rules apply.
    FUNCTION sort_list(
    list_in IN VARCHAR2,
    delimiter IN VARCHAR2 DEFAULT ',',
    cmpfnc IN VARCHAR2 DEFAULT '>',
    delimiter_use IN VARCHAR2 DEFAULT 'ANY') RETURN VARCHAR2;
    PRAGMA RESTRICT_REFERENCES (sort_list,WNDS);
    end;
    ***END PACKAGE SPEC***
    ***BEGIN BODY***
    CREATE OR REPLACE PACKAGE BODY list IS
    current_list VARCHAR2(32760) DEFAULT '';
    current_delim VARCHAR2(30) DEFAULT ',';
    TYPE list_array IS TABLE OF VARCHAR2(2000)
    INDEX BY BINARY_INTEGER;
    current_array list_array;
    current_arrlen BINARY_INTEGER DEFAULT 0;
    current_null_item VARCHAR2(4) DEFAULT '';
    current_delimiter_use VARCHAR2(3) DEFAULT '';
    -- Find the first delimiter.
    FUNCTION find_delimiter(
    list_in IN VARCHAR2,
    delimiter IN VARCHAR2 DEFAULT ',',
    null_item IN VARCHAR2 DEFAULT 'KEEP',
    delimiter_use IN VARCHAR2 DEFAULT 'ANY') RETURN BINARY_INTEGER IS
    delimiter_loc BINARY_INTEGER;
    BEGIN
    IF upper(delimiter_use) = 'ALL' THEN
    delimiter_loc := INSTR(list_in,delimiter);
    ELSIF upper(delimiter_use) = 'ANY' THEN
    delimiter_loc := INSTR(TRANSLATE(list_in,delimiter,ltrim(RPAD(' ',LENGTH(delimiter)+1,CHR(31)))),CHR(31));
    END IF;
    RETURN delimiter_loc;
    END find_delimiter;
    -- Return the first item in a list.
    FUNCTION head(
    list_in IN VARCHAR2,
    delimiter IN VARCHAR2 DEFAULT ',',
    null_item IN VARCHAR2 DEFAULT 'KEEP',
    delimiter_use IN VARCHAR2 DEFAULT 'ANY') RETURN VARCHAR2 IS
    delimiter_loc BINARY_INTEGER;
    BEGIN
    delimiter_loc := find_delimiter(list_in,delimiter,null_item,delimiter_use);
    IF delimiter_loc > 1 THEN
    RETURN SUBSTR(list_in,1,delimiter_loc-1);
    ELSIF delimiter_loc = 1 THEN
    RETURN NULL;
    ELSE
    RETURN list_in;
    END IF;
    END head;
    -- Return the remainder of a list after the first item and its delimiter.
    FUNCTION tail(
    list_in IN VARCHAR2,
    delimiter IN VARCHAR2 DEFAULT ',',
    null_item IN VARCHAR2 DEFAULT 'KEEP',
    delimiter_use IN VARCHAR2 DEFAULT 'ANY') RETURN VARCHAR2 IS
    start_ch BINARY_INTEGER;
    BEGIN
    start_ch := find_delimiter(list_in,delimiter,null_item,delimiter_use);
    IF start_ch = 0 THEN
    RETURN NULL;
    ELSE
    IF upper(delimiter_use) = 'ALL' THEN
    start_ch := start_ch + LENGTH(delimiter);
    ELSE
    start_ch := start_ch + 1;
    END IF;
    IF start_ch > LENGTH(list_in) THEN
    RETURN NULL;
    ELSE
    RETURN SUBSTR(list_in,start_ch);
    END IF;
    END IF;
    END tail;
    -- Convert a list to an array.
    PROCEDURE parse_list(
    list_in IN VARCHAR2,
    delimiter IN VARCHAR2 DEFAULT ',',
    null_item IN VARCHAR2 DEFAULT 'KEEP',
    delimiter_use IN VARCHAR2 DEFAULT 'ANY') IS
    list_to_parse VARCHAR2(32760);
    BEGIN
    IF list_in = current_list AND
    delimiter = current_delim AND
    null_item = current_null_item AND
    delimiter_use = current_delimiter_use THEN
    NULL;
    ELSE
    current_list := list_in;
    current_delim := delimiter;
    current_null_item := upper(null_item);
    current_delimiter_use := upper(delimiter_use);
    list_to_parse := list_in;
    current_arrlen := 0;
    WHILE list_to_parse IS NOT NULL LOOP
    IF current_null_item <> 'SKIP' OR
    head(list_to_parse,delimiter,null_item,delimiter_use) IS NOT NULL THEN
    current_arrlen := current_arrlen + 1;
    current_array(current_arrlen) := SUBSTR(head(list_to_parse,delimiter,null_item,delimiter_use),1,2000);
    END IF;
    list_to_parse := tail(list_to_parse, delimiter,null_item,delimiter_use);
    END LOOP;
    END IF;
    END parse_list;
    -- Convert a list to an array and return the array and its size.
    PROCEDURE list_to_array(
    list_in IN VARCHAR2,
    arrlen OUT BINARY_INTEGER,
    array_out OUT DBMS_UTILITY.uncl_array,
    delimiter IN VARCHAR2 DEFAULT ',',
    null_item IN VARCHAR2 DEFAULT 'KEEP',
    delimiter_use IN VARCHAR2 DEFAULT 'ANY') IS
    BEGIN
    parse_list(list_in,delimiter,null_item,delimiter_use);
    arrlen := current_arrlen;
    FOR i IN 1..arrlen LOOP
    array_out(i) := SUBSTR(current_array(i),1,240);
    END LOOP;
    END list_to_array;
    -- Print a list using DBMS_OUTPUT.
    PROCEDURE print_list(
    list_in IN VARCHAR2,
    delimiter IN VARCHAR2 DEFAULT ',',
    null_item IN VARCHAR2 DEFAULT 'KEEP',
    delimiter_use IN VARCHAR2 DEFAULT 'ANY') IS
    BEGIN
    DBMS_OUTPUT.ENABLE(100000);
    parse_list(list_in,delimiter,null_item,delimiter_use);
    FOR i IN 1..current_arrlen LOOP
    dbms_output.put_line(SUBSTR(current_array(i),1,240));
    END LOOP;
    END print_list;
    -- Return the number of items in a list.
    FUNCTION num_items(
    list_in IN VARCHAR2,
    delimiter IN VARCHAR2 DEFAULT ',',
    null_item IN VARCHAR2 DEFAULT 'KEEP',
    delimiter_use IN VARCHAR2 DEFAULT 'ANY') RETURN INTEGER is
    BEGIN
    parse_list(list_in,delimiter,null_item,delimiter_use);
    RETURN current_arrlen;
    END num_items;
    -- Return the nth item in a list.
    FUNCTION item(
    list_in IN VARCHAR2,
    item_num IN INTEGER DEFAULT 1,
    delimiter IN VARCHAR2 DEFAULT ',',
    null_item IN VARCHAR2 DEFAULT 'KEEP',
    delimiter_use IN VARCHAR2 DEFAULT 'ANY') RETURN VARCHAR2 is
    BEGIN
    parse_list(list_in,delimiter,null_item,delimiter_use);
    IF item_num NOT BETWEEN 1 AND current_arrlen THEN
    RETURN NULL;
    ELSE
    RETURN current_array(item_num);
    END IF;
    END item;
    -- Append an item to a list and return the new list.
    -- The parameter, item_in, contains the new item to append.
    FUNCTION append_item(
    list_in IN VARCHAR2,
    item_in IN VARCHAR2,
    delimiter IN VARCHAR2 DEFAULT ',') RETURN VARCHAR2 IS
    BEGIN
    IF list_in IS NULL THEN
    RETURN item_in;
    ELSE
    RETURN list_in || delimiter || item_in;
    END IF;
    END append_item;
    -- Search a list for an item, and give its location in the list,
    -- or zero IF not found.
    FUNCTION in_list(
    list_in IN VARCHAR2,
    item_in IN VARCHAR2,
    delimiter IN VARCHAR2 DEFAULT ',',
    null_item IN VARCHAR2 DEFAULT 'KEEP',
    delimiter_use IN VARCHAR2 DEFAULT 'ANY') RETURN INTEGER is
    BEGIN
    parse_list(list_in,delimiter,null_item,delimiter_use);
    FOR item_num IN 1..current_arrlen LOOP
    IF current_array(item_num) = item_in THEN
    RETURN item_num;
    END IF;
    END LOOP;
    RETURN 0;
    END in_list;
    -- Convert an array to a delimited list.
    FUNCTION array_to_list(
    array_in IN DBMS_UTILITY.UNCL_ARRAY,
    arrlen_in IN INTEGER,
    delimiter IN VARCHAR2 DEFAULT ',') RETURN VARCHAR2 IS
    list_out VARCHAR2(32760):= '';
    BEGIN
    FOR item_num IN 1 .. arrlen_in LOOP
    EXIT WHEN LENGTH(list_out) +
    LENGTH(array_in(item_num)) > 32760;
    list_out := list_out||array_in(item_num);
    IF item_num < arrlen_in THEN
    list_out := list_out||delimiter;
    END IF;
    END LOOP;
    RETURN list_out;
    END array_to_list;
    -- Sort a list
    FUNCTION sort_list(
    list_in IN VARCHAR2,
    delimiter IN VARCHAR2 DEFAULT ',',
    cmpFnc IN VARCHAR2 DEFAULT '>',
    delimiter_use IN VARCHAR2 DEFAULT 'ANY') RETURN VARCHAR2 IS
    temp_array list_array;
    temp_len PLS_INTEGER := 0;
    temp_item VARCHAR2(2000);
    list_out VARCHAR2(32760);
    PROCEDURE swap (
    first_item IN OUT VARCHAR2,
    second_item IN OUT VARCHAR2) IS
    temp_item VARCHAR2(2000);
    BEGIN
    temp_item := first_item;
    first_item := second_item;
    second_item := temp_item;
    END swap;
    FUNCTION cmp (
    first_item IN VARCHAR2,
    second_item IN VARCHAR2,
    cmpfnc IN VARCHAR2 DEFAULT '=') RETURN INTEGER IS
    return_value INTEGER;
    BEGIN
    IF cmpfnc = '>' THEN
    IF first_item < second_item THEN
    return_value := -1;
    ELSIF first_item = second_item THEN
    return_value := 0;
    ELSIF first_item > second_item THEN
    return_value := 1;
    END IF;
    ELSIF cmpfnc = '<' THEN
    IF first_item > second_item THEN
    return_value := -1;
    ELSIF first_item = second_item THEN
    return_value := 0;
    ELSIF first_item < second_item THEN
    return_value := 1;
    END IF;
    ELSE
    EXECUTE IMMEDIATE 'BEGIN :I := '||cmpfnc||'(:A,:B); END;'
    USING OUT return_value, IN first_item, IN second_item;
    END IF;
    RETURN return_value;
    END cmp;
    BEGIN
    parse_list(list_in,delimiter,'SKIP',delimiter_use);
    FOR item_num IN 1..current_arrlen LOOP
    temp_item := current_array(item_num);
    FOR i IN 1..temp_len LOOP
    IF cmp(temp_array(i),temp_item,cmpfnc) > 0 THEN
    swap(temp_array(i),temp_item);
    END IF;
    END LOOP;
    temp_len := temp_len + 1;
    temp_array(temp_len) := temp_item;
    END LOOP;
    FOR item_num IN 1..temp_len LOOP
    EXIT WHEN LENGTH(list_out) +
    LENGTH(temp_array(item_num)) > 32760;
    list_out := list_out||temp_array(item_num);
    IF item_num < temp_len THEN
    list_out := list_out||delimiter;
    END IF;
    END LOOP;
    RETURN list_out;
    END sort_list;
    END;
    *** END BODY***
    Carl

  • How to query database to retrieve code to create existing objects(nonPLSQL)

    Hi,
    I would like to know how to query the database so I can pull out the SQL required to create objects. I can already get the code for PL/SQL objects such as triggers and procedures by using DBA_SOURCE, however I also need to pull out code for objects like indexes, synonyms, libraries and views that are not stored in DBA_SOURCE. My colleague has suggested creating an index file from a metadata export however I only want code for broken objects and I need it to run automatically across all my databases with a single windows command script. Can anyone help me with this? TOAD manages to get the code for the objects but if it isn't stored in the DB then maybe it's creating it on the fly.
    Thanks
    Adam

    If you run an export with rows=N, you can produce a file with all the scripts.
    Otherwise you might want to look at DBMS_METADATA.
    We would just reference the original scripts in our source control, but hey, we're crazy like that.

  • How to query XML data stored in a CLOB column

    I don't know XMLDB, so I have a dumb question about querying XML data which is saved as CLOB in a table.
    I have a table (OLAP_AW_PRC), with a CLOB column - AW_XML_TMPL_VAL
    This column contains this xml data - [click here|http://www.nasar.net/aw.xml]
    Now I want to query the data using the xml tags - like returning the name of AW. This is where I am having trouble, how to query the data from AW_XML_TMPL_VAL clob column.
    The following query generates error:
    ORA-31011: XML parsing failed.
    ORA-19202: Error occurred in XML processing
    LPX-00229: input source is empty
    SELECT
    extractValue(value(x), '/AW/LongName') as "AWNAME"
    from
    OLAP_AW_PRC,
    table(xmlsequence(extract (xmltype(AW_XML_TMPL_VAL), '/AWXML/AWXML.content/Create/ActiveObject/AW'))) x
    where
    extractValue(value(x) , '/AW/Name') = 'OMCR4'
    - Nasar

    Mark,
    Thanks. This is exactly what I was looking for.
    After doing @Name in both places (SELECT and WHERE clause) it worked.
    Now I have one more question.
    There are multiple DIMENSION tags in my xml, and I want to see the NAME attribute values for all of those DIMENSIONs. The following query returns
    ORA-19025: EXTRACTVALUE returns value of only one node.
    Cause: Given XPath points to more than one node.
    Action: Rewrite the query so that exactly one node is returned.
    SELECT
    extractValue(value(x), '/AW/@Name') as "AW",
    extractValue(value(x), '/AW/Dimension/@Name') as "DIMENSIONS"
    from
    OLAP_AW_PRC,
    table(xmlsequence(extract (xmltype(AW_XML_TMPL_VAL), '/AWXML/AWXML.content/Create/ActiveObject/AW'))) x
    where
    extractValue(value(x) , '/AW/@Name') = 'OMCR4'

  • How to Query E-Business Tax tables/views

    I run SQL queries on the following tables:
    ZX_TRANSACTION
    ZX_TRANSACTION_LINES
    but it returns no rows. How to query ZX tables/views?
    My main purpose is to retrieve tax code which is in 12i no longer available in AP Transaction Distributions table/view.
    Please advise.
    Thanks in advance.

    Hi Srini,
    I followed PL/SQL procedure stated in note 415860.1. But still can't do the query. See below.
    SQL> begin
    2 fnd_global.apps_initialize(1079,51569,235);
    3 mo_global.init('ZX');
    4 end;
    5 /
    PL/SQL procedure successfully completed.
    SQL> select count(*) from ZX_TRANSACTION
    2 /
    COUNT(*)
    0
    SQL> select count(*) from ZX_TRANSACTION_LINES
    2 /
    COUNT(*)
    0
    Thanks,
    Corry

  • How to query for two tables

    Hi,
    I have this problem, How can query a two table?
    Table A ->  Table B
    id               table-a_id
    name          table_b_name
    the relationship is one-to-many
    How can I get the result?
    Hope my question make sense
    cheers.
    thanks a lot.

    I bet you have more luck looking for an answer in a SQL forum.

  • How to query in two tables

    Hi all
    How to query in two different tables? Should i use the following
    SET_BLOCK_PROPERTY('ins1', ONETIME_WHERE, 'serial = ''' || :GLOBAL.CODE || ''''); this is working but for one table if i want for both tables and and it display the related information in main form , eg..tables are referenced by primary key constraint and foreign key.
    sarah
    Edited by: SarahSarahSarah on Sep 1, 2009 4:59 AM

    For the primary forign key tables no need to create two forms use the master detail functionality of forms.
    create a Master/Detail form using the DEPARTMENT, EMPLOYEE tables.
    DEPARTMENTwill be the Master block and EMPLOYEE will be the Detail block. The join condition between the two tables is where the deptno column of DEPARTMENT is equal to the deptno column of EMPLOYEE .
    The following is an outline of the steps:
    Create the DEPARTMENT data block and include the all the fields on the form.
    Use the Form layout and only display one record at a time.
    Go back to the Object Navigator and select the "Data Blocks" tree. Make sure the DEPARTMENT block is not selected and run the Data Block Wizard again.
    Create the EMPLOYEE data block and include all of the columns.
    For the master/Detail relationship, de-select the "auto" option, use a Join relationship, choose the DEPARTMENT data block as the Master and set EMPLOYEE.DEPTNO= DEPARTMENT.DEPTNO for the join relationship.
    In the Layout Wizard for the Dependents data block, display all of the fields
    Choose a Tabular style and display 4 up to records at once with 0 space between each record.
    Save the form and run the form.
    Thanks

  • How to query the flat files?

    Hi
    How to query the flat files that are used in Etl From EBS source.

    That can be done in OBIEE. Save the flat file as .csv format. Then go to ODBC Administrator on windows machine where you BI server is running, and create an System DSN and select "Microsft Access Text Driver (*.txt, *.csv)" as driver type.
    Next, import tables in RPD using this ODBC connection. Rest of the steps as same as building model from a table source.
    Hope this helps.

Maybe you are looking for

  • Is there a tutorial for the iMovies App for the iPhone?

    I cannot figure out all of the features and things that are not there that make to have. In other words, it's not all intuitive. Does anyone have some good tutorial for us to use? Also, is this app it? I mean, are there other features or plug-in's or

  • X Segmentation fault with new sapphire HD7850

    Hi, randomly my X server crash and reboot (like 1 time at day, while surfing the net. No problem while playing under wine/steam) i attach the xorg log, but it doesn't say very much to me. can you find out what is going on or what i have to do to get

  • Videos automatically playing next show

    I use my iPad to watch full seasons of tv shows.  In the past month, not exactly sure when, but when I finish a show the iPad is automatically going to the next video in the season and playing it.  It used to go back to the list of videos and let me

  • Find feature now partially disabled in Mail?

    I frequently email my students using Mail, but the program that gives me the contact list of students is Windows friendly and the names are separated by semi-colons, so in order for this list to work with Mail I have to change the all the semi-colons

  • Loading xml metadata into a clob column

    Hi, how can i load metadata for a custom report(OIM) into rep_xml_meta column (clob type) of rep table? can the metadata be taken in the form of simple text file?