Anonymous PL/SQL . Illegal variable Name/number.

Hi
I have tested ODP.NET in ASP.NET for upload images. But when read back from DB then save image to local drive. When I tested given sample code working fine. But when I modify code only select statment in PL/SQL it gives error.
Following statment is the error. Illegal variable Name/number. Pl.
advice me what need to change.
Dim block As String = " BEGIN " & _
" SELECT Ad_Image into :2 from Printmedia WHERE Product_ID = " + ProdID + ";" & _
" end ;"

You use bind variables. Great!
And then you do not use bind variables. Bummer!!
Why can you make the output from the SQL a bind variable, but you do not supply Product ID as a bind variable? This causes a unique and non-sharable SQL statement in the SQL Shared Pool. Where the emphasis is very obvious - shared SQL.
The definition should be something like this:
Dim block As String = "BEGIN SELECT Ad_Image into :1 from Printmedia WHERE Product_ID = :2; END;"But why are you using an anonymous PL/SQL block and a bind variable to get to the image? Deal with it as a cursor. Much easier. E.g.
Dim cursorSQL As String = "SELECT Ad_Image FROM Printmedia WHERE Product_ID = :1"Open the cursor. And there you have the resulting image column as a result.

Similar Messages

  • External table and error: ORA-01036: illegal variable name/number

    using the following script I get the referenced error:
    create table dol_sch_c_part2
    (DLN NUMBER(14) ,
    PAGE_ID VARCHAR2(20),
    PAGE_SEQ VARCHAR2(20),
    PAGE_ROW_NUM VARCHAR2(20),
    ROW_NUM VARCHAR2(20),
    IMAGE_FORM_ID VARCHAR2(20),
    PROVIDER_TERM_01_NAME VARCHAR2(35),
    PROVIDER_TERM_01_EIN VARCHAR2(9) ,
    PROVIDER_TERM_01_POSITION VARCHAR2(25),
    PROVIDER_TERM_01_STR_ADDRESS VARCHAR2(35),
    PROVIDER_TERM_01_CITY VARCHAR2(20),
    PROVIDER_TERM_01_STATE VARCHAR2(2),
    PROVIDER_TERM_01_ZIP_CODE VARCHAR2(9),
    PROVIDER_TERM_01_PHONE_NUM VARCHAR2(10),
    PROVIDER_TERM_01_TEXT VARCHAR2(250)
    ORGANIZATION EXTERNAL
    ( type oracle_loader
    default directory data_dir
    access parameters
    RECORDS FIXED 510
    FIELDS
    DLN(1:14) char(14),
    PAGE_ID(15:34) char(20) NULLIF PAGE_ID=BLANKS,
    PAGE_SEQ(35:54) char(20) NULLIF PAGE_SEQ=BLANKS,
    PAGE_ROW_NUM(55:74) char(20) NULLIF PAGE_ROW_NUM=BLANKS,
    ROW_NUM(75:94) char(20) NULLIF ROW_NUM=BLANKS,
    IMAGE_FORM_ID(95:114) char(20) NULLIF IMAGE_FORM_ID=BLANKS,
    PROVIDER_TERM_01_NAME(115:149) char(35) NULLIF PROVIDER_TERM_01_NAME=BLANKS,
    PROVIDER_TERM_01_EIN(150:158) char(9) NULLIF PROVIDER_TERM_01_EIN=BLANKS,
    PROVIDER_TERM_01_POSITION(159:183) char(25) NULLIF PROVIDER_TERM_01_POSITION=BLANKS,
    PROVIDER_TERM_01_STR_ADDRESS(184:218) char(35) NULLIF PROVIDER_TERM_01_STR_ADDRESS=BLANKS,
    PROVIDER_TERM_01_CITY(219:238) char(20) NULLIF PROVIDER_TERM_01_CITY=BLANKS,
    PROVIDER_TERM_01_STATE(239:240) char(2) NULLIF PROVIDER_TERM_01_STATE=BLANKS,
    PROVIDER_TERM_01_ZIP_CODE(241:249) char(9) NULLIF PROVIDER_TERM_01_ZIP_CODE=BLANKS,
    PROVIDER_TERM_01_PHONE_NUM(250:259) char(10) NULLIF PROVIDER_TERM_01_PHONE_NUM=BLANKS,
    PROVIDER_TERM_01_TEXT(260:509) char(250) NULLIF PROVIDER_TERM_01_TEXT=BLANKS
    location ('f_dol_sch_c_part2.txt')
    I've tried it with and without the char(*) in the fields section - no change
    thanks

    *** SCRIPT START : Session:GLEN_SELF@RAMBO(8) 8/31/2006 12:16:48 PM ***
    Processing ...
    create or replace directory data_dir as 'c:\dol\'
    create table dol_sch_c_part2
    (DLN NUMBER(14) ,
    PAGE_ID VARCHAR2(20),
    PAGE_SEQ VARCHAR2(20),
    PAGE_ROW_NUM VARCHAR2(20),
    ROW_NUM VARCHAR2(20),
    IMAGE_FORM_ID VARCHAR2(20),
    PROVIDER_TERM_01_NAME VARCHAR2(35),
    PROVIDER_TERM_01_EIN VARCHAR2(9),
    PROVIDER_TERM_01_POSITION VARCHAR2(25),
    PROVIDER_TERM_01_STR_ADDRESS VARCHAR2(35),
    PROVIDER_TERM_01_CITY VARCHAR2(20),
    PROVIDER_TERM_01_STATE VARCHAR2(2),
    PROVIDER_TERM_01_ZIP_CODE VARCHAR2(9),
    PROVIDER_TERM_01_PHONE_NUM VARCHAR2(10),
    PROVIDER_TERM_01_TEXT VARCHAR2(250)
    ORGANIZATION EXTERNAL
    ( type oracle_loader
    default directory data_dir
    logfile 'ext_tab.log'
    access parameters
    RECORDS FIXED 510
    FIELDS
    DLN(1:14),
    PAGE_ID(15:34),
    PAGE_SEQ(35:54),
    PAGE_ROW_NUM(55:74),
    ROW_NUM(75:94),
    IMAGE_FORM_ID(95:114),
    PROVIDER_TERM_01_NAME(115:149),
    PROVIDER_TERM_01_EIN(150:158),
    PROVIDER_TERM_01_POSITION(159:183),
    PROVIDER_TERM_01_STR_ADDRESS(184:218),
    PROVIDER_TERM_01_CITY(219:238),
    PROVIDER_TERM_01_STATE(239:240),
    PROVIDER_TERM_01_ZIP_CODE(241:249),
    PROVIDER_TERM_01_PHONE_NUM(250:259),
    PROVIDER_TERM_01_TEXT(260:509)
    location ('f_dol_sch_c_part2.txt')
    create or replace directory data_dir as 'c:\dol\'
    ORA-01036: illegal variable name/number
    *** Script stopped due to error ***
    *** SCRIPT END : Session:GLEN_SELF@RAMBO(8) 8/31/2006 12:16:49 PM ***

  • Oracle 11G and SqlDataSource: 'ORA-01036: illegal variable name/number'

    [Resolved - http://forums.oracle.com/forums/thread.jspa?messageID=2366331&#2366331]
    I've created a short video to explain my problem with Oracle and SqlDataSource. If you'd rather watch than read, go see the video at http://www.kencox.ca/video/oracelandsqldatasource.html.
    I'm trying to do some extremely simple drag and drop development in Visual Web Developer 2008 with the Oracle 11g database and ODP.NET. According to Oracle, "The data provider can be used with the latest .NET Framework 3.5 version. "
    The SELECT statement works fine, but any attempt to use UPDATE via the SQLDataSource UpdateCommand nets me the infamous 'ORA-01036: illegal variable name/number' error.
    I wouldn't mind using one of my MSDN Support Incidents to have Microsoft take a look at this issue, but I'm not sure the problem is Microsoft's. It seems like Oracle is doing a poor job in its Visual Studio integration.
    Question: Has anyone successfully used an UpdateCommand statement in SQLDataSource against Oracle 11g? If so, let me know!
    Below, you see the entire code as generated in Visual Web Developer 2008. To see it in action, check the video at http://www.kencox.ca/video/oracelandsqldatasource.html.
    Ken
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <title>Untitled Page</title>
    </head>
    <body>
    <form id="form1" runat="server">
    <div>
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
    DataSourceID="SqlDataSource1"
    EmptyDataText="There are no data records to display.">
    <Columns>
    <asp:CommandField ShowEditButton="True" />
    <asp:BoundField DataField="ACCOUNTID" HeaderText="ACCOUNTID"
    SortExpression="ACCOUNTID" />
    <asp:BoundField DataField="ACCOUNTNAME" HeaderText="ACCOUNTNAME"
    SortExpression="ACCOUNTNAME" />
    <asp:BoundField DataField="ACCOUNTLOCATION" HeaderText="ACCOUNTLOCATION"
    SortExpression="ACCOUNTLOCATION" />
    <asp:BoundField DataField="ACCOUNTPHONE" HeaderText="ACCOUNTPHONE"
    SortExpression="ACCOUNTPHONE" />
    <asp:BoundField DataField="ACCOUNTCONTACT" HeaderText="ACCOUNTCONTACT"
    SortExpression="ACCOUNTCONTACT" />
    <asp:BoundField DataField="ACCOUNTWEBSITE" HeaderText="ACCOUNTWEBSITE"
    SortExpression="ACCOUNTWEBSITE" />
    </Columns>
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server"
    ConnectionString="<%$ ConnectionStrings:ConnectionString1 %>"
    ProviderName="<%$ ConnectionStrings:ConnectionString1.ProviderName %>"
    SelectCommand="SELECT "ACCOUNTID", "ACCOUNTNAME", "ACCOUNTLOCATION", "ACCOUNTPHONE", "ACCOUNTCONTACT", "ACCOUNTWEBSITE" FROM "ACCOUNTS""
    UpdateCommand="UPDATE ACCOUNTS SET ACCOUNTLOCATION = 'This Place' WHERE (ACCOUNTID = 4)">
    </asp:SqlDataSource>
    </div>
    </form>
    </body>
    </html>//////////using System;
    using System.Collections;
    using System.Configuration;
    using System.Data;
    using System.Linq;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Xml.Linq;
    public partial class _Default : System.Web.UI.Page
    protected void Page_Load(object sender, EventArgs e)
    Message was edited by:
    kjopc

    Ken,
    One thing to be aware of is Microsoft has produced Visual Studio database tools and data provider for Oracle. In addition, Oracle has produced its own tools. Knowing which products you are using is important because you want to know which company you should be complaining about. :-)
    In your video, you are using all Microsoft tools and data provider, not Oracle's.
    I would recommend using Oracle Developer Tools (ODT) for VS and ODP.NET since these products are much better integrated with .NET and Oracle.
    ODP.NET uses Oracle.DataAccess.Client namespace. System.Data.OracleClient belongs to the MS provider for Oracle, which Mark pointed out. If you drag and drop DB objects using ODT, it will generate ODP.NET code for you (and give you more data source wizard options as well).
    You can download the latest 11g version of ODP.NET and ODT here:
    http://www.oracle.com/technology/software/tech/windows/odpnet/index.html
    These support .NET 3.5 and VS 2008.

  • Need help with ora-01036  illegal variable name/number

    Can you help me fix the following problem.
    I'm getting an oracle exceptioin while running the following.
    OracleParameter[] myParameters = new OracleParameter[] { new OracleParameter("SELECTEDREGIONS", OracleDbType.RefCursor, ParameterDirection.Output) };
    XmlReader xRdr = oraclehelper.ExecuteXmlReader(myConnection,CommandType.StoredProcedure,"TEST_TESTPACKAGE.TEST_GETREGIONS_SP",myParameters);
    the oracle helper function is
    public XmlReader ExecuteXmlReader(OracleConnection inConnection,
    CommandType inCommandType,
    string inCommandText,
    params OracleParameter[] inCommandParameters)
    //create a command and prepare it for execution
    OracleCommand cmd = new OracleCommand(inCommandText,inConnection);
    cmd.CommandType = inCommandType;
    if (inCommandParameters != null)
    foreach (OracleParameter op in inCommandParameters)
    cmd.Parameters.Add(op);
    cmd.BindByName = true;
    cmd.XmlCommandType = OracleXmlCommandType.Query;
    cmd.XmlQueryProperties.RootTag = "Result";
    cmd.XmlQueryProperties.RowTag = "Row";
    if (cmd.Connection.State != ConnectionState.Open) cmd.Connection.Open();
    XmlReader retval = null;
    //create the DataAdapter & DataSet
    retval = cmd.ExecuteXmlReader();
    // detach the OracleParameters from the command object, so they can be used again.
    cmd.Parameters.Clear();
    return retval;
    The stored proc is:
    CREATE OR REPLACE package GJUTRAS.test_TestPackage AS
    type sregions is REF CURSOR;
    procedure test_GetRegions_sp
    selectedregions out sregions
    procedure test_GetRegByDescrip_sp
    descript in varchar2,
    selectedregions out sregions
    end test_TestPackage;
    CREATE OR REPLACE package body GJUTRAS.test_TestPackage AS
    procedure test_GetRegions_sp
    selectedregions out sregions
    is
    begin
    open selectedregions for
    select * from ods.region;
    end test_GetRegions_sp;
    procedure test_GetRegByDescrip_sp
    descript in varchar2,
    selectedregions out sregions
    is
    begin
    open selectedregions for
    select * from ods.region where description = descript;
    end test_GetRegByDescrip_sp;
    end test_TestPackage;
    /

    The versions of the function that use text "select * from ods.region" work fine. It's using a stored procedure with ExecuteXmlReader that I can't seem to get working. The table is
    CREATE TABLE REGION (
    ID NUMBER(10) NOT NULL,
    CODE VARCHAR2(100 BYTE),
    ABBREV VARCHAR2(100 BYTE),
    NAME VARCHAR2(500 BYTE),
    EXTRA_FIELDS_ID NUMBER(10) NOT NULL,
    ACTIVE_FLAG VARCHAR2(1 BYTE) NOT NULL,
    DESCRIPTION VARCHAR2(4000 BYTE),
    COMMENTS VARCHAR2(4000 BYTE),
    KEYWORDS VARCHAR2(4000 BYTE),
    CHNG_REASON_TYPE_ID NUMBER(10),
    CHNG_REASON_CMNT VARCHAR2(4000 BYTE),
    BEG_DATE DATE NOT NULL,
    BEG_USER_ID NUMBER(10) NOT NULL,
    CREATOR_ID NUMBER(10) NOT NULL,
    CREATION_DATE DATE NOT NULL )

  • Query Errors:  ORA-01036: illegal variable name/number

    Hi All,
    When I run a query against two tables within our data warehouse I am getting an IO Exception. Due to company restrictions I can't quickly increase my IO Limit So what I have done is written a query that cycles through all of the large tables partitions and extracts the data.
    The problem I get is that when I run this query in Toad. It thinks my :MI, :SS are variables and wont run this. Does anyone know what I can do to resolve this issue?
    create table completion_log
      action_complate_dt        date,
      table_name                   varchar2(1000),
      partition_number            varchar2(1000)
    nologging
    compress ;
    create table  STORE_DATA_HERE
      field_1                varchar2(1000),
      field_2                date,
      field_3                varchar2(1000)
    nologging
    compress ;
    commit;
    begin
       for ptn in (select partition_name p from all_tab_partitions t where table_name='REALLY_LARGE_TABLE')
       loop
          execute immediate q'^
          insert /*+ APPEND */ into STORE_DATA_HERE
            SELECT  field_1,
                    field_2,
                    field_3      
              FROM  REALLY_LARGE_TABLE partition (^'||ptn.p||q'^)
             WHERE  field_3 IN (  'XXXX',  'YYYY')
                    AND data_date BETWEEN TO_DATE('07/12/2011 00:00:00', 'DD/MM/YYYY HH24:MI:SS')
                            AND TO_DATE('08/12/2011 23:59:59', 'DD/MM/YYYY HH24:MI:SS')
          ^';
         insert into completion_log values (sysdate,'STORE_DATA_HERE',ptn.p);
         commit;
       end loop;
    end;

    In your case it is quite easy...
    just remove the collons from the format and the literal...and off you go
    begin
       for ptn in (select partition_name p from all_tab_partitions t where table_name='REALLY_LARGE_TABLE')
       loop
          execute immediate q'^
          insert /*+ APPEND */ into STORE_DATA_HERE
            SELECT  field_1,
                    field_2,
                    field_3      
              FROM  REALLY_LARGE_TABLE partition (^'||ptn.p||q'^)
             WHERE  field_3 IN (  'XXXX',  'YYYY')
                    AND data_date BETWEEN TO_DATE('07/12/2011 000000', 'DD/MM/YYYY HH24MISS')
                            AND TO_DATE('08/12/2011 235959', 'DD/MM/YYYY HH24MISS')
          ^';
         insert into completion_log values (sysdate,'STORE_DATA_HERE',ptn.p);
         commit;
       end loop;
    end;

  • SP2-0553: Illegal variable name "#25340;音字&#22411"

    hi..
    how to Insert Japanese language in oracle table
    if i'm inserting French it inserted succesfully
    if i'm inserting Japanese i'm getting these error
    ' SP2-0553: Illegal variable name "#25340;&#38899;&#23383;&#22411". '
    my DB setting is
    Character set -> utf-8
    NLS_LANG -> AMERICAN
    NLS_TERRITORY - > AMERICA
    Thanks
    Venkataraman.L

    Hi,
    What tool are you using to insert the data?
    It can be difficult to perform inserts of multi-byte data using SQL*Plus and standard INSERT statements because of character mapping between the OS and SQL*Plus. I've had success with SQL*Loader, perl, and Java.
    Regards,
    Rob

  • Anonymous PL/SQL vs procedure inside package

    It's probably quite simple problem but I'm not able to figure it out.
    If I make an anonymous PL/SQL block
    declare
    l_counter number(4);
    begin
    SELECT *
    into l_counter
    FROM (SELECT count(*)
    FROM SYS.all_objects
    WHERE owner IN ('USER1', 'USER2')
    AND object_type IN ('TABLE', 'VIEW')
    minus
    SELECT count(*)
    FROM SYS.dba_tab_privs
    WHERE grantee = 'TESTERS');
    DBMS_OUTPUT.PUT_LINE(l_counter);
    end;
    then it works. The result is 2 which is correct because select statement returns 2 rows.
    If I make procedure with the same code
    create or replace PROCEDURE grant_privileges2
    IS
    l_counter NUMBER (4);
    BEGIN
    SELECT COUNT (*)
    INTO l_counter
    FROM (SELECT owner, object_name
    FROM SYS.all_objects
    WHERE owner IN ('USER1', 'USER2')
    AND object_type IN ('TABLE', 'VIEW')
    MINUS
    SELECT owner, table_name
    FROM SYS.dba_tab_privs
    WHERE grantee = 'TESTERS);
    DBMS_OUTPUT.put_line (l_counter);
    END;
    result is 0 which is not correct becuase select statement is the same as in anonymous pl/sql and it has to return 2 rows.
    What I'm doing wrong?

    If the queries are the same then it works for me...
    SQL> ed
    Wrote file afiedt.buf
      1  declare
      2  l_counter number(4);
      3  begin
      4  SELECT *
      5  into l_counter
      6  FROM (SELECT count(*)
      7  FROM SYS.all_objects
      8  WHERE owner IN ('CRISP_ADMIN', 'CRISP_INTELL')
      9  AND object_type IN ('TABLE', 'VIEW')
    10  minus
    11  SELECT count(*)
    12  FROM SYS.dba_tab_privs
    13  WHERE grantee = 'SYSTEM');
    14  DBMS_OUTPUT.PUT_LINE(l_counter);
    15* end;
    SQL> /
    431
    PL/SQL procedure successfully completed.
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace procedure mytest is
      2  l_counter number(4);
      3  begin
      4  SELECT *
      5  into l_counter
      6  FROM (SELECT count(*)
      7  FROM SYS.all_objects
      8  WHERE owner IN ('CRISP_ADMIN', 'CRISP_INTELL')
      9  AND object_type IN ('TABLE', 'VIEW')
    10  minus
    11  SELECT count(*)
    12  FROM SYS.dba_tab_privs
    13  WHERE grantee = 'SYSTEM');
    14  DBMS_OUTPUT.PUT_LINE(l_counter);
    15* end;
    SQL> /
    Procedure created.
    SQL> exec mytest;
    431
    PL/SQL procedure successfully completed.

  • SQL XML Variable Assignment?

    Maybe more of a code question, but used in B1i. Using the B1out type="sql" how do I assign the return value of:
    Select CardCode From [OCDR] Where U_CSTN = <xsl:value-of select="col[8]"/>
    to a xml variable? Maybe a simple question but I am having issues using the return value that I need in a B1out type="object" in the same atom.
    All responses deeply appreciated,
    Mike
    <xsl:template name="transform">
         <b1im_multimsg xmlns="">
                       <xsl:for-each select="$msg/row">
                   <b1im_msg>
                        <B1out type="sql">
                             <xsl:variable name="Code">
                                  <sql>Select CardCode From [OCRD] Where U_DTNCN = <xsl:value-of select="col[8]"/></sql>
                             </xsl:variable>
                        </B1out>
                        <B1out type="object">
                             <Documents>
                                  <row>
                                       <CardCode>
                                            <xsl:copy-of select="$Code"/>
                                       </CardCode>
                                  </row>
                             </Documents>
                             <Document_Lines>
                                  <row>
                                       <ItemCode>
                                            <xsl:value-of select="col[2]"/>
                                       </ItemCode>
                                       <Quantity>
                                            <xsl:value-of select="col[3]"/>
                                       </Quantity>
                                  </row>
                             </Document_Lines>
                        </B1out>
                   </b1im_msg>
              </xsl:for-each>
         </b1im_multimsg>
    </xsl:template>

    I has an immediate suspicion it might be related to the issue
    mentioned in
    http://otn.oracle.com/support/tech/sql_plus/htdocs/sub_var2.html#2_7
    but this proved wrong: the SP2-306 still occurs in the latest
    SQL*Plus.
    I wonder what version of 8i you had working? With an old SQL*Plus
    8.1.7.0 my connection failed the same as in 9.2 and 10i.
    My solution was to do:
      SQLPLUS='sqlplus -s'
      UNPW='/ as sysdba'
      $SQLPLUS "$UNPW" &lt;&lt;EOF
      EOFThis worked in 9.2.0.5, 10.1.0.2 and 8.1.7.0.
    One common security risk on UNIX remains: putting the username and
    password on the command line. On some systems a "ps" command will
    show the password to any user. If OS authentication cannot be used
    for connection, perhaps putting the username/password in the SQL
    script may be more secure?
    A final note is that in SQL*Plus 10g, no quotes are needed around
    AS SYSDBA, i.e.
      sqlplus / as sysdba works from the OS prompt, whereas in 9.2 you need to do
      sqlplus "/ as sysdba"This makes a solution easy:
      SQLPLUS="/usr/oracle/product/10.1.0/bin/sqlplus -s xxx/xxxxxx@xxxx as sysdba"-- CJ

  • Obtain string of IN variable name in PL/SQL

    Hi,
    Odd question. Is there a way to access an IN variable's object name in a procedure?
    eg.
    procedure (var1    IN VARCHAR2(6),
                    var2    IN VARCHAR2(6),
                    var3    IN VARCHAR2(6))
    IS....You run this procedure and pass in parameters of:
    var1 => 'abcdef',
    var2 => 'defghi',
    var3 => 'ghikjl';
    In the code, I want to access the number in the string of the +variable name: var1+
    In a naive sense,
    num_of_in_var := substr(var1, 4,1) would be what i was hoping to achieve, but,
    var1 is set to 'abcdef' so,
    num_of_in_var := substr(var1, 4,1) would return 'd'.
    Any thoughts?
    Thanks
    Edited by: chris001 on Nov 20, 2012 1:16 PM

    Here's an example of how (what you want to do using a procedure or function), can be done using a ADT/UDT (Advance/User Defined Type) in Oracle.
    This approach will not work for standard procedures and functions as this type of dynamic referencing of the code unit/object to itself, is not possible.
    SQL> create or replace type TSomeObject as object(
      2          name    varchar2(10),
      3          id      integer,
      4          day     date,
      5 
      6          member function PropertyByNumber( n integer ) return varchar2
      7  );
      8  /
    Type created.
    SQL>
    SQL> create or replace type body TSomeObject as
      2 
      3          member function PropertyByNumber( n integer ) return varchar2 is
      4                  PLSQL_PROP_GET  constant varchar2(1000) :=
      5                          'declare
      6                                  obj     TSomeObject;
      7                          begin
      8                                  obj := :1;
      9                                  :2 := to_char( obj.#PROPERTY# );
    10                          end;';
    11 
    12                  type            TStrings is table of varchar2(30);
    13                  property        TStrings;
    14                  dynamicBlock    varchar2(1000);
    15                  res             varchar2(4000);
    16          begin
    17                  select
    18                          a.attr_name bulk collect into property
    19                  from    user_type_attrs a
    20                  where   a.type_name = 'TSOMEOBJECT'
    21                  order by
    22                          a.attr_no;
    23 
    24                  dynamicBlock := replace( PLSQL_PROP_GET, '#PROPERTY#', property(n) );
    25                  execute immediate dynamicBlock
    26                  using   in self,
    27                          out res;
    28 
    29                  return( res );
    30          end;
    31 
    32  end;
    33  /
    Type body created.
    SQL>
    SQL> declare
      2          obj     TSomeObject;
      3  begin
      4          obj := new TSomeObject( 'John Doe', 123, trunc(sysdate) );
      5 
      6          for i in 1..3 loop
      7                  dbms_output.put_line( 'property '||i||'='||obj.PropertyByNumber(i) );
      8          end loop;
      9  end;
    10  /
    property 1=John Doe
    property 2=123
    property 3=2012/11/23 00:00:00
    PL/SQL procedure successfully completed.
    SQL> Simplistic example (the PropertyByNumber could be a static class method defined in the abstract parent class) - and one that requires the object to essentially duplicate itself via a bind variable call to dynamic code. Not really the best of approaches, but demonstrates the flexibility (to do even interestingly weird stuff) in PL/SQL.

  • Bug in PL/SQL - Does not update Table if table name & variable name same in

    Dear All,
    If tabale name & vairable name is same in a Stored Procedure, UPDATE to table does not take place.
    For example run following 2 procedures. First procedure does the insert properly to table but second procedure does not update the table.
    create or replace procedure BugDemo1
    as
    LAST_NAME VARCHAR2(30);
    FIRST_NAME VARCHAR2(30);
    Begin
    LAST_NAME := 'Prasad';
    FIRST_NAME := 'Raghnandan';
    Insert into com_people (id,Roles, LAST_NAME, FIRST_NAME) values (77777,'Patient', LAST_NAME, FIRST_NAME);
    end;
    create or replace procedure BugDemo2
    as
    LAST_NAME VARCHAR2(30);
    FIRST_NAME VARCHAR2(30);
    Begin
    LAST_NAME := 'Pra';
    FIRST_NAME := 'Raghu';
    Update com_people set
    LAST_NAME = LAST_NAME,
    FIRST_NAME = FIRST_NAME
    where id = 77777 ;
    end;
    ------------------------------------------

    Hi,
    It is not a bug. Oracle is updating the records. Here Oracle is treating the variable name as COLUMN_NAME. Since priority is higher for a COLUMN on variable so each column is getting updated by itself resulting no change in data.
    SQL> CREATE TABLE com_people
      2  (
      3  id NUMBER (5),
      4  Roles VARCHAR2(20),
      5  LAST_NAME  VARCHAR2(20),
      6  FIRST_NAME VARCHAR2(20)
      7  )
      8  ;
    Table created
    SQL> Insert into com_people (id,Roles, LAST_NAME, FIRST_NAME) values (77777,'Patient', 'LAST_NAME', 'FIRST_NAME');
    1 row inserted
    SQL> COMMIT;
    Commit complete
    SQL>
    SQL> create or replace procedure BugDemo2
      2  as
      3  LAST_NAME VARCHAR2(20);
      4  FIRST_NAME VARCHAR2(20);
      5  Begin
      6  LAST_NAME := 'Pra';
      7  FIRST_NAME := 'Raghu';
      8 
      9  Update com_people set
    10  LAST_NAME = LAST_NAME,
    11  FIRST_NAME = FIRST_NAME
    12  where id = 77777 ;
    13 
    14  DBMS_OUTPUT.PUT_LINE('UPDATED ROWS ='||SQL%ROWCOUNT);
    15  end;
    16  /
    Procedure created
    SQL> set serveroutput on
    SQL> execute BugDemo2;
    UPDATED ROWS =1
    PL/SQL procedure successfully completed
    SQL> Regards

  • [[DataDirect][ODBC SQL Server Wire Protocol driver][Microsoft SQL Server]Column name or number of supplied values does not match table definition.]

    Hii ..
    need help on this ..
    This what I am doing ..
    I am using a DATAEXPORT function to export level0 data from my essbase 11.1.2.2 to Microsoft SQL 2008 tables.
    So what I did first I exported the level0 data to a flat file using DATAEXPORT and the created the SQL columns by the same  in that order only in my SQL table.
    When I run it fails with this error:
    ODBC Layer Error: [21S01] ==> [[DataDirect][ODBC SQL Server Wire Protocol driver][Microsoft SQL Server]Column name or number of supplied values does not match table definition.]
    [Tue Jul 23 18:26:07 2013]Local/dataexp/dataexp/admin@Native Directory/1209813312/Info(1021014)
    ODBC Layer Error: Native Error code [213]
    [Tue Jul 23 18:26:07 2013]Local/dataexp/dataexp/admin@Native Directory/1209813312/Error(1012085)
    Unable to export data to SQL table [dataexp]. Check the Essbase server log and the system console to determine the cause of the problem.
    [Tue Jul 23 18:26:07 2013]Local/dataexp/dataexp/admin@Native Directory/1209813312/Info(1021002)
    SQL Connection is Freed
    [Tue Jul 23 18:26:07 2013]Local/dataexp/dataexp/admin@Native Directory/1209813312/Warning(1080014)
    Transaction [ 0x1c50001( 0x51ee7d66.0x80342 ) ] aborted due to status [1012085].
    [Tue Jul 23 18:26:07 2013]Local/dataexp/dataexp/admin@Native Directory/1209813312/Info(1012579)
    Total Calc Elapsed Time for [test.csc] : [1.44] seconds
    =============================================================
    I did a simple test on my Sample.basic application then ..
    loaded the calc data to it and then used the below script to export to a flat file
    //ESS_LOCALE English_UnitedStates.Latin1@Binary
    SET DATAEXPORTOPTIONS
                    DataExportLevel "Level0";
                    DataExportOverwriteFile ON;
                    DataExportColFormat OFF;
                    DataExportDimHeader OFF;
    FIX(
                "Jan",
                "Sales",
                "Actual"
    /*DATAEXPORT "File" "," "/home/hypadmin/samtest.txt";*/
    DATAEXPORT "DSN" "Abhitest" "sample" "sa" "welcome1";
    ENDFIX
    out put as below:
    "Sales"
    "100-30","California"
    "Jan","Actual",145
    Now In sql I created only 3 columns with name Jan/Sales/Actual and when I run this script again with comments removed .. I get the same error as what I have got in my first test case with other application ..
    but when I create the columns with same name as what its in export
    Sales/100-30/Califirnia/Jan/Actual
    It created the new rows successfully ..
    So with this I think the error which I am getting with my other application might be because of the same column issue  .. but then I have created all the columns by looking at the export file only as I did in sample ..
    Any idea would be helpful ..
    Thanks
    Abhishek
    I

    First make sure you add
    DataExportRelationalFile ON;
    to your set commands it is missing
    I alwats like to also add
    DataExportColHeader dimensionName;
    so I am sure what dimension is getting put into the columns.
    Then count the number of dimensions in your outline (exclude attribute dimensions). You need at least that many columns in your table  -1 + the number of  members you will be returning as columns in the export
    Taking your example Sample basic has 5 dimensions
    Measures
    Years
    Scenario
    Product
    Market
    Since you did not specify a dataexportcolheader it took the dense dimension Scenario as the columns. Your fix statement is limiting that to one member. Doing the math
    5 -1 + 1 = 5 columns in your table which is what you found works.  Suppose you fixed on bothe Actual and budget in scenario then you would need 6 columns 5 -1 +2

  • SQL Server 2012 Management Studio: Import XML File to SQL Table - XML parsing: illegal qualified name character

    Hi all,
    In my SQL Server 2012 Management Studio, I executed the following code:
    CREATE TABLE Products(
    sku INT Primary KEY,
    product_desc VARCHAR(30));
    INSERT INTO Products (sku, product_desc)
    SELECT X.product.query('SKU').value('.', 'INT'),
    X.product.query('Desc').value('.', 'VARCHAR(30)')
    FROM (
    SELECT CAST(x AS XML)
    FROM OPENROWSET(
    BULK 'H:\ZenProducts.xml',
    SINGLE_BLOB) AS T(x)
    ) AS T(x)
    CROSS APPLY x.nodes('Products/Product') AS X(product);
    SELECT sku, product_desc
    FROM Products;
    I got the following message:
    Msg 9455, Level 16, State 1, Line 5
    XML parsing: line 3, character 12, illegal qualified name character
    I have no ideas why the "product" in the statement "SELECT X.product.query('SKU').value('.','INT')" is not legal qualified name charcter!!!???  Please kindly help, advise and respond.
    Thanks in advance,
    Scott Chang

    Hi Manish, Thanks for your response.
    Here is a copy of my ZenProducts.xml:
    <Products>
    <Product>
    <SKU>1<</SKU>
    <Desc>Book</Desc>
    </Product>
    <Product>
    <SKU>2<</SKU>
    <Desc>DVD</Desc>
    </Product>
    <Product>
    <SKU>3<</SKU>
    <Desc>Video</Desc>
    </Product>
    I found the wrong "<<" in my xml file and changed it to the right "<" for the statement<SKU>1</sku>. I executed the corrected code and I got the following new message:
    Msg 2714, Level 16, State 6, Line 1
    There is already an object named 'Products' in the database.
    I don't know how to remove the old, existing the 'Products' object in the database and execute the corrected code again. Please kindly help, advise and tell me how to resolve this new problem.
    Many Thanks,
    Scott Chang
    P. S. I played with another project to get the 'Products' object in my database before. Frankly, I don't know where the old 'Products' object and the database are. Please enlighten me in resolving this matter more clearly.
    You welcome Scott, As Olaf mentioned in this post, there was already a table exists , so need to drop your Products table.
    Apart from this, I guess either you did not pasted the full XML file or what, I needed to have the (  </Products>)closing tag in your XML file as follows.
    <Products>
    <Product>
    <SKU>1</SKU>
    <Desc>Book</Desc>
    </Product>
    <Product>
    <SKU>2</SKU>
    <Desc>DVD</Desc>
    </Product>
    <Product>
    <SKU>3</SKU>
    <Desc>Video</Desc>
    </Product>
    </Products>
    You can use following script to drop if your 
    Products table is already existing.
    if exists(select 1 from sys.tables where name ='Products')
    drop table Products
    CREATE TABLE Products(
    sku INT Primary KEY,
    product_desc VARCHAR(30));
    INSERT INTO Products (sku, product_desc)
    SELECT X.product.query('SKU').value('.', 'INT'),
    X.product.query('Desc').value('.', 'VARCHAR(30)')
    FROM (
    SELECT CAST(x AS XML)
    FROM OPENROWSET(
    BULK 'H:\ZenProducts.xml',
    SINGLE_BLOB) AS T(x)
    ) AS T(x)
    CROSS APPLY x.nodes('Products/Product') AS X(product);
    SELECT sku, product_desc
    FROM Products;
    Let us know if you face any other problem.
    Thanks
    Manish
    Please click Mark as Answer if my post solved your problem and click
    Vote as Helpful if this post was useful.

  • Report failed to parse SQL query:ORA-01745: invalid host/bind variable name

    Hi,
    We are currently upgrading from v2.2.0.00.32 to v4.0.0.00.46.
    I have copied the applications onto our test server along with the various database objects and data etc.
    When I am running a report in v4, it is failing with the following error: "failed to parse SQL query: ORA-01745: invalid host/bind variable name".
    When I copy the SQL that builds the report into TOAD (on out test server) it runs OK so really cant see why it would fail in APEX. It works fine when I run the query in our APEX v2 and in TOAD in our live server.
    The query is as follows:
    SELECT
    aea.ALTERATION_ID
    ,aea.ALTERATION_ID "ALTERATION_ID_DISPLAY"
    ,aea.assembly_name "Revised BOM"
    ,assembly.description "Revised BOM Description"
    ,assembly.INVENTORY_ITEM_STATUS_CODE "Revised BOM Status"
    ,aea.BEFORE_CHANGE_QTY
    ,flv.MEANING "Alteration Type"
    ,aea.component_name "Part No"
    ,component.description "Part No Description"
    ,component.INVENTORY_ITEM_STATUS_CODE "Part No Status"
    ,aea.AFTER_CHANGE_QTY
    ,TO_CHAR(aea.last_update_date,'DD-MM-YYYY HH24:MI:SS')"Last Update Date"
    ,aea.LAST_UPDATE_BY
    ,aea.COMMENTS
    ,aea.ORACLE_CHANGE_NOTICE
    ,AEA.SELECTION_CRITERIA
    FROM XXMEL_APEX_ECO_ALTERATIONS aea
    , fnd_lookup_values flv
    , (SELECT INVENTORY_ITEM_STATUS_CODE
    ,segment1
    ,description
    FROM mtl_system_items_b
    WHERE 1=1
    AND organization_id = 26) component
    , (SELECT INVENTORY_ITEM_STATUS_CODE
    ,segment1
    ,description
    FROM mtl_system_items_b
    WHERE 1=1
    AND organization_id = 26) assembly
    WHERE 1=1
    AND aea.COMPONENT_NAME = component.segment1 (+)
    AND aea.assembly_NAME = assembly.segment1 (+)
    AND flv.lookup_code = aea.acd_type
    AND aea.eco = :P13_ECO
    AND flv.lookup_type = 'ECG_ACTION'
    AND modify_flag = 'Y'
    ANy help would be great,
    Thanks
    Chris
    Edited by: Cashy on 22-Nov-2010 04:13
    Edited by: Cashy on 22-Nov-2010 04:14

    For some reason, the updatable fields (this is a updateable report) where not connecting to the database properly. Whn I changed them to a report columns and removed the database field reference, the report rendered

  • JSP sql - set table name in variable

    I'm trying to set my table name in variable, what is the syntax in sql of selecting from a table which name is set with a variable name?

    That's easy :
    Say, ur table name is MY_TABLE.
    Now, set a variable say x as :
    var x = "MY_TABLE"; (Javascript)
    or
    String x = "MY_TABLE" (JSP/Servlet);
    Finally, use the SQL as,
    String SQL = "SELECT * FROM " + x + "WHERE condition". (JSP/Servlet).
    or
    var SQL = "SELECT * FROM " + x + "WHERE condition". (Javascript).
    and BINGO !!
    Do keep me posted.
    Cheers !!
    Sherbir

  • Same variable name causes major issues.....

    I would like to get some input and possible direction on the issue below... I am new to PL/SQL. Thanks in advance.....
    ..... The system is in the middle of processing a “For” step, i.e. a given “For” step is incomplete.
    ..... The script instructs the system to process a second “For” step with the same “for-loop variable” as the incomplete “For” step.
    When the above takes place, the system processes the second “For” step incorrectly. Instead of starting at the first value in the second “For” step’s list of values, the system begins in the middle of the value list.
    I need to change the current implementation so that if a "For" loop is encountered that has the same “loop variable” as a “For” loop already being executed, the “state” of the previous “For” step is discarded, and the state for the new “For” step is initialized to the first value in its list.
    -- Used for "for" steps
    TYPE for_list is table of varchar2(4000) index by binary_integer;
    TYPE for_loop_state is record (
    list for_list,
    next_index integer
    TYPE for_loops_list is table of for_loop_state index by steps.output_param%TYPE;
    all_for_loops for_loops_list;
    procedure for_step(list_string IN varchar2, ret_var_name IN varchar2, end_for_label IN varchar2) is
    state for_loop_state;
    end_idx number;
    list_value varchar2(4000);
    begin
    pkg_util.log('ret_var_name value after begin: ' || ret_var_name, 'I');
    -- get the current for list state, based on its output variable name
    if all_for_loops.exists(ret_var_name) then
    state := all_for_loops(ret_var_name);
    else
    state.next_index := 0;
    list_value := parse_next_param(list_string, 1, end_idx);
    -- end_idx is thrown away; for loops only have 1 input parameter (the list)
    state.list := get_for_list(list_value);
    all_for_loops(ret_var_name) := state;
    end if;
    if state.next_index < state.list.count then
    pkg_session_values.put(ret_var_name, state.list(state.next_index));
    all_for_loops(ret_var_name).next_index := state.next_index + 1;
    else
    all_for_loops.delete(ret_var_name);
    jump(end_for_label);
    end if;
    end;

    There is so much of your code hidden from view it is impossible to tell you anything other than perhaps suggest a methodology.
    Create a single variable with a known value and use dbms_output to view it as it steps through each piece of the puzzle. Determine when the value does something you don't want.

Maybe you are looking for

  • RFC_ERROR_SYSTEM_FAILURE: Time limit exceeded. Connection Pool - JCO api

    Hi Everyone My Connection  Pool parameters JCO api. client=300 user=SISGERAL_RFC passwd=****** ashost=14.29.3.120 sysnr=00 size=10 I have these parameters on my Connection Pool and sometimes appear these wrongs in my application: 1. 2006-01-07 13:20:

  • How to create Leader Lines for Pie Chart Labels

    I like Numbers but the restrictions they force are sometime just too much. Example: Labels The restriction of only being able to move a label of a wedge on a parallel axis is ridiculous. Here Excel clearly out shines Numbers. I want an option to add

  • MacBook won't restart or shut down after upgrades

    A couple of days ago I downloaded and installed updates from software-update (including a security update). I had to restart my computer, and everything worked. Later that day when I wanted to shut down my computer, nothing happened. I haven't been a

  • Push button application tool bar

    Hi All, i have a push button on application tool bar , i need to disable that button , where can i do this. Kindly suggest. Thanks&Regards. Ramu

  • PY-ID Previous employment details

    Hi, I read from SAP Help that the system reads PTKP details from infotype 0694 only if we have set the feature IDPTK. Can someone advise what should be the entries to set in the feature IDPTK? It was also mentioned in SAP Help that "If an employee jo