The dynamic LOV PL/SQL syntax help

Hello

I am trying to create a dynamic lov pl/sql Oracle Apex 3.2 on 11 g. I'm having some trouble with the syntax of the statements below and I would be grateful for any suggestion.
DECLARE
BEGIN

IF :p3_current_a_workshop != 0 THEN
RETURN
'select distinct workshop_title ||':  '  || presenter_name ||'    $'|| workshop_fee display_value, workshop_id return_value 
from WORKSHOP
where session_time = 'A'
and workshop_status = 'Open'
or workshop_id = :p3_current_a_workshop
order by 1';

ELSE
RETURN
'select distinct workshop_title ||':  '  || presenter_name ||'    $'|| workshop_fee display_value, workshop_id return_value 
from WORKSHOP
where session_time = 'A'
and workshop_status = 'Open'
order by 1';

END IF;
EXCEPTION
        WHEN OTHERS THEN
            HTP.PRN('ERROR'||SQLERRM);          
END;
I'm trying to shape the code above out of the example given by apex:
A function that returns a SQL query with two columns:

IF :MY_ITEM='10' THEN
  RETURN 
  'SELECT ename, empno 
FROM  emp 
WHERE depno = 10 
ORDER BY 1';
ELSE
  RETURN 
  'SELECT ename, empno 
FROM emp 
WHERE depno = :my_item 
ORDER BY 1';
END IF;
~ Andrew Schultz

How do you use this procedure?

You can create and example on apex.oracle.com?

Lev

Published by: the January 12, 2011 14:10

Tags: Database

Similar Questions

  • Where can I find the source of the usefulness of the dynamic "LOVs? white paper

    I downloaded this white paper: -.

    http://www.Oracle.com/technology/products/forms/PDF/10G/community_paper_generic_lov.PDF

    and its title is:
    Form of Oracle 10 g - dynamic LOVs

    The problem here is that I can not find the AC power : -.

    • THE COLORS. PLL
    • LOV. PLL
    • GEN_LOV. FMB
    • INIT_LOV. FMB
    • TEST_LOV. FMB

    does anyone have an idea where I can find the Source?

    Please I want to link specific, as it does not exist in the white paper: -.
    {Sources of the utility can be downloaded from the Oracle Technology Network (OTN1).}

    Hello

    On the same page, the title is followed by a link called: zip
    (http://www.oracle.com/technology/products/forms/pdf/10g/community_paper_genlov.zip)
    Just click this link ;-)

    François

  • Design of the dynamic schema through SQL

    Hi all

    Is it possible to design a dynamic schema using SQL?
    Documents or links is greatly appreciated.

    Thank you

    Hello

    Sorry, I don't get you. Design of a scheme is more than dynamic SQL, you must think of tables, relationships, constraints, standardization, etc.. On the dynamic SQL statements, see [using dynamic SQL statements | http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28370/dynamic.htm#CACDDACH]

    Kind regards

  • Help for the logic of Pl/SQL & syntax used

    Hi, in the book of Ivan Bayross, following example illustrating use of triggers.


    Create trigger audit_trail
    After the update or delete on the client
    for each line

    DECLARE

    Oper varchar (20);

    BEGIN

    If the update can
    Oper: = "UPDATE";
    End if;

    If remove then
    Oper: = 'DELETE ';
    End if;


    Insert into audit_cust
    Values (*: OLD.) CUST_NO *, *: OLD. FNAME *);

    END;



    Questions :*

    1. why: the symbol is used in the query to insert above? Namely: OLD. CUST_NO
    It indicates? Also, what makes. (operator of point) indicate?
    OLD is not the name of table.

    2. in the program above what this line means?

    If remove then
    Oper: = 'DELETE ';
    End if;

    We are just assigning the value 'REMOVE' to the variable oper? or something else?

    Hello

    Therefore, always the difficulty of Ivan book, right ;-)?

    1: OLD and: NEW ways you can refer to the old and new column values.
    They are only usable in the triggers.

    So, if you update the column X 1 to 2, the value of: OLD. X = 1 and: NEW. X = 2 in your trigger only.

    http://download.Oracle.com/docs/CD/B19306_01/server.102/b14220/triggers.htm#CNCPT118

    http://www.Oracle.com/pls/db102/search?word=trigger&PartNo=

    We are just assigning the value 'REMOVE' to the variable oper? or something else?

    I guess that the author wanted to say do this:

    Create trigger audit_trail
    After update or delete on customer
    for each row
    
    DECLARE
    
    oper VARCHAR(20);
    
    BEGIN 
    
    If updating then
    oper :='UPDATE';
    End if;
    
    If deleting then
    oper :='DELETE';
    End if;
    
    Insert into audit_cust
    Values( :OLD.CUST_NO, : OLD.FNAME,  oper );
    
    END;
    

    He probably forgot to insert the variable in its audit table oper,

  • error of dynamics of the associative array (pl/sql), please help

    Function down I can hard-coded but not able to go to dynamically can u please friends

    CREATE OR REPLACE FUNCTION FN_SUBSCRIPTION_BEHAVIOUR(P_YYMM IN VARCHAR2) RETURN VARCHAR2
    AS
    ARR_LIST APEX_APPLICATION_GLOBAL. VC_ARR2;
    Typ_array. ARRAY TYPE IS VARCHAR2 (16);
    array_final typ_array;
    V_ARRAY VARCHAR2 (2000);
    v_out VARCHAR2 (2000);
    v_result VARCHAR2 (2000);
    BEGIN
    ARR_LIST: = APEX_UTIL. STRING_TO_TABLE (P_YYMM, ',');
    Select LISTAGG (fid_value, ',') IN GROUP (ORDER BY fid_value) BY v_array
    of filter_detail, filter_master
    where fil_id = fid_fil_id
    and fil_position = 15
    AND NVL (fid_ACTIVE, 'Y') = 'Y ';
    array_final: = typ_array (v_array); Commented (1102,1101,1012,1011,1010,1009,1008,1007,1006,1005,1004,1003,1002,1001);
    I'm looping 1.array_final.count
    If array_final (i) in (arr_list (I)) then v_result: = '1';--Commented--(1002,1003,1007)
    Another v_result: = '0';
    end if;
    v_out: = v_out | v_result;
    end loop;
    Return v_out;
    END;


    my output is

    00000001000110

    Published by: V on March 23, 2011 21:42

    Published by: V on March 23, 2011 22:24

    Published by: V on March 23, 2011 23:00

    Published by: V on March 24, 2011 12:57 AM

    Hello

    Please check below, hope this helps.

    SQL>
    SQL> DROP TABLE tmp
      2  /
    
    Table dropped
    SQL> CREATE TABLE tmp ( col1 NUMBER)
      2  /
    
    Table created
    SQL> INSERT INTO tmp
      2      SELECT 1001 FROM DUAL UNION
      3      SELECT 1002 FROM DUAL UNION
      4      SELECT 1003 FROM DUAL UNION
      5      SELECT 1004 FROM DUAL UNION
      6      SELECT 1005 FROM DUAL UNION
      7      SELECT 1006 FROM DUAL UNION
      8      SELECT 1007 FROM DUAL UNION
      9      SELECT 1008 FROM DUAL UNION
     10      SELECT 1009 FROM DUAL UNION
     11      SELECT 1010 FROM DUAL UNION
     12      SELECT 1011 FROM DUAL UNION
     13      SELECT 1012 FROM DUAL UNION
     14      SELECT 1101 FROM DUAL UNION
     15      SELECT 1102 FROM DUAL
     16  /
    
    14 rows inserted
    SQL> COMMIT
      2  /
    
    Commit complete
    SQL> CREATE OR REPLACE FUNCTION FN_SUBSCRIPTION_BEHAVIOUR(P_YYMM IN VARCHAR2)
      2    RETURN VARCHAR2 AS
      3    ARR_LIST APEX_APPLICATION_GLOBAL.VC_ARR2;
      4    TYPE typ_array IS TABLE OF VARCHAR2(16);
      5    array_final typ_array;
      6    V_ARRAY     VARCHAR2(2000);
      7    v_out       VARCHAR2(2000);
      8    v_result    VARCHAR2(2000);
      9  BEGIN
     10    select LISTAGG(col1, ',') WITHIN
     11     GROUP(
     12     ORDER BY col1)
     13      INTO v_array
     14      from tmp;
     15    ARR_LIST := APEX_UTIL.STRING_TO_TABLE(v_array, ',');
     16    for i in 1 .. ARR_LIST.count loop
     17      if (INSTR(P_YYMM, ARR_LIST(i)) > 0) then
     18        v_result := '1';
     19      else
     20        v_result := '0';
     21      end if;
     22      v_out := v_out || v_result;
     23    end loop;
     24    return v_out;
     25  END;
     26  /
    
    Function created
    SQL> DECLARE
      2     l_out   VARCHAR2(2000);
      3  BEGIN
      4     l_out := FN_SUBSCRIPTION_BEHAVIOUR('1002,1003,1004');
      5     dbms_output.put_line(l_out);
      6  END;
      7  /
    
    01110000000000
    
    PL/SQL procedure successfully completed
    
    SQL> 
    

    Ameya

  • Works with tables/columns of the lines and the parameter names... syntax help

    I am trying to create a function that returns the distinct value and counts of a user defined schema/table/column.

    The code below defines a [stats_on_column_obj] object type and creates a single table of this type [stats_on_column_tab].

    The function is supposed to take three input variables: p_schema_name, nom_table_p, p_column_name and return an array (above).

    I can hardcode a select into (the)... but once I try to convert it into settings & immediate exec I'm stuck. The red section is where the problem is (I think).

    Oracle 10g.

    Stats_on_column_obj CREATE TYPE IS OBJECT (

    COL_VAL VARCHAR2 (500),

    NUMBER OF COL_VAL_CNT (7)

    );

    CREATE TYPE Stats_on_column_tab IS TABLE OF stats_on_column_obj;


    FUNCTION to CREATE or REPLACE get_STATS_ON_COLUMN

    (

    p_schema_name IN varchar2,

    nom_table_p IN varchar2,

    p_column_name IN varchar2

    )

    RETURN STATS_ON_COLUMN_tab

    IS

    l_STATS_ON_COLUMN_tab STATS_ON_COLUMN_tab: = STATS_ON_COLUMN_tab ();

    n INTEGER: = 0;

    str_select_tbl varchar2 (5000);

    BEGIN

    str_select_tbl: = 'SELECT'. p_column_name |' as col_val, count (*) as col_val_cnt FROM ' | p_schema_name |'. ' || nom_table_p: ' group of ' | p_column_name;

    FOR r IN (str_select_tbl)

    LOOP

    l_STATS_ON_COLUMN_tab. EXTEND;

    n: = n + 1;

    l_STATS_ON_COLUMN_tab (n): = STATS_ON_COLUMN_obj (r.col_val, r.col_val_cnt);

    END LOOP;

    RETURN l_STATS_ON_COLUMN_tab;

    END;

    /

    [Error] PLS-00103 (124:4): PLS-00103: encountered the symbol "LOOP" when expecting one of the following numbers: * & - + / at rem rest mod.. < an exponent (*) > | multiset year DAY_

    [Error] PLS-00103 (126:9): PLS-00103: encountered the symbol "=" when expected in the following way: constant exception < an ID > < a between double quote delimited identifiers > double Ref table Fedya Chariot of time timestam

    [Error] PLS-00103 (127:29): PLS-00103: encountered the symbol "

    [Error] PLS-00103 (128:4): PLS-00103: encountered the symbol "END" when waiting for one of the following numbers: begin function package pragma procedure subtype type use < an ID > < a double quote delimited identifier > form

    SELECT * FROM TABLE (get_STATS_ON_COLUMN ('SCHEMAS_X', 'TABLE_X', 'COLUMN_X'));

    Scott@ORCL > CREATE OR REPLACE
    FUNCTION get_STATS_ON_COLUMN () 2
    3 p_schema_name IN varchar2,
    4 nom_table_p IN varchar2,
    5 p_column_name IN varchar2
    6                                )
    7 STATS_ON_COLUMN_tab of RETURN
    8 EAST
    9 v_STATS_ON_COLUMN_tab STATS_ON_COLUMN_tab: = STATS_ON_COLUMN_tab ();
    10 v_n INTEGER: = 0;
    11 v_str_select_tbl VARCHAR2 (5000);
    BEGIN 12
    13 v_str_select_tbl: = ' SELECT stats_on_column_obj (' | p_column_name |) ', Count OF ' |
    14 p_schema_name | '.' || nom_table_p | "Group of" | p_column_name;
    15 v_str_select_tbl EXECUTE IMMEDIATE
    COLLECTION IN BULK 16
    17 IN v_STATS_ON_COLUMN_tab;
    18 RETURN v_STATS_ON_COLUMN_tab;
    END 19;
    20.

    The function is created.

    Scott@ORCL > select *.
    2 from table)
    (3 get_STATS_ON_COLUMN)
    4                                            'SCOTT',
    5                                            'EMP',
    6                                            'JOB'
    7                                           )
    8                       )
    9.

    COL_VAL COL_VAL_CNT
    -------------------- -----------
    CLERK                          4
    SELLER 4
    PRESIDENT 1
    MANAGER 3
    ANALYST 2

    Scott@ORCL >

    Or better change function in the pipeline.

    SY.

  • How to create a dynamic lov inside the table?

    Hi all

    I use JDeveloper11.1.1.1.4.

    My scenario is that I have page with editable < af:table >. Table contains a < af:inputListOfValues > inside the column. I want to do this < af:inputListOfValues >

    as a dynamic. Because according to users, we have to get the chronogram different objects in different point of view. I tried with below link it works very well for forms.

    But editable tables, I'm not able to create the dynamic lov.

    ADF practice: dynamic linking LOV

    Thank you

    David.

    Hello David

    have you tried ADFbc lov switcher?

    See - Andrejus Baranovskis Blog: Groovy - multiple LOV by attribute in JDeveloper 11 g

    http://www.Oracle.com/technetwork/developer-tools/ADF/learnmore/89-adfbc-lov-switcher-454168.PDF

    Thank you

  • Dynamic LOV TO 6i tabular

    Hello
    I have in the form of two Items (ID, DESC) and I want to fill LOV for item (ID) all records
    and record_Group & the SQL statements are stored in DB.

    ACTION: request in get after QUERY Trigger for each record in a table - the stored SQL-statements of table then put it in the record_group dynamics and fill the dynamic LOV.



    Please advice,

    Thanks in advance.

    but in a times-news-record-instance, you can change the assigned lov

    If you have any 'column mapping"in your LOV you need to reproduce this for each new LOV. It would be simpiler to use the same LOV and the column mapping and simply change the Group of record used by the LOV for each record. You can use the Set_LOV_Property() built into the trigger once - new - Record - Instance.

    Craig...

  • using the dynamic SQL syntax

    I am trying to create a dynamic sql to execute the following statement:

    create the table mytbl_20100901 in select * from matbl double;

    When I try the following error I
    ORA-06550: line 6, column 10:
    PLS-00103: encountered the symbol "SELECT" at the expected in the following way:

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;
    declare
    sql_cmd varchar2 (1000);

    Start

    sql_cmd: = select "create table mytbl_ | To_char (sysdate, 'YYYYMMDD') | ' in select * from matbl ' double.

    immediately run sql_cmd;

    end;
    ;;;;;;;;;;;;;;;;;;;;;;;;;

    How to fix the sql_cmd assignment statement?

    Thank you.

    Hello

    user1035690 wrote:
    I am trying to create a dynamic sql to execute the following statement:

    create the table mytbl_20100901 in select * from matbl double;

    When I try the following error I
    ORA-06550: line 6, column 10:
    PLS-00103: encountered the symbol "SELECT" at the expected in the following way:

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;
    declare
    sql_cmd varchar2 (1000);

    Start

    sql_cmd: = select "create table mytbl_ | To_char (sysdate, 'YYYYMMDD') | ' in select * from matbl ' double.

    immediately run sql_cmd;

    end;
    ;;;;;;;;;;;;;;;;;;;;;;;;;

    How to fix the sql_cmd assignment statement?

    Thank you.

    The dual table is not necessary a lot in PL/SQL.
    You can simply say:

    sql_cmd := 'create table mytbl_' || TO_CHAR(sysdate, 'YYYYMMDD') || ' as select * from mytbl';
    dbms_output.put_line (sql_cmd || ' <= sql_cmd');
    -- EXECUTE IMMEDIATE sql_cmd;
    

    During the development of the dynamic SQL statements, I suggest that you post the command rather than run it first.
    When it seems correct, then a comment instructions EXECUTE IMMEDIATE.
    Before the Production code, remove or comment the call to out_line.

  • Error in SQL syntax when inserting data to the table in the form of values using insert record

    Hello

    I was hoping that someone could help me.  I am creating a form of registration on a website to insert data into a database table.  When you try to create the form, I get the following error:


    You have an error in your SQL syntax; consult the manual for your version of the MySQL server for the right syntax to use near ' VALUES (name, regno, reason) leave (has ', 1, 'dddd')' at line 1

    I checked the syntax, but you don't know what's wrong.

    I am running Windows 7 with Dw cs6 and wamp server.

    Leave with the names of column (name, regno, reason) is the name of the table.

    Thank you for your help and please help me.

    The code is as below:

    <? php require_once('Connections/connect.php');? >

    <? PHP

    If (! function_exists ("GetSQLValueString")) {}

    function GetSQLValueString ($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")

    {

    If (via PHP_VERSION < 6) {}

    $theValue = get_magic_quotes_gpc()? stripslashes ($TheValue): $theValue;

    }

    $theValue = function_exists ("mysql_real_escape_string")? mysql_real_escape_string ($TheValue): mysql_escape_string ($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 "set":

    $theValue = ($theValue! = "")? $theDefinedValue: $theNotDefinedValue;

    break;

    }

    Return $theValue;

    }

    }

    $editFormAction = $_SERVER ['PHP_SELF'];

    If (isset {}

    $editFormAction. = « ? ». htmlentities($_SERVER['QUERY_STRING']);

    }

    If ((isset($_POST["MM_insert"])) & & ($_POST ["MM_insert"] == "form1")) {}

    $insertSQL = sprintf ("INSERT INTO leave (name, regno, reason) VALUES (%s, %s, %s)',

    GetSQLValueString ($_POST ['name'], "text").

    GetSQLValueString ($_POST ['reg'], "int").

    GetSQLValueString ($_POST ['reason'], "text"));

    @mysql_select_db ($database_connect, $connect);

    $Result1 = mysql_query ($insertSQL, $connect) or die (mysql_error ());

    }

    ? >

    < ! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict / / IN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" > ""

    " < html xmlns =" http://www.w3.org/1999/xhtml ">

    < head >

    < meta http-equiv = "content-type" content = text/html"; charset = utf-8 "/ >"

    < title > online form let < /title >

    < name meta = "keywords" content = "" / > "

    < name meta = "description" content = "" / > "

    < link href = "styless.css" rel = "stylesheet" type = "text/css" media = "screen" / > "

    < / head >

    < body >

    < div id = 'wrapper' >

    < div id = "header" >

    < div id = 'menu' >

    < ul >

    < class li = "current_page_item" > < a href = "#" > home < /a > < /li >

    < li > < /li >

    < li > < /li >

    < li > < a href = "#" > on < /a > < /li >

    < li > < /li >

    < li > < a href = "#" > Contact < /a > < /li >

    < /ul >

    < / div >

    <!-end #menu->

    < div id = "Search" >

    < / div >

    <!-end #search->

    < / div >

    <!-end #header->

    < div id = "logo" >

    E - SCHOOL of CHRIST < h1 > < / h1 >

    < p > < / p >

    < / div >

    < hr / >

    <!-end #logo->

    <! - end #header - wrapper->

    < div id = "page" >

    < div id = "content" >

    < div class = "post" >

    < h2 class = "title" > leave application online < / h2 >

    < div class = "entry" > < / div >

    < / div >

    < do action = "<?" PHP echo $editFormAction;? ">" method = "POST" name = "form1" id = "form1" >

    < table width = "200" border = "2" cellspacing = "5" cellpadding = "5" >

    < b >

    < scope th 'row' = > name < /th >

    < td > < label for = "name" > < / label >

    < input type = "text" name = "name" id = "name" / > < table >

    < /tr >

    < b >

    < scope = "row" th > Reg No. < /th >

    < td > < label for = "reg" > < / label >

    < input type = "text" name = "reg" id = "reg" / > < table >

    < /tr >

    < b >

    < scope = "row" th > why < /th >

    < td > < label for = "reason" > < / label >

    < name textarea = 'reason' id = cols 'reason' = "45" rows = "5" > < / textarea > < table >

    < /tr >

    < b >

    < scope = "row" th > < /th >

    < td > < input type = "submit" name = "b1" id = "b1" value = "Submit" / > < table >

    < /tr >

    < /table >

    < input type = "hidden" name = "MM_insert" value = "form1" / >

    < / make >

    < / div >

    <!-end #content->

    < div id = "sidebar" >

    < ul >

    < li >

    Notice of < h2 > < / h2 >

    < p > students must present the appropriate documents supporting the reason for leave within 3 working days. < /p >

    < /li >

    < li id = "calendar" >

    Calendar < h2 > < / h2 >

    < div id = "calendar_wrap" >

    < table summary = "Calendar" >

    < caption >

    March 2014

    < / legend >

    < thead >

    < b >

    < th abbr = "Monday" scope = "col" title = "Monday" > M < /th >

    < th abbr = "Tuesday" scope = "col" title = "Tuesday" > T < /th >

    < th abbr = "Wednesday" scope = "col" title = "Wednesday" > W < /th >

    < th abbr = "Thursday" scope = "col" title = 'Thursday' > T < /th >

    < th abbr = "Friday" scope = "col" title = 'Friday' > F < /th >

    < th abbr = "Saturday" scope = "col" title = 'Saturday' > S < /th >

    < th abbr = "Sunday" scope = "col" title = 'Sunday' > S < /th >

    < /tr >

    < / thead >

    < tfoot >

    < b >

    < td abbr = "February" colspan = "3" id = "prev" > < a href = "#" title = "" > & laquo; Feb < /a > < table >

    < class td = "pad" > < table >

    < td abbr = "April" colspan = "3" id = "next" > < a href = "#" title = "" > Apr & raquo; < /a > < table >

    < /tr >

    < / tfoot >

    < tbody >

    < b >

    < td colspan = "5" class = "pad" > < table >

    < td > < table > 1

    < td > < table > 2

    < /tr >

    < b >

    < td > 3 < table >

    < td > < table > 4

    < td > 5 < table >

    < td > < table > 6

    < td > < table > 7

    < td > < table > 8

    < td > < table > 9

    < /tr >

    < b >

    < td > < table > 10

    < td id = 'today' > < table > 11

    < td > < table > 12

    < td > < table > 13

    < td > < table > 14

    < td > < table > 15

    < td > < table > 16

    < /tr >

    < b >

    < td > < table > 17

    < td > < table > 18

    < td > < table > 19

    < td > < table > 20

    < td > < table > 21

    < td > < table > 22

    < td > < table > 23

    < /tr >

    < b >

    < td > < table > 24

    < td > < table > 25

    < td > < table > 26

    < td > < table > 27

    < td > < table > 28

    < td > < table > 29

    < td > < table > 30

    < /tr >

    < b >

    < td > < table > 31

    < class td = "pad" colspan = "6" > < table >

    < /tr >

    < / tbody >

    < /table >

    < / div >

    < /li >

    < li > < /li >

    < /ul >

    < / div >

    <!-end #sidebar->

    < div style = "" clear: both; "> < / div >"

    < / div >

    <!-end #page->

    < div id = "footer" >

    < p > Copyright (c) University of Christ. All rights reserved. < /p >

    < / div >

    <!-end #footer->

    < / div >

    < div align = center > < / div > < / body >

    < / html >

    The LEAVE is a reserved word in MySQL. You can try to quote, but you are better to rename it.

  • Req SQL syntax. to extract the value XML [CLOB]

    Hello

    I'll have the XML column in my table.

    I have XML value in CLOB data type. I had an experience using extract XML from SQL syntax.

    But I am unable to extract this file. I need to meet tagname value XML who gave example below.

    For example, the name of the Table is A
    Column name is A1

    The value of column given below here.

    <? XML version = "1.0" encoding = "ISO-8859-1? > < tags > < tag > < tagname > {docval} < / tagname > < tagvalue > ESPRefNotice < / tagvalue > < / tag > < tag > < tagname > {: inputvalue} < / tagname > < tagvalue > 3216 < / tagvalue > < / tag > < tag > < tagname > {officename} < / tagname > < tagvalue > ssvofficename < / tagvalue > < / tag > < / tags >

    Kindly help me on this to extract the value 'tagname' or 'tagvalue' according to the above xml data.

    Thank you
    SELECT warehouse_name warehouse,
       warehouse2."Water", warehouse2."Rail"
       FROM warehouses,
       XMLTABLE('/Warehouse'
          PASSING warehouses.warehouse_spec
          COLUMNS
             "Water" varchar2(6) PATH '/Warehouse/WaterAccess',
             "Rail" varchar2(6) PATH '/Warehouse/RailAccess')
          warehouse2;
    

    check this exp in the documentation
    http://download.Oracle.com/docs/CD/B19306_01/server.102/b14200/functions228.htm#CIHGGHFB

    the warehouse_spec is of type xmltype. So in your case it is clob then you need to add like what I did in the query...
    XmlType ()...

    Hope that explains everything...

    Ravi Kumar

  • Error: you have an error in your SQL syntax; consult the manual for your version of the MySQL server for the right syntax to use near ')' at line 5

    Original title: how to solve this problem:

    System error

    You have an error in your SQL syntax; consult the manual for your version of the MySQL server for the right syntax to use near ')' at line 5

    Hi Roger,

    It seems that you have problems with the SQL syntax. The question you have posted is related to encoding and it would be better suited to the MSDN Community. Please report it in the community below.

    http://social.msdn.Microsoft.com/forums/SQLServer/en-us/home

    Hope this is useful.

  • Why do I get a SQL syntax; consult the manual for your version of the MySQL server for the proper syntax

    I have a purchase order where my buyers can add to my form. I use a loop that adds an extra line when they add a new product. I'm storing the information in two tables different mySQL. The first is alll of my personal, the second is the elements. My personal records correctly. However, I get the following error when you save the items:

    You have an error in your SQL syntax; consult the manual for your version of the MySQL server for the right syntax to use near 1, 'wer 2345', 1, 1)' on line 9

    The error occurred in E:\webs\clarkwebhosting.com\SSL\esrc\order_add.cfm on line 74

    ++ After storage of the personal information, I take the command ID to populate the table of Articles

    < cflock timeout = "5" >

    < name cfquery = "qGetorderID" datasource = "#application.dsn #" >

    Select max (orderID) as oid of orders

    < / cfquery >

    < / cflock >

    < cfoutput > < cfset getoid = #qGetorderID.oid # > < / cfoutput >

    ++ Is the loop that I use to fill the table items ++

    < cfloop to = "#form.numba # '1' = ' index 'idx' = >"

    < cfset getqty = evaluate ("form.qty" & idx) >

    < cfset getitem = evaluate ("form.item" & idx) >

    < cfset getunit = evaluate ("form.unit" & idx) >

    < cfset gettotal = evaluate ("form.total" & idx) >

    < name cfquery = "insertItems" datasource = "#application.dsn #" >

    INSERT in Articles

    (orderID,

    quantity,

    agenda,

    Unit,

    total

    )

    VALUES)

    < cfqueryparam value = "" #getoid # "CFSQLType ="CF_SQL_INTEGER">"

    < cfqueryparam value = "" #getqty # "CFSQLType ="CF_SQL_INTEGER">,"

    < cfqueryparam value = "" #getitem # "CFSQLType ="CF_SQL_VARCHAR">,"

    < cfqueryparam value = "" #getunit # "CFSQLType ="CF_SQL_INTEGER">,"

    < cfqueryparam value = "" #gettotal # "CFSQLType ="CF_SQL_INTEGER">"

    )

    < / cfquery >

    < / cfloop >

    This line: 1, 'wer' 2345, 1, 1 is the first element of the command line. Any ideas as to why it doesn't work? I use 5.5.9 - log CF9 and mySQL

    My apologies... that should have been (note the quotes)...

    In addition, it would be...

    On another note... You should probably avoid using cfinput and simply use the standard form tags.

  • aid is the sql syntax

    Nice day

    someone help me if I replace (: 1 to & var, nn: = 1, 2', null) and execute sql when type 1.2 the work entry. the problem, I'm not want to used & var I want the value of assiagn at nn block and nn pass its value to: 1 whendo he says


    Note dep_id is the number


    ORA-06502: PL/SQL: digital or value error: character of number conversion error




    declare
    type m is ref cursor;
    CUR m;
    txt varchar2 (500);
    number of mm;
    NN varchar2 (20);
    Start
    nn: = 1, 2';
    txt: = q'[select count (*) from employees where dep_id in(*:1*))]';
    run immediately txt in mm using nn ;
    dbms_output.put_line ('nn =' | mm);
    end;
    /

    For your condition is the easiest way

    SQL> set serverout on
    SQL> DECLARE
      2    type m is ref cursor;
      3    cur m;
      4    txt varchar2(500);
      5    mm  number;
      6    nn  varchar2(20);
      7  BEGIN
      8    nn  := '20,30';
      9    txt := 'select count(*) from emp where deptno in ('||nn||')';
     10    execute immediate txt
     11      into mm;
     12      --using nn;
     13    dbms_output.put_line('nn= ' || mm);
     14  END;
     15  /
    nn= 11
    
    PL/SQL procedure successfully completed.
    
    SQL> 
    

    However, if you want to implement varying IN history list and then completely different altogether. AskTom search for some examples.

  • Referring to the dynamic cursor rows and columns in SQL

    I have a procedure that dynamically reads a schema name and a table name in a table entry. The code must loop through all the rows and the columns in each table and the output data. I'm done with what I want to achieve 95%, but there is a little bug. The dbms_output.put(*col.column_name* ||) line '',''); ' ||
    return to something like rec.col.column_name , so that it is the column of the current record. Currently, it simply displays the name of the column for each record instead of the actual value. Can someone help me to change the code to get the real value?

    CREATE OR REPLACE PACKAGE BODY some_proc
    -Function and procedure implementations
    PROCEDURE create_files IS
    CURSOR c_tbls IS
    SELECT * FROM tbl_list;
    l_sql VARCHAR2 (4000);
    BEGIN
    -To loop through all the tables
    FOR tbl IN c_tbls LOOP
    l_sql: = "DECLARE" | «C_tbl_recs CURSOR IS» | ' SELECT * ' |. '
    'FROM ' | tbl.schema_name | '.' || tbl.table_name | '; ' ||
    ' t_tbl_rowtype c_tbl_recs % ROWTYPE; ' || "START" |
    "FOR rec IN c_tbl_recs LOOP |
    ' FOR col IN (SELECT column_name ' |)
    "FROM dba_tab_cols" |
    "Owner WHERE ="' | " tbl.schema_name | '''' ||
    ' AND table_name = "' | tbl.table_name | '''' ||
    ORDER BY column_id) LOOP '.
    *' dbms_output.put(col.column_name ||) '',''); ' || * "END OF LOOP; dbms_output.put_line('''); END LOOP; ' ||
    ' END; ';
    -dbms_output.put_line (l_sql);
    EXECUTE IMMEDIATE l_sql;
    END LOOP;
    EXCEPTION
    WHILE OTHERS THEN
    dbms_output.put_line (SQLERRM);
    END;
    END;

    Is this what you are looking for?
    (it took a few minutes)

    create or replace
    package some_proc is
    procedure create_files;
    end;
    /
    
    CREATE OR REPLACE
    PACKAGE BODY some_proc
    IS
      -- Function and procedure implementations
    PROCEDURE create_files
    IS
      CURSOR c_tbls
      IS
        SELECT * FROM tbl_list;
    
      CURSOR c_cols (p_table_owner VARCHAR2, p_table_name VARCHAR2)
      IS
        SELECT column_name
        FROM all_tab_columns
        WHERE owner   =p_table_owner
        AND table_name=p_table_name
        ORDER BY all_tab_columns.column_id;
    
      l_sql     VARCHAR2(32000);
    
      separator VARCHAR2(1):=';';
    
    BEGIN
      --Loop through all tables
      FOR tbl IN c_tbls
      LOOP
        dbms_output.put_line('TABLE: '||tbl.schema_name||'.'||tbl.table_name);
        l_sql := 'DECLARE ' ;
        l_sql := l_sql|| '  CURSOR c_tbl_recs IS ' ;
        l_sql := l_sql||'    SELECT * FROM ' || tbl.schema_name || '.' || tbl.table_name || '; ' ;
        l_sql := l_sql||'    linenr number:=1; ';
        l_sql := l_sql||'BEGIN ' ;
        l_sql := l_sql|| ' FOR rec IN c_tbl_recs LOOP ';
        FOR c IN c_cols(tbl.schema_name,tbl.table_name)
        LOOP
          l_sql:=l_sql ||' if linenr=1 then  dbms_output.put('''||c.column_name||''||separator||'''); end if; ' ;
        END LOOP;
        l_sql :=l_sql||'  dbms_output.put_line(''''); linenr:=linenr+1; ';
        FOR c IN c_cols(tbl.schema_name,tbl.table_name)
        LOOP
          l_sql:=l_sql ||' dbms_output.put(rec.'||c.column_name||'||'''||separator||'''); ' ;
        END LOOP;
        l_sql:=l_sql||'  end loop; ';
        l_sql:=l_sql||'  dbms_output.put_line(''''); ';
        l_sql:=l_sql||'  dbms_output.put_line(''''); ';
        l_sql:=l_sql||'end;';
        EXECUTE IMMEDIATE l_sql;
      END LOOP;
    EXCEPTION
    WHEN OTHERS THEN
      dbms_output.put_line(SQLERRM);
    END;
    END;
    /
    

Maybe you are looking for

  • Third party material does not work on iPad 2 Air

    I recently brought an iPad 2 Air, but it was found that some of my third-party devices do not work with it. I also own an iPad mini, so I try the equipment on the mini, it works. I've been worrying is that my iPad 2 Air was a problem of equipment cau

  • Pavilion g6-2333el: g6-2333 el Pavilion RAM slot does not

    Hi, I recently decided to update RAM of my Paviliion g6-2333el by adding a second 4 GB of RAM. I inserted the new RAM in the RAM secondary housing, but the PC seemed unable to find. Fearing that I might you bought a RAM that was not compatible with m

  • The call to phone after update 9.2

    I was unable to do a phone call last night after iOS 9.2 update.  The call started out as usual, but there was no ringing sound.  Connection clock started after a few seconds, but nothing can be heard by the other end.  After a few tent, a call gave

  • Impossible to install windows updateKB2656353 and KB2656370-get error code: 0 x 80070643 (0 x 643)

    Original title: Windows updates will not be installed. Cannot install updates of security Windows KB2656353 and KB2656370 on Windows XP Home Edition version 2002 Service Pack 3.  Get the error code 80070643 0 x (0 x 643).  Installed Wiindows install

  • Validity Sensor

    I just got an error a yellow triangle against a validity sensor (WBF) (PID = 0050) when I click to updte it tells me that the best version is already installed. I have a HP Envy laptop running Windows 8.1