USER_DATASTORE with VARCHAR2

I'm using Oracle Text with Oracle Enterprise Server 8.1.7 on Solaris.
I try to create an index with a user_datastore based on a procedure returning a varchar2.
It seems to me that I wrote that procedure as the documentation says but I get that error message:
DRG-12604: execution of user datastore procedure has failed
DRG-50857: oracle error in drsinopen
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'STUDY_DATASTORE'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
The procedure I wrote is owned by an application schema:
PROCEDURE STUDY_DATASTORE (rid in rowid, tvarchar2 in out varchar2) IS
cursor cur_study (p_rid in rowid) is
select otherinstitutionname,
othercoursetitle
from study, csuser
where csuser.rowid = p_rid
and csuser.csuserno = study.candidateno
and study.jobofferno = -1;
begin
for rec_study in cur_study (rid)
loop
tvarchar2 := tvarchar2 | | rec_study.otherinstitutionname;
end loop;
END STUDY_DATASTORE;
Then I wrote the procedure owned by CTXSYS:
procedure study_datastore(rid in rowid, tvarchar2 in out nocopy varchar2) is
begin
huge_400.study_datastore(rid, tvarchar2);
end;
I then granted that procedure to the application schema:
grant execute study_datastore to huge_400;
Anyone can see the problem ?
When I write my procedure with a returning clob, I get no problems but it is very slow. That's why I tried with varchar2.

You have to set an attribute
ctx_ddl.set_attribute('mystore','output_type','varchar2');
See Documentation about USER_DATASTORE
Regards
Thomas
<BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Yves Bergeron ([email protected]):
I'm using Oracle Text with Oracle Enterprise Server 8.1.7 on Solaris.
I try to create an index with a user_datastore based on a procedure returning a varchar2.
It seems to me that I wrote that procedure as the documentation says but I get that error message:
DRG-12604: execution of user datastore procedure has failed
DRG-50857: oracle error in drsinopen
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'STUDY_DATASTORE'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
The procedure I wrote is owned by an application schema:
PROCEDURE STUDY_DATASTORE (rid in rowid, tvarchar2 in out varchar2) IS
cursor cur_study (p_rid in rowid) is
select otherinstitutionname,
othercoursetitle
from study, csuser
where csuser.rowid = p_rid
and csuser.csuserno = study.candidateno
and study.jobofferno = -1;
begin
for rec_study in cur_study (rid)
loop
tvarchar2 := tvarchar2 | | rec_study.otherinstitutionname;
end loop;
END STUDY_DATASTORE;
Then I wrote the procedure owned by CTXSYS:
procedure study_datastore(rid in rowid, tvarchar2 in out nocopy varchar2) is
begin
huge_400.study_datastore(rid, tvarchar2);
end;
I then granted that procedure to the application schema:
grant execute study_datastore to huge_400;
Anyone can see the problem ?
When I write my procedure with a returning clob, I get no problems but it is very slow. That's why I tried with varchar2.<HR></BLOCKQUOTE>
null

Similar Messages

  • How do I use user_datastore with a feeder proc to add an mdata section?

    Hi,
    I have text data spread across a number of different tables. I have created a user_datastore with a feeder procedure that creates an xml document which is then indexed into a dummy column on the parent table. This works fine. However I need to add an mdata section to the index, via my xml document. I haven't seen any examples of this being done in conjunction with the ctxsys.auto_section_group option of the create index statement, and am wondering if it is possible?
    Could somebody furnish me an example of how I achieve this.
    Oracle 11.2.
    Thanks
    Ralph

    You can't use MDATA with AUTO_SECTION_GROUP. AUTO means it automatically assigns zone sections for every tag it finds - if you want anything other than zone sections you must use BASIC_SECTION_GROUP, XML_SECTION_GROUP or HTML_SECTION_GROUP and manually define your sections.

  • Problem with varchar2 primary key..

    OWM version 10.1.0.8
    When I am trying to add a column in a version enable table with varchar2 primary key, it fails.
    If primary key is numeric it works.
    See below the test case.
    -- CASE 1. When primary key is number.
    SQL> create table wmtab
    ( wmtab_id number,
    price number,
    title varchar2(80),
    AUTHOR VARCHAR2(10)
    Table created.
    SQL> ALTER TABLE wmtab add (CONSTRAINT PK_kontakt PRIMARY KEY (wmtab_id));
    Table altered.
    SQL> EXECUTE DBMS_WM.EnableVersioning('WMTAB');
    PL/SQL procedure successfully completed.
    SQL> CALL DBMS_WM.BEGINDDL('WMTAB');
    Call completed.
    SQL> ALTER TABLE wmtab_lts add ( FREIGEGEBEN varchar2(1));
    Table altered.
    SQL> CALL DBMS_WM.commitDDL('WMTAB');
    Call completed.
    -- CASE 2. When primary key is varchar2.
    SQL> create table wmtab
    (wmtab_id varchar2(10) constraint wmtab_pk primary key,
    price number,
    title varchar2(80),
    AUTHOR VARCHAR2(10)
    Table created.
    SQL> EXECUTE DBMS_WM.EnableVersioning('WMTAB');
    PL/SQL procedure successfully completed.
    SQL> CALL DBMS_WM.BEGINDDL('WMTAB');
    Call completed.
    SQL> ALTER TABLE wmtab_lts add ( FREIGEGEBEN varchar2(1));
    Table altered.
    SQL> call DBMS_WM.CommitDDL('wmtab');
    call DBMS_WM.CommitDDL('wmtab')
    ERROR at line 1:
    ORA-20199: primary key columns cannot be added/dropped/modified/reordered for
    version enabled tables
    ORA-06512: at "SYS.OWM_DDL_PKG", line 6196
    ORA-06512: at "SYS.LT", line 11930
    ORA-06512: at line 1
    Same problem is reprosucible on OWM 10.2.0.1.
    But its working fine with varchar2 primary key On OWM 10.2.0.4.2/3
    Is there any workaround or we can get patch for 10.1.x.x?

    Hi,
    I was unable to reproduce this behavior on OWM 10.1.0.8. It appears that you have a SR open for this issue, so I would suggest to continue with that process.
    Regards,
    Ben

  • Oracle 11g AQ : problem enqueue user-defined type with varchar2 attribute

    Hello.
    I have a problem enqueuing a user-defined type to the queue on Oracle 10g.
    I'm using jdbc driver (ojdbc5.jar, version 11.1.0.6.0) as they provide oracle.jdbc.aq package.
    The type is following:
    CREATE OR REPLACE TYPE FIXED_T5 AS OBJECT
    (id integer,
    label varchar2(100),
    code integer,
    today date
    )I have created a java class for this type with jpub utility supplied with oracle 11g client package:
    jpub -user=scott/tger -url=jdbc:oracle:thin:@host:sid-sql=FIXED_T5:ru.invito.FixedType -compile=falseIt generated FixedType.java and FixedTypeRef.java files. Don't understand why i need the latter (FixedTypeRef).
    Then in test app:
    package ru.invito;
    import java.io.IOException;
    import java.net.InetAddress;
    import java.net.UnknownHostException;
    import java.sql.SQLException;
    import java.sql.Timestamp;
    import java.util.Date;
    import java.util.Properties;
    import java.util.UUID;
    import junit.framework.TestCase;
    import oracle.jdbc.aq.AQAgent;
    import oracle.jdbc.aq.AQEnqueueOptions;
    import oracle.jdbc.aq.AQFactory;
    import oracle.jdbc.aq.AQMessage;
    import oracle.jdbc.aq.AQMessageProperties;
    import oracle.jdbc.aq.AQEnqueueOptions.DeliveryMode;
    import oracle.jdbc.aq.AQEnqueueOptions.VisibilityOption;
    import oracle.jdbc.driver.OracleConnection;
    import oracle.jdbc.driver.OracleDriver;
    import oracle.sql.Datum;
    import oracle.sql.STRUCT;
    import oracle.sql.StructDescriptor;
    import org.apache.commons.logging.Log;
    import org.apache.commons.logging.LogFactory;
    public class AqTest extends TestCase {
         protected Log logger = LogFactory.getLog(getClass());
         public void testEnqueue() throws Exception {
              OracleDriver dr = new OracleDriver();
              Properties prop = new Properties();
              prop.setProperty("user", Config.USERNAME);
              prop.setProperty("password", Config.PASSWORD);
              OracleConnection connection = (OracleConnection) dr.connect(Config.JDBC_URL, prop);
              assertNotNull(connection);
              connection.setAutoCommit(false);
              enqueueMessage(connection, "INVITO.FIXED_T5Q", null);
              connection.commit();
         private void enqueueMessage(OracleConnection conn, String queueName, AQAgent[] recipients) throws SQLException,
                   IOException {
              logger.debug("----------- Enqueue start ------------");
              AQMessageProperties props = makeProps(queueName);
              AQMessage mesg = AQFactory.createAQMessage(props);
              String msqText = String.format("Hello, %s!", queueName);
              FixedType data = createData(36, msqText);
              Datum d = data.toDatum(conn);
              STRUCT s = (STRUCT) d;
              debugStruct("s", s);
              String toIdStr = byteBufferToHexString(s.getDescriptor().getOracleTypeADT().getTOID(), 20);
              logger.debug("s.toIdStr: " + toIdStr);
              StructDescriptor sd = StructDescriptor.createDescriptor("INVITO.FIXED_T5", conn);
              logger.debug("sd.toXMLString(): " + sd.toXMLString());
              mesg.setPayload(s);
              AQEnqueueOptions opt = makeEnqueueOptions();
              logger.debug("sending............");
              // execute the actual enqueue operation:
              conn.enqueue(queueName, opt, mesg);
              debugMessageId(mesg);
              logger.debug("----------- Enqueue done ------------");
         private void debugMessageId(AQMessage mesg) throws SQLException {
              byte[] mesgId = mesg.getMessageId();
              if (mesgId == null) {
                   throw new IllegalStateException("message id is NULL");
              String mesgIdStr = byteBufferToHexString(mesgId, 20);
              logger.debug("Message ID from enqueue call: " + mesgIdStr);
          * @return
          * @throws SQLException
         private FixedType createData(int ID, String label) throws SQLException {
              FixedType data = new FixedType();
              data._struct.setNChar(1);// initializes the flag for 'label' field
              data.setId(ID);
              data.setLabel(label);
              data.setCode(1);
              Date today = new Date();
              data.setToday(new Timestamp(today.getTime()));
              return data;
          * @param string
          * @param s
          * @throws SQLException
         private void debugStruct(String string, STRUCT s) throws SQLException {
              logger.debug(s + ".debugString(): " + s.debugString());
              logger.debug(s + "s.dump(): " + s.dump());
          * @return
          * @throws SQLException
         private AQAgent makeAgent() throws SQLException {
              AQAgent ag = AQFactory.createAQAgent();
              ag.setName("AQ_TEST");
              String agentAddress = null;
              try {
                   agentAddress = InetAddress.getLocalHost().getHostAddress();
              catch (UnknownHostException e) {
                   logger.error("cannot resolve localhost ip address. will not set it as AQ Agent address");
                   agentAddress = "NA";
              ag.setAddress(agentAddress);
              return ag;
         private AQMessageProperties makeProps(String queueName) throws SQLException {
              final String EXCEPTION_Q_TEMPLATE = "AQ$_%sT_E";
              final int DEFAULT_DELAY = 0;
              final int DEFAULT_EXPIRATION = -1;
              final int DEFAULT_PRIORITY = 0;
              AQMessageProperties propeties = AQFactory.createAQMessageProperties();
              propeties.setCorrelation(UUID.randomUUID().toString());
              propeties.setDelay(DEFAULT_DELAY);
              propeties.setExceptionQueue(String.format(EXCEPTION_Q_TEMPLATE, queueName));
              propeties.setExpiration(DEFAULT_EXPIRATION);
              propeties.setPriority(DEFAULT_PRIORITY);
              // propeties.setRecipientList(null);//should not set
              propeties.setSender(makeAgent());
              return propeties;
          * @return
          * @throws SQLException
         private AQEnqueueOptions makeEnqueueOptions() throws SQLException {
              AQEnqueueOptions opt = new AQEnqueueOptions();
              opt.setRetrieveMessageId(true);
              // these are the default settings (if none specified)
              opt.setDeliveryMode(DeliveryMode.PERSISTENT);
              opt.setTransformation(null);
              opt.setVisibility(VisibilityOption.ON_COMMIT);
              return opt;
          * Form the AQ reference
          * @param buffer
          * @param maxNbOfBytes
          * @return
         private static final String byteBufferToHexString(byte[] buffer, int maxNbOfBytes) {
              if (buffer == null)
                   return null;
              int offset = 0;
              StringBuffer sb = new StringBuffer();
              while (offset < buffer.length && offset < maxNbOfBytes) {
                   String hexrep = Integer.toHexString((int) buffer[offset] & 0xFF);
                   if (hexrep.length() == 1)
                        hexrep = "0" + hexrep;
                   sb.append(hexrep);
                   offset++;
              String ret = sb.toString();
              return ret;
    }The output is following:
    [main] 2008-07-03 19:09:49,863 DEBUG [ru.invito.AqTest] - ----------- Enqueue start ------------
    [main] 2008-07-03 19:09:50,348 DEBUG [ru.invito.AqTest] - [email protected](): name = INVITO.FIXED_T5 length = 4 attribute[0] = 36 attribute[1] = Hell
    o, INVITO.FIXED_T5Q! attribute[2] = 1 attribute[3] = 2008-07-03 19:09:49.0
    [main] 2008-07-03 19:09:50,363 DEBUG [ru.invito.AqTest] - [email protected](): name = INVITO.FIXED_T5
    length = 4
    ID = 36
    LABEL = Hello, INVITO.FIXED_T5Q!
    CODE = 1
    TODAY = 2008-07-03 19:09:49.0
    [main] 2008-07-03 19:09:50,363 DEBUG [ru.invito.AqTest] - s.toIdStr: 507ccce5b6e9f572e040007f01007203
    [main] 2008-07-03 19:09:50,363 DEBUG [ru.invito.AqTest] - sd.toXMLString(): <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <StructDescriptor sqlName="INVITO.FIXED_T5" >
      <OracleTypeADT sqlName="INVITO.FIXED_T5"  typecode="0" tds_version="1"
               is_embedded="false" is_top_level="true" is_upt="false" finalType="true" subtype="false">
        <attributes>
          <attribute name="ID"  type="INTEGER" >
            <OracleType typecode="2" />
          </attribute>
          <attribute name="LABEL"  type="VARCHAR2" >
            <OracleType typecode="12" />
          </attribute>
          <attribute name="CODE"  type="INTEGER" >
            <OracleType typecode="2" />
          </attribute>
          <attribute name="TODAY"  type="DATE" >
            <OracleType typecode="0" />
          </attribute>
        </attributes>
      </OracleTypeADT>
    </StructDescriptor>
    [main] 2008-07-03 19:09:50,379 DEBUG [ru.invito.AqTest] - sending............
    [main] 2008-07-03 19:09:50,395 DEBUG [ru.invito.AqTest] - Message ID from enqueue call: 511ff143bd4fa536e040007f01003192
    [main] 2008-07-03 19:09:50,395 DEBUG [ru.invito.AqTest] - ----------- Enqueue done ------------But when dequeueing the 'label' attribute is lost:
    DECLARE
    dequeue_options     DBMS_AQ.dequeue_options_t;
    message_properties  DBMS_AQ.message_properties_t;
    message_handle      RAW(16);
    message             fixed_t5;
    BEGIN
      dequeue_options.navigation := DBMS_AQ.FIRST_MESSAGE;
      DBMS_AQ.DEQUEUE(
         queue_name          =>     'fixed_t5q',
         dequeue_options     =>     dequeue_options,
         message_properties  =>     message_properties,
         payload             =>     message,
         msgid               =>     message_handle);
      DBMS_OUTPUT.PUT_LINE('ID   : '||message.id);
      DBMS_OUTPUT.PUT_LINE('Label: '||message.label);
      DBMS_OUTPUT.PUT_LINE('Code : '||message.code);
      DBMS_OUTPUT.PUT_LINE('Today: '||message.today);
      COMMIT;
    END;
    ID   : 36
    Label:
    Code : 1
    Today: 03.07.08
    Could anyone tell me what is wrong with the setup/code?
    Why 'label' not saved in queue, though i saw it is not empty in STRUCT?

    Thank you for the reply!
    I have enqueued:
    [main] 2008-07-04 15:30:30,639 DEBUG [ru.invito.UserDefinedTypeAqTest$1] - [email protected](): name = INVITO.FIXED_T5
    length = 4
    ID = 41
    LABEL = Hello, INVITO.FIXED_T5Q!
    CODE = 1
    TODAY = 2008-07-04 15:30:30.0and in table (select * from FIXED_T5QT) the 'label' is blank:
    Q_NAME     FIXED_T5Q
    MSGID     51310809B5EA3728E040007F01000C79
    CORRID     b8f38fd3-4fa6-4e0f-85d1-2440d02d655e
    PRIORITY     0
    STATE     0
    DELAY     
    EXPIRATION     
    TIME_MANAGER_INFO     
    LOCAL_ORDER_NO     0
    CHAIN_NO     0
    CSCN     0
    DSCN     0
    ENQ_TIME     04.07.2008 15:28:44
    ENQ_UID     INVITO
    ENQ_TID                       4012
    DEQ_TIME     
    DEQ_UID     
    DEQ_TID     
    RETRY_COUNT     0
    EXCEPTION_QSCHEMA     AQ$_INVITO
    EXCEPTION_QUEUE     FIXED_T5QT_E
    STEP_NO     0
    RECIPIENT_KEY     0
    DEQUEUE_MSGID     
    SENDER_NAME     AQ_TEST
    SENDER_ADDRESS     10.1.1.137
    SENDER_PROTOCOL     
    USER_DATA.ID     41
    USER_DATA.LABEL     
    USER_DATA.CODE     1
    USER_DATA.TODAY     04.07.2008 15:30:30I must point to a strange thing: when the FixedType instance is created (via new operator) and then the setLabel("....") called as:
    FixedType data = new FixedType();
    // hack: proper initialization for 'label' field
    data._struct.setNChar(1);
    data.setId(ID);
    data.setLabel(label);
    data.setCode(1);
    Date today = new Date();
    data.setToday(new Timestamp(today.getTime()));
    Datum d = data.toDatum(connection);
    STRUCT s = (STRUCT) d;
    logger.debug(s + ".debugString(): " + s.debugString());
    logger.debug(s + ".dump(): " + s.dump());and if i comment line (data._struct.setNChar(1);) the debug messages for created STRUCT also shows empty value for label.
    But if i explicitly call data._struct.setNChar(1) then debug contains the label i defined in call to the setLabel method.

  • How to register PL/SQL function with Varchar2 argument in Discoverer

    Hi,
    I have registered a PL/SQL function in Discoverer Administrator 10.1.2.1. Function has two arguments with data type varchar2. In discoverer I've selected varchar as it doesn't have varchar2.
    When i use this function in report using discoverer desktop it gives an error "One of the function argument has an incorrect datatype.
    I would appreciate if somebody can help
    Regards
    BA

    Hi,
    First, do not wait to use it in order to check it.
    In the discoverer admin you can "Validate" the function on after registering it.
    there are couple of things you should know about registering the function:
    1. the "Varchar" option you selected is correct (there is no varchar2 in the admin definition).
    2. check the database function to verify that you indeed registered all its arguments and they match the names and types of the db function.
    3. during the registration, type everything in UPPER CASE.
    the other way to register the function (and you will not need to deal with the definition of it) is to search for the function in a list.
    in order to do that, on the register function screen press the "Import" button (on the bottom right side of screen).
    then search by the owner (db user / schema) that the function / package is registered.
    Tamir

  • Problem with 'order by' and comparison operator with varchar2 field

    I have a problem with the following sql query (field1 is varchar2):
    SELECT field1
    FROM tablename
    WHERE field1 > 'AA10BB'
    ORDER BY field1
    The contents of field1 is:
    AA10BB
    AA10-10BB
    AA10-12BB
    The sql query without the WHERE clause sorts field1 this way:
    AA10BB
    AA10-10BB
    AA10-12BB
    But the sql query with the WHERE clause has no hits.
    It seems that when sorting the minus character is greater than the 'B' character and
    at the comparison ( > 'AA10BB' ) the minus character is lower than the 'B' character!
    The database and client NLS_PARAMTER are GERMAN_GERMANY.
    The database is 9.2.0.7
    Has anyone an idea?

    thanks for your fast reply!
    My problem was that NLS_SORT was set to 'GERMAN' and NLS_COMP to 'BINARY'.
    NLS_SORT = GERMAN orders the varchar2 fields in form of 'a A b B ... 0 1 2 3 ..'
    NLS_COMP = BINARY compares binary (ASCII-Table).
    I use now:
    SELECT field1
    FROM tablename
    WHERE field1 > 'AA10BB'
    ORDER BY NLSSORT(field1, 'NLS_SORT = Binary'');

  • Add Column with Varchar2 function

    i created a program unit (function) that returns a varchar2(100). How do i create a link between the function and a new column on the report for each record? I created a query that returns two columns now i want to apply this function to a third column to get some formatted text.

    Make sure the column type property for the formula column is set to CHARACTER, and the width is set to 100 to match up with your function. And the PL/SQL prolog of the formula column should read:
    function CF_<some_name>Formula return Char is
    FYI, in Reports, CHAR and VARCHAR get formatted the same way (e.g., trailing blanks are ignored).

  • Xi; in the item in the form (itm is a db-field with Varchar2)

    Hello
    I'm looking for a solution for my problem.
    I have a form with one master-block and four detail-block. One item in a detail-block makes at time (shows in the field) [xi;] This field is a db-field varchar2 with the correct length look like the attribute in the table (scheduling by byte default, scheduling by null the same effect). After I maked the query, the field shows the right value in this field.
    I have this effect in an other Form with one master and one detail-block with one item in the master-block.
    Can anyone give me the answer what is the problem and how can I solution this problem.
    Client Windows XP
    App-Server VMS with Apache
    Forms 9.0.2
    DB 9.2
    Thank's for your help
    René

    Yes you just add an edit text box to the form and bind it to the UDF.
    Dim oItem As SAPbouiCOM.Item
    oItem = oForm.Items.Add("TextBox1", BoFormItemTypes.it_EDIT)
    'You will need to adjust these values to position it correctly
    oItem.Left = 5
    oItem.Width = 65
    oItem.Top = 50
    oItem.Height = 19
    Dim oEdit As SAPbouiCOM.EditText
    oEdit = oItem.Specific
    oEdit.DataBind.SetBound(True, "OCRD", "U_Test")

  • Question in ER_DESIGN with VARCHAR2 and CLOB

    hi experts,
    i want to know in your design experience, how do you manage thus situation:
    a text field, which must have features of full-text search for all the text, normally, it should be less than 4000 character long, (it means we can use varchar2 field for it),
    however, sometimes it should longer than 4000 characters.
    i think, i could have two options,
    the first, i cut it into peices with no one can be longer than 4000, nevertheless, this method will face difficult to provide full-text search.
    the other is to build a new table with clob field, the original table will involve a field of varchar2, the other field of number will be a reference guild the the clob table.
    if the record's text long do not over 4000, it will record in the field of varchar2 as usual, once it is longer than 4000, it will be stored in the clob field in other table.i can get it with the guild field(index).
    so i can provide full-text search functions for this type of record, and much storage space can be saved.
    However, i do not know whether i am doing on a right way or in a foolish way, may be some other wise method can do simply . that what i want to question on you.
    thank you very much.
    frederick

    No, I don't have tables of values. I have a java 1.5 enumeration, like for instance:
    public enum VelocityConvention {
       RELATIVISTIC,
       REDSHIFT;
    }and a class Velocity that contains a convention and a value like so:
    public class Velocity {
       public VelocityConvention getConvention() {...}
       public double getValue() {...}
       public void set(VelocityConvention conv, double value) {...}
    }When I persist the Velocity class to the database, I want a field called convention that holds the appropriate value of the enumeration. That much is done how I explained before.
    I want to have a selectOneMenu for setting the convention. Via trial and error, I found that MyFaces wasn't able to automatically convert from a string back to a proper VelocityConvention enum constant. It can, of course, convert from the enum to a string because it just calls toString(). But I need both directions for any UIInput element I use, be it a selectOne, or just a straight inputText.

  • Problems with varchar2 column and a select statement

    Hi to all,
    I am new to ODP...so I would really appreciate your help..
    I am having problems with using the following code:
    con.ConnectionString = "User Id=bla;Password=bla;Data Source=bla;";
    string cmdQuery = "SELECT * from try where data ="+textBox1.Text+"";
    OracleCommand cmd = new OracleCommand(cmdQuery);
    cmd.Connection = con;
    cmd.CommandType = CommandType.Text;
    OracleDataReader reader = cmd.ExecuteReader();
    while (reader.Read())
    MessageBox.Show(reader.GetString(0)+"");
    cmd.Dispose();
    con.Close();
    where:
    data is the name of a field in the table
    textBox1 is the name of a text box where the user inserts the values..
    The error that appears is "Invalid identifier"..
    I hope it makes sense...and please help...

    Hi,
    I'm fairly sure it IS the single quotes actually. Print out the string you're trying to excute, then try it outside odp.net, does it work?
    For example:
    SQL> select * from dual where dummy=foo;
    select * from dual where dummy=foo
    ERROR at line 1:
    ORA-00904: "FOO": invalid identifier
    SQL> select * from dual where dummy='foo';
    no rows selected
    Cheers,
    Greg

  • Issue with Varchar2 field conversion for report output generated in EXCEL

    Hello All,
    I have an unique problem with one of my new reports for the User. The user wants the report output generated in excel data only(delimited data) format *(reports builder 10g)* .
    Everything was fine until i encountered this problem, there was this field which has unique ID's(alphanumeric and numeric), when i tried to run the report and generate output in Excel the numeric ID's say for example *(41593497999679354429)* is converted in excel and displayed like *(2.5881E+19)* and after format cells in excel it displays *(41593497999679300000).*
    The issue is only with 20 digits numeric ID's , if i append any special character to the end say '#' or '..' it shows the exact value along with the appended character. But the user insist they need only the value that is in the table. I am finding it hard to figure out, if any one of you have encountered the same issue or if any of you have any suggestions to overcome this excel conversion thing please do advice me.
    Thanks in advance :)

    Thanks for you response, but i already tried what you suggested, instead of appending single quote in front of ID, i did at the end prior with '#', it preserves the value if i add any character to the id but the appended value shows up too :(.
    Well, i just got the solution and it did work, thanks to [Brian Hill|https://forums.oracle.com/forums/thread.jspa?threadID=651632] for the post, i did what exactly he said and it worked. I was so very happy and wanted to share with everyone.

  • How to return quotes with varchar2 value

    Hello-
    I'm writing a function and need to add quotes to either side of a varchar2 db value
    i.e. column value is Financial Trx, I need it to be 'Financial Trx'
    I'd be grateful for any ideas on how to do this -
    Many thanks in advance-
    amanda

    John, good point. Here is another way to get the single quotes that may or may not seem cleaner
    UT1> l
    1 select chr(39)||fld4||chr(39) as Word
    2 ,chr(39)||fld3||chr(39) as Oradate
    3* from marktest where fld1 = 8
    UT1> /
    WORD ORADATE
    'fraction' '25-JUL-03'
    When used in plsql code a variable can be given the value of a single quote, chr(39) and concatenated to the column values instead of repeatedly calling the function.
    HTH -- Mark D Powell --

  • I want to update  timestamp(3) column with respect to varchar2

    Hi all,
    I have a date field column with varchar2 as datatype :
    create table t1 (id number,date1 varchar2(35))
    insert into (1,' 3/13/2011 10:22 AM');
    insert into (2,' 3/14/2011 10:22 AM');
    insert into (3,' 3/15/2011 10:22 AM');
    I want to update table2
    create table t1 (id number,date1 timestamp(3))
    insert into (1,' ');
    insert into (2,' ');
    insert into (3,' ');I want to update t2 with date column in t1
    can any one help me
    Thanks in advance!!!!!

    Hi,
    846773 wrote:
    Hi all,
    I have a date field column with varchar2 as datatype : That's not a very good idea. You should always use a DATE or TIMESTAMP column for dates.
    create table t1 (id number,date1 varchar2(35))
    insert into (1,' 3/13/2011 10:22 AM');Thanks for posting the CREATE TABLE and INSERT statements; that's very helpful.
    Test them and make sure they work before you post them. You forgot the table name (after the keyword INTO).
    insert into (2,' 3/14/2011 10:22 AM');
    insert into (3,' 3/15/2011 10:22 AM');
    I want to update table2
    create table t1 (id number,date1 timestamp(3))This is the same name you used for the other table. I'll assume you meant to say t2 here, not t1.
    insert into (1,' ');Don't try to insert a string (such as ' ') into a TIMESTAMP column, You can INSERT a literal NULL, or simply not INSERT anything into that column.
    insert into (2,' ');
    insert into (3,' ');I want to update t2 with date column in t1Use TO_TIMESTAMP to convert the string into a TIMESTAMP:
    MERGE INTO     t2     dst
    USING  (
               SELECT  id
            ,        TO_TIMESTAMP ( date1
                              , 'MM/DD/YYYY HH:MI AM'
                       )      AS ts
            FROM    t1
           )          src
    ON     (src.id     = dst.id)
    WHEN MATCHED THEN UPDATE
    SET     dst.date1 = src.ts
    ;

  • EF6 with ODP 12cR3 : ORA-12704 (VARCHAR2 not supported?)

             Hi!
              We cannot port our working code from EF5 to EF 6.1.2, because the generated SQL output unicode query which is not compatible with VARCHAR2 column.
              How can we fix this issue ?
                Our Setup
                 Oracle 11.2.0.3.0
                 NLS_CHARACTERSET               WE8MSWIN1252                            
                 NLS_NCHAR_CHARACTERSET         AL16UTF16
                    -- TEST
                      CREATE TABLE "TEST"
                       ( "ID" NUMBER(*,0) NOT NULL ENABLE,
                     "NAME" VARCHAR2(20),
                     "VALUE" VARCHAR2(20)
                       ) PCTFREE 10 INITRANS 1 NOCOMPRESS LOGGING
                      STORAGE( INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
                    -- ID
                    ALTER TABLE "TEST" ADD CONSTRAINT "ID" PRIMARY KEY ("ID") ENABLE;
                 Objective : Trying to port working code from EF5 to EF6.1.2
                 Problem : Generated SQL contains unicode query when using VARCHAR2 column type.
                using (var ctx = new Entities())
                    var queryable = ctx.TESTs.Where(x => x.NAME.Contains("test")).Select(
                        t => new
                            TestVarcharVsUnicode = t.VALUE + "AnotherStringLiteralWillGenerateNvarcharSQL"
                    /* Generated SQL
                    queryable =
                        SELECT
                        1 AS "C1",
                        ((CASE WHEN ("Extent1"."VALUE" IS NULL) THEN N'' ELSE "Extent1"."VALUE" END)||('AnotherStringLiteralWillGenerateNvarcharSQL')) AS "C2"
                        FROM "TES_RA"."TEST" "Extent1"
                        WHERE ("Extent1"."NAME" LIKE '%test%')
                    var result = queryable.ToList();   // ORA-12704: character set mismatch here because VALUE column type is VARCHAR2 not NVARCHAR2
    UPDATE: By using an IDbCommandInterceptor class we can replace those Unicode string before execution.  But it's only a workaround until we found the correct way to fix it.
    Thank you in advance,
    Jean Francoeur

    Hi Verolamaz,
    No update on our side.
    We've also tried modelBuilder.Properties<string>().Configure(c => c.HasColumnType("varchar2"));
    But the generated SQL stay the same...
    Jean

  • User_datastore

    OK, so nobody has seen the problem that I
    am seeing with user_datastore, per my
    previous post.
    Is anybody here using the user_datastore
    feature in 8.1.7 successfully? It would
    help me just to know that somebody is
    actually using it, because I can't even
    get the Oracle samples for this feature to
    work. I suspect it is a problem with my
    ctx configuration, but have no idea where to
    start looking.....

    You have to set an attribute
    ctx_ddl.set_attribute('mystore','output_type','varchar2');
    See Documentation about USER_DATASTORE
    Regards
    Thomas
    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Yves Bergeron ([email protected]):
    I'm using Oracle Text with Oracle Enterprise Server 8.1.7 on Solaris.
    I try to create an index with a user_datastore based on a procedure returning a varchar2.
    It seems to me that I wrote that procedure as the documentation says but I get that error message:
    DRG-12604: execution of user datastore procedure has failed
    DRG-50857: oracle error in drsinopen
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'STUDY_DATASTORE'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    The procedure I wrote is owned by an application schema:
    PROCEDURE STUDY_DATASTORE (rid in rowid, tvarchar2 in out varchar2) IS
    cursor cur_study (p_rid in rowid) is
    select otherinstitutionname,
    othercoursetitle
    from study, csuser
    where csuser.rowid = p_rid
    and csuser.csuserno = study.candidateno
    and study.jobofferno = -1;
    begin
    for rec_study in cur_study (rid)
    loop
    tvarchar2 := tvarchar2 | | rec_study.otherinstitutionname;
    end loop;
    END STUDY_DATASTORE;
    Then I wrote the procedure owned by CTXSYS:
    procedure study_datastore(rid in rowid, tvarchar2 in out nocopy varchar2) is
    begin
    huge_400.study_datastore(rid, tvarchar2);
    end;
    I then granted that procedure to the application schema:
    grant execute study_datastore to huge_400;
    Anyone can see the problem ?
    When I write my procedure with a returning clob, I get no problems but it is very slow. That's why I tried with varchar2.<HR></BLOCKQUOTE>
    null

Maybe you are looking for

  • HELP! File Upload Servlet and Internet Explorer

    Hello people. I hope this is an easy problem to solve... I have a servlet upload program that works using Mozilla browser (www.mozilla.org), but for some reason it doesn't work using Microsoft IE. The servlet is also using the servlet upload API from

  • Phone switches to husbands apple id when I go to update apps.

    My phone says I have updates, but when I go to update them it has switched to my husband's apple id and wants his pw. We share a comp but have different user accounts to keep our itunes seperate. Everything else is signed in under my apple id. HELP P

  • Quicktime Slideshow Movie Won't Play Music

    I created a slideshow using my iPhoto 5.0.4 then exported it to a movie as Quicktime, with music. It plays beautifully on my machine. I burned it to a CD and sent it to someone with the identical Mac (a PowerBook G4) and he couldn't play it on his SA

  • The audio dosnt show up on the audio visual thing.

    the little audio bar that shows what the sound looks like dosnt show anything anymore. it just loads and loads. i have erased the app and reinstalled it and that didnt work. what is making it not show up? please email me at [email protected] or where

  • Purpose of cluster_database

    We have an Oracle 9i (9.2.0.7) two-node RAC database running on Solaris 5.8. Recently we have switched our production database from no archive log mode to archive log. We changed the parameter CLUSTER_DATABASE=FALSE on one of the instances before con