SQL replace function in JDeveloper

In SQL*Plus I run the following queries...
select last_name, phone_number from employees
LAST_NAME PHONE_NUMBER
Chung 650.505.1876
Dilly 650.505.2876
Gates 916.764.6600
select last_name, replace (phone_number, '.', '-') from employees
LAST_NAME REPLACE(PHONE_NUMBER
Chung 650-505-1876
Dilly 650-505-2876
Gates 916-764-6600
If I try to use the "REPLACE" function in the JDeveloper by editing the sql statement in the view object editor and run the page the results returned for the phone number column on the page are blank.
How can I substitute a dash for the period on the page?

Try using AS:
select last_name, replace (phone_number, '.', '-') AS phone_number from employees
In this case is recommended for your VO a read only query.

Similar Messages

  • Replace function in JDeveloper 3.2

    Hi JDev Team:
    Are there any global replace functions in JDev 3.2, for instance I have one word, say 'aaaa', in all of my projct files, .jsp, .java, .... I like to replace with 'bbbb'.
    Thanks

    The JDeveloper Editor provides Search & Replace functionality for files.
    What I typically do is
    Select menu: Search | Search Source Path...
    Enter Search String and Change Source path
    and other fields and press Start
    Then the Navigator displays a Search tab which lists all files with the matching string.
    Double click on first file in navigator and
    select menu Search | Replace
    In this dialog enter your search, replace, and other options-
    In the Options, If you do not want to be prompted, do not check the Prompt on replace option.
    Select the Scope of Global
    Selectg the Origin of Entire
    When you are ready press the Multiple button to make multiple replacements.
    When you are done with this file,
    Press Ctrl-S to Save the file
    Press Ctrl-F4 to close the window
    Double click on the Next File
    Press Ctrl-R to invoke the Search | Replace dialog.
    You should not need to change any options.
    Press Alt-M to select the Multiple Button!
    While this may seem more complex then a simple Sed / Perl / Python script, it is more controllable, flexible and user friendly.
    Besides, you may learn a few JDeveloper tricks.
    Good Luck,
    -John

  • SQL Replace function: errors if replacement text is 8191 characters

    Oracle 10.2.0.3.0 Enterprise Edition
    I'm working on an application which has a function to generate emails.
    We have a template, which gets filled with data from the database depending on the email being sent.
    To do this I'm using the Replace function to replace certain parts of the template with the right data.
    It seems that if the replacement text (the third argument to the function) is longer than 8191 bytes the function throws a PL/SQL: numeric or value error.
    This limitation doesn't appear to be documented anywhere, certainly nowhere that I can find.
    Anyone know of a way around this short of building my own replace function?

    I've figured out what was going on.
    The database column for the replacement text is defined as a clob, but there is a front end limit of 10,000 characters for the field being used.
    When using the replace function I was assigning the value to a varchar2(32767) field in the PL/SQL.
    So in terms of datatypes the function call is:
    varchar2 := replace(varchar2, varchar2, clob)
    If the length of the clob is over 8191 characters it errors.
    (Presumably because of the bug mentioned in this thread DBMS_LOB.SUBSTR() returning 8191 characters instead of 32767
    I've fixed it by simply changing the datatype of the variable to which the value is being assigned to a clob.

  • SQL Replace function - error

    I am little bit struggling to get the my sql function below, to execute the correct output:
    ALTER FUNCTION [dbo].[ReplaceTags](@XML VARCHAR(MAX))
    RETURNS VARCHAR(MAX)
    AS
    BEGIN
    SELECT @XML = REPLACE(@XML,[Name],'<a href="<a href="pagename.aspx?tag='+[name]+'">'+[name]+'</a>')
    FROM [dbo].[database_tags]
    where UploadDate >= '2014-09-01'
    RETURN @XML
    END
    When I call the function (select title, [dbo].[ReplaceTags](XML) from article ), it outputs the following result below, whereas the original data is this - (One is a 1m block of AIREM 2006-1X 2A3,).
    Query output:
    One is a &amp;#163;1m block of <a href="<a href="pagename.aspx?tag=<a href="<a href="pagename.aspx?tag=<a href="<a href="pagename.aspx?tag=<a href="<a href="pagename.aspx?tag=<a href="<a
    href="pagename.aspx?tag=AIREM 2006-1X 2A3">AIREM 2006-1X 2A3</a>"><a href="<a href="pagename.aspx?tag=AIREM 2006-1X 2A3">AIREM 2006-1X 2A3</a></a>"><a href="<a href="pagename.aspx?tag=<a
    href="<a href="pagename.aspx?tag=AIREM 2006-1X 2A3">AIREM 2006-1X 2A3</a>"><a href="<a href="pagename.aspx?tag=AIREM 2006-1X 2A3">AIREM 2006-1X 2A3</a></a></a>"><a href="<a
    href="pagename.aspx?tag=<a href="<a
    I am not sure, why it keep duplicating the name.  Please advice, where I may be going wrong. 
    Thank you for your help and time.

    Hi,
    There is no problem do this using CLR in the database side, as well. You can use SQLCLR regular expression function.
    In any case your HTML is wrong in the original question. You asked for 
    SELECT @XML = REPLACE(@XML,[Name],'<a href="<a href="pagename.aspx?tag='+[name]+'">'+[name]+'</a>')
    but you need 
    SELECT @XML = REPLACE(@XML,[Name],'<a href="pagename.aspx?tag='+[name]+'">'+[name]+'</a>')
    Please post DDL+DML for the [database_tags] table.
      Ronen Ariely
     [Personal Site]    [Blog]    [Facebook]

  • SQL Replace Function

    I have a small software to generate Letters. This is integrated with the Sales module. Both Sales and Letter modules are developed using Oracle10g.
    In the Letters module user can write his/her own letter and if we want to add some information from the sales module, he can include a tag. For example if the user wants to write a letter to a particular customer who has placed an order he will write as follows:
    "Customer: <CUSTOMER_NAME>
    Address: <CUSTOMER_ADDRESS>
    Thanks for placing order to us. Your order number is <ORDER_NUMBER>"
    Now the letter module automatically looks for tags in the letter typed by the user and replaced the tags with the appropriate values.
    But the problem I am facing is when the value of tag is on two lines the second line starts from position 1 like
    "Customer: Oracle Corporation
    Address: Oracle Corporation
    500 Oracle Parkway
    Redwood Shores, CA 94065
    Thanks for placing order to us. Your order number is 123"
    Please note that 2nd and 3rd lines of address are starting from position 1 where as it should look like
    "Customer: Oracle Corporation
    Address: Oracle Corporation
    500 Oracle Parkway
    Redwood Shores, CA 94065
    Thanks for placing order to us. Your order number is 123"
    (Note the spaces before 2nd and 3rd lines of address)
    My code is given below
    Please help
    FUNCTION PREPARE_LETTER_FORMAL_SUPPLIER(P_SUPPLIER_ID VARCHAR2,P_SUPPLIER_LOC_ID VARCHAR2,P_SUPPLIER_CONTACT_ID VARCHAR2, P_LETTER_ID NUMBER, P_STATION_ID VARCHAR2) RETURN VARCHAR2 IS
    V_TEXT VARCHAR2(4000);
    CURSOR C_LETTER_TAGS IS
    SELECT LT.COLUMN_NAME, LT.LETTER_TAG
    FROM LETTER_TAG_FORMAL LT;
    BEGIN
    SELECT L.TEXT
    INTO V_TEXT
    FROM LETTERS L
    WHERE L.LETTER_ID = P_LETTER_ID;
    FOR LP IN C_LETTER_TAGS LOOP
    IF INSTR( V_TEXT, LP.LETTER_TAG ) > 0 THEN
    V_TEXT := REPLACE( V_TEXT, LP.LETTER_TAG, GET_TAG_VALUE_FORMAL_SUPPLIER(P_SUPPLIER_ID ,P_SUPPLIER_LOC_ID , P_SUPPLIER_CONTACT_ID , LP.LETTER_TAG, P_STATION_ID));
    END IF;
    END LOOP;
    RETURN V_TEXT;
    END;
    FUNCTION GET_TAG_VALUE_FORMAL_SUPPLIER (P_SUPPLIER_ID VARCHAR2,P_SUPLIER_LOC_ID VARCHAR2,P_SUPPLIER_CONTACT_ID VARCHAR2, P_LETTER_TAG VARCHAR2,P_STATION_ID VARCHAR2) RETURN VARCHAR2 IS
    V_COLUMN_NAME VARCHAR2(30);
    V_VALUE VARCHAR2(4000);
    V_QUERY VARCHAR2(4000);
    BEGIN
    SELECT LT.COLUMN_NAME
    INTO V_COLUMN_NAME
    FROM LETTER_TAG_FORMAL LT
    WHERE UPPER(LT.LETTER_TAG) = UPPER(P_LETTER_TAG);
    V_QUERY :=
    'SELECT string_agg( DISTINCT ' || V_COLUMN_NAME || ') FROM(
    SELECT COMMON.GET_SUPPLIER('||P_SUPPLIER_ID||')SUPPLIER,
    SYSDATE DATED,
    COMMON.GET_SUPPLIER_LOCATION('||P_SUPLIER_LOC_ID||')SUPPLIER_LOCATION,
    COMMON.GET_SUPPLIER_ADDRESS('||P_SUPLIER_LOC_ID||')SUPPLIER_ADDRESS,
    COMMON.GET_SUPPLIER_ADDRESS2('||P_SUPLIER_LOC_ID||')SUPPLIER_ADDRESS_MAIL,
    COMMON.GET_COMPANY_BY_STATION('||P_STATION_ID||')COMPANY,
    LETTER.GET_MULTI_SUPPLIER_CONTACTS('||P_SUPLIER_LOC_ID||')SUPPLIER_CONTACT
    FROM DUAL
    EXECUTE IMMEDIATE( V_QUERY ) INTO V_VALUE;
    RETURN V_VALUE;
    END;

    an idea
    select 'Address: 1st line'||chr(10)||'2nd line'||chr(10)||'3rd line' old_address,
           replace('Address: 1st line'||chr(10)||'2nd line'||chr(10)||'3rd line',chr(10),rpad(chr(10),10)) new_address
      from dualRegards
    Etbin

  • Error Setting up PL*SQL (sqlplus.exe) on JDeveloper 10.1.3.3

    Hi,
    I recently installed JDeveloper and Oracle Express Edition. To set up SQL*Plus I went into Tools->Preferences->Database Connections and pointed the SQL*Plus executable to
    C:\oraclexe\app\oracle\product\10.2.0\server\BIN\sqlplus.exe
    which is part of the Oracle Express Edition. When I try to run an SQL query from JDeveloper I get the following error:
    The target sqlplus.exe cannot be started because it is not a runnable target.
    Double clicking on the file successfully runs sql*plus. Any ideas?
    Thanks
    Casson

    OK, This is the PL/SQL package:
    Function:
    FUNCTION Obtener_paises RETURN res_webservice AS
    v_respuesta res_webservice;
    i PLS_INTEGER:=1;
    CURSOR C_paises IS
    SELECT cpais, tpais
    FROM paises
    ORDER BY tpais;
    BEGIN
    v_respuesta := res_webservice(null,null);
    v_respuesta.error := res_error(null,null,null);
    v_respuesta.error.cerror := 0;
    v_respuesta.error.cerror_ora := 0;
    v_respuesta.error.terror := null;
    v_respuesta.datos := res_datos ();
    FOR v_pais IN C_paises LOOP
    v_respuesta.datos.extend;
    v_respuesta.datos(i) := reg_datos(null,null);
    v_respuesta.datos(i).codigo := v_pais.cpais;
    v_respuesta.datos(i).descripcion := v_pais.tpais;
    i := i + 1;
    END LOOP;
    Insertar_log(NULL,SYSDATE,'C','Obtener_paises',NULL,'ERROR:0');
    RETURN v_respuesta;
    EXCEPTION
    WHEN OTHERS THEN
    v_respuesta.error.cerror := 1;
    v_respuesta.error.cerror_ora := SQLCODE;
    v_respuesta.error.terror := substr(SQLERRM,1,80);
    Insertar_log(NULL,SYSDATE,'C','Obtener_paises',NULL,'ERROR:1 '||substr(SQLERRM,1,120));
    RETURN v_respuesta;
    END Obtener_paises;
    TYPES USED:
    CREATE OR REPLACE
    TYPE res_webservice AS OBJECT (error res_error, datos res_datos);
    CREATE OR REPLACE
    TYPE res_error AS OBJECT (cerror NUMBER(1), cerror_ora VARCHAR2(12), terror VARCHAR2(80));
    CREATE OR REPLACE
    TYPE res_datos AS TABLE OF reg_datos;
    CREATE OR REPLACE
    TYPE reg_datos AS OBJECT(codigo VARCHAR2(12), descripcion VARCHAR2(150));
    Thanks in advanced...
    Could happen this bacause of these defined types???

  • Error with User Type when publish a PL/SQL Web Service in JDeveloper

    Hi,
    I am using Jdeveloper 10.1.2.1 , have a PL/SQL package with these predefined types (types definition not include inside package);
    type reg_perfil as object (perfil varchar2(30), status varchar2(30))
    type tab_perfiles as table of reg_perfil
    type res_error as object (cerror number(1), cerror_ora varchar2(12), terror varchar2(50));
    type res_perfiles as object (error res_error, perfiles tab_perfiles)
    then I have a function:
    FUNCTION ff_perfiles(...) RETURN res_perfiles;
    When I publish from JDeveloper this package I get all the .java and sqlj files, but one of them is empty (TabperfilesUser.java) and of course compilation fails because it is looking for referenced class "TabPerfilesUser" that not exists!
    I know this is because is trying to map tab_perfiles type but there is some error.
    I realized that if I change the code of all files and replace "TabPerfilesUser" for "TabPerfilesBase" (this file and class was generated correctly) .... it works!!!, but of course I have to find another way to fixe it without changing generated code! (you know future maintenance).
    Is this a bug??? what could I do? ... by the way this happens also with JDveloper 10.1.3
    thanks...

    OK, This is the PL/SQL package:
    Function:
    FUNCTION Obtener_paises RETURN res_webservice AS
    v_respuesta res_webservice;
    i PLS_INTEGER:=1;
    CURSOR C_paises IS
    SELECT cpais, tpais
    FROM paises
    ORDER BY tpais;
    BEGIN
    v_respuesta := res_webservice(null,null);
    v_respuesta.error := res_error(null,null,null);
    v_respuesta.error.cerror := 0;
    v_respuesta.error.cerror_ora := 0;
    v_respuesta.error.terror := null;
    v_respuesta.datos := res_datos ();
    FOR v_pais IN C_paises LOOP
    v_respuesta.datos.extend;
    v_respuesta.datos(i) := reg_datos(null,null);
    v_respuesta.datos(i).codigo := v_pais.cpais;
    v_respuesta.datos(i).descripcion := v_pais.tpais;
    i := i + 1;
    END LOOP;
    Insertar_log(NULL,SYSDATE,'C','Obtener_paises',NULL,'ERROR:0');
    RETURN v_respuesta;
    EXCEPTION
    WHEN OTHERS THEN
    v_respuesta.error.cerror := 1;
    v_respuesta.error.cerror_ora := SQLCODE;
    v_respuesta.error.terror := substr(SQLERRM,1,80);
    Insertar_log(NULL,SYSDATE,'C','Obtener_paises',NULL,'ERROR:1 '||substr(SQLERRM,1,120));
    RETURN v_respuesta;
    END Obtener_paises;
    TYPES USED:
    CREATE OR REPLACE
    TYPE res_webservice AS OBJECT (error res_error, datos res_datos);
    CREATE OR REPLACE
    TYPE res_error AS OBJECT (cerror NUMBER(1), cerror_ora VARCHAR2(12), terror VARCHAR2(80));
    CREATE OR REPLACE
    TYPE res_datos AS TABLE OF reg_datos;
    CREATE OR REPLACE
    TYPE reg_datos AS OBJECT(codigo VARCHAR2(12), descripcion VARCHAR2(150));
    Thanks in advanced...
    Could happen this bacause of these defined types???

  • Error when publishing a PL/SQL Web Service with JDeveloper 10.1.3!!!!!!!!!

    Hi,
    When I publish a PL/SQL package as a web service in J2EE 1.4 (Jax-RPC) Web Service version get this error:
    oracle.j2ee.ws.common.tools.api.ValidationException: Error in database webservices assembly
         at oracle.j2ee.ws.tools.wsa.db.WSADBPlugin.processDBEndpoint(WSADBPlugin.java:329)
         at oracle.j2ee.ws.tools.wsa.Util.processDBEndpoint(Util.java:887)
         at oracle.jdeveloper.webservices.model.plsql.PLSQLGenerator.preparePLSQLPortTypes(PLSQLGenerator.java:734)
         at oracle.jdeveloper.webservices.model.plsql.PLSQLGenerator.doGeneration(PLSQLGenerator.java:233)
         at oracle.jdeveloper.webservices.model.Generator.generateImpl(Generator.java:447)
         at oracle.jdeveloper.webservices.model.Generator.generate(Generator.java:295)
         at oracle.jdeveloper.webservices.model.WebService.saveEditImpl(WebService.java:3971)
         at oracle.jdeveloper.webservices.model.WebService.mav$saveEditImpl(WebService.java)
         at oracle.jdeveloper.webservices.model.WebService$1.run(WebService.java:3817)
         at oracle.jdeveloper.webservices.model.GeneratorUI$GeneratorAction.run(GeneratorUI.java:446)
         at oracle.ide.dialogs.ProgressBar.run(ProgressBar.java:551)
         at java.lang.Thread.run(Thread.java:595)
    GRAVE: JPublisher error: please check assembler settings, database connection and database schema. Use debug=true for details.
    and when use J2EE 1.3 (Oracle) version WEb Service get this error:
    java.lang.NullPointerException
    at oracle.jdevimpl.webservices.generator.WrapperClassGenerator.generate(WrapperClassGenerator.java:262)
    at oracle.jdevimpl.webservices.generator.SPWebServiceGenerator$1.run(SPWebServiceGenerator.java:285)
    at oracle.ide.dialogs.ProgressBar.run(ProgressBar.java:551)
    at java.lang.Thread.run(Thread.java:595)
    ..... Is this a BUG????
    please help!

    OK, This is the PL/SQL package:
    Function:
    FUNCTION Obtener_paises RETURN res_webservice AS
    v_respuesta res_webservice;
    i PLS_INTEGER:=1;
    CURSOR C_paises IS
    SELECT cpais, tpais
    FROM paises
    ORDER BY tpais;
    BEGIN
    v_respuesta := res_webservice(null,null);
    v_respuesta.error := res_error(null,null,null);
    v_respuesta.error.cerror := 0;
    v_respuesta.error.cerror_ora := 0;
    v_respuesta.error.terror := null;
    v_respuesta.datos := res_datos ();
    FOR v_pais IN C_paises LOOP
    v_respuesta.datos.extend;
    v_respuesta.datos(i) := reg_datos(null,null);
    v_respuesta.datos(i).codigo := v_pais.cpais;
    v_respuesta.datos(i).descripcion := v_pais.tpais;
    i := i + 1;
    END LOOP;
    Insertar_log(NULL,SYSDATE,'C','Obtener_paises',NULL,'ERROR:0');
    RETURN v_respuesta;
    EXCEPTION
    WHEN OTHERS THEN
    v_respuesta.error.cerror := 1;
    v_respuesta.error.cerror_ora := SQLCODE;
    v_respuesta.error.terror := substr(SQLERRM,1,80);
    Insertar_log(NULL,SYSDATE,'C','Obtener_paises',NULL,'ERROR:1 '||substr(SQLERRM,1,120));
    RETURN v_respuesta;
    END Obtener_paises;
    TYPES USED:
    CREATE OR REPLACE
    TYPE res_webservice AS OBJECT (error res_error, datos res_datos);
    CREATE OR REPLACE
    TYPE res_error AS OBJECT (cerror NUMBER(1), cerror_ora VARCHAR2(12), terror VARCHAR2(80));
    CREATE OR REPLACE
    TYPE res_datos AS TABLE OF reg_datos;
    CREATE OR REPLACE
    TYPE reg_datos AS OBJECT(codigo VARCHAR2(12), descripcion VARCHAR2(150));
    Thanks in advanced...
    Could happen this bacause of these defined types???

  • Urgent : Error while creating PL/SQL web service in JDeveloper 11R2

    Hi,
    I am new to web services and I have a requirement to create web services in PL/SQL. I installed JDeveloper 11R2 in my machine and connected it to my local schema.
    My database is Oracle 10g.
    I am able to see my package in JDeveloper. But when I try to "Publish as JAX-RPC web service..."I am getting the following error:
    oracle.jdeveloper.webservices.tools.WsdlValidationException: oracle.j2ee.ws.common.tools.api.ValidationException: Error in database webservices assembly
    Error in database webservices assembly
         at oracle.jdevimpl.webservices.tools.wsa.WsaAdaptor.newWsdlValidationException(WsaAdaptor.java:1126)
         at oracle.jdevimpl.webservices.tools.wsa.WsaAdaptor.processDbEndpoint(WsaAdaptor.java:609)
         at oracle.jdeveloper.webservices.tools.WebServiceTools.processDbEndpoint(WebServiceTools.java:689)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at oracle.jdeveloper.webservices.tools.WebServiceTools$1.invoke(WebServiceTools.java:132)
         at $Proxy28.processDbEndpoint(Unknown Source)
         at oracle.jdeveloper.webservices.model.plsql.generator.PlsqlConfigureGenerator.createPortTypes(PlsqlConfigureGenerator.java:293)
         at oracle.jdeveloper.webservices.model.generator.ConfigureServiceGenerator.action(ConfigureServiceGenerator.java:66)
         at oracle.jdeveloper.webservices.model.plsql.generator.PlsqlConfigureGenerator.action(PlsqlConfigureGenerator.java:105)
         at oracle.jdeveloper.webservices.model.generator.GeneratorAction.run(GeneratorAction.java:142)
         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
         at java.lang.Thread.run(Thread.java:662)
    Caused by: oracle.j2ee.ws.common.tools.api.ValidationException: Error in database webservices assembly
         at oracle.j2ee.ws.tools.wsa.db.WSADBPlugin.processDBEndpoint(WSADBPlugin.java:207)
         at oracle.j2ee.ws.tools.wsa.Util.processDBEndpoint(Util.java:1221)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at oracle.jdevimpl.webservices.util.Debug.invoke(Debug.java:343)
         at oracle.jdevimpl.webservices.tools.wsa.Assembler$2$1.invoke(Assembler.java:217)
         at $Proxy29.processDBEndpoint(Unknown Source)
         at oracle.jdevimpl.webservices.tools.wsa.WsaAdaptor.processDbEndpoint(WsaAdaptor.java:598)
         ... 14 more.
    When I searched in google I came across solutions like "The error is caused by missing SYS.SQLJUTL definition in XE. " But my database is not XE and one more thing I noticed is there is no start_oc4j.bat file in the JDeveloper home.
    I would appreciate if anybody can throw some light on the issue.
    Regards,
    BJ

    OK, This is the PL/SQL package:
    Function:
    FUNCTION Obtener_paises RETURN res_webservice AS
    v_respuesta res_webservice;
    i PLS_INTEGER:=1;
    CURSOR C_paises IS
    SELECT cpais, tpais
    FROM paises
    ORDER BY tpais;
    BEGIN
    v_respuesta := res_webservice(null,null);
    v_respuesta.error := res_error(null,null,null);
    v_respuesta.error.cerror := 0;
    v_respuesta.error.cerror_ora := 0;
    v_respuesta.error.terror := null;
    v_respuesta.datos := res_datos ();
    FOR v_pais IN C_paises LOOP
    v_respuesta.datos.extend;
    v_respuesta.datos(i) := reg_datos(null,null);
    v_respuesta.datos(i).codigo := v_pais.cpais;
    v_respuesta.datos(i).descripcion := v_pais.tpais;
    i := i + 1;
    END LOOP;
    Insertar_log(NULL,SYSDATE,'C','Obtener_paises',NULL,'ERROR:0');
    RETURN v_respuesta;
    EXCEPTION
    WHEN OTHERS THEN
    v_respuesta.error.cerror := 1;
    v_respuesta.error.cerror_ora := SQLCODE;
    v_respuesta.error.terror := substr(SQLERRM,1,80);
    Insertar_log(NULL,SYSDATE,'C','Obtener_paises',NULL,'ERROR:1 '||substr(SQLERRM,1,120));
    RETURN v_respuesta;
    END Obtener_paises;
    TYPES USED:
    CREATE OR REPLACE
    TYPE res_webservice AS OBJECT (error res_error, datos res_datos);
    CREATE OR REPLACE
    TYPE res_error AS OBJECT (cerror NUMBER(1), cerror_ora VARCHAR2(12), terror VARCHAR2(80));
    CREATE OR REPLACE
    TYPE res_datos AS TABLE OF reg_datos;
    CREATE OR REPLACE
    TYPE reg_datos AS OBJECT(codigo VARCHAR2(12), descripcion VARCHAR2(150));
    Thanks in advanced...
    Could happen this bacause of these defined types???

  • How to Passing clob to PL/SQL pipeline function

    I have a PL/SQL stored function which takes clob as input parameter and sends the results in a pipe line.
    create or replace function GetIds(p_list clob, p_del varchar2 := ',') return ideset_t pipelined is
    I am using ojdbc14.jar (Oracle 10g driver) with oracle 9i (9.2.0.1.0).
    I want to use the following SQL Query select * from table(GetIds(clob))
    Now the question is how can I pass the clob from JDBC?
    Here is my client code
    PreparedStatement stmt = con.prepareStatement("SELECT COLUMN_VALUE FROM TABLE(GETIDS(?, ','))");
    stmt.setCharacterStream(1, new StringReader(str), str.length());
    stmt.executeQuery();
    I get the following error when I try to run the program. The same thing works fine if the chracter lenght is less than some chaaracters.
    java.sql.SQLException: ORA-01460: unimplemented or unreasonable conversion requested
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:305)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:272)
         at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:623)
         at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:181)
         at oracle.jdbc.driver.T4CPreparedStatement.execute_for_describe(T4CPreparedStatement.java:420)
         at oracle.jdbc.driver.OracleStatement.execute_maybe_describe(OracleStatement.java:896)
         at oracle.jdbc.driver.T4CPreparedStatement.execute_maybe_describe(T4CPreparedStatement.java:452)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:986)
         at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2888)
         at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:2960)
         at Test.main(Test.java:42)
    Exception in thread "main"
    The setChracterStream works for any insert/update clob. Example when I tried the query (INSERT INTO CLOB_TEST VALUES(?)) setCharacterStream just works fine.
    Please any one can help me how to solve this.
    Thanks in advance.

    Hóla LuÃs,
    when you pick the PL/SQL function body returning a boolean, it implicitly means that TRUE means OK, while FALSE means error, always.
    In order to associate such error to a given form field, you have to go back to the page definiton / validations and specify the name of the item in the corresponding field.
    When you first create the validation rule, this value is not present even if you ask for the error message inline with the field.
    The error message text can be specified in the validation definition, if I am not wrong.
    When you need to return special error messages, including dynamic content for instance, you can use the Function Returning Error Message type, which reports an error when the string returned by the function is not null. This comes in handy when you want to display an item's code, for example, rather than generic text.
    Even in this case, you must go back to the validation and specify the name of the field if you want to see it inline.
    Hope it helps,
    Flavio

  • Query of queries disallows SQL right() function

    We're attempting to do a query of queries using the SQL
    right() function like this:
    select *
    from getresults
    where right([key],charindex('\',reverse([key]),1)-1) not in
    (#quotedvaluelist(getexcluded.file_name)#)
    We've even replaced that where clause with a much more simple
    where right([key])='m'
    just to make sure that it wasn't the nesting functions that
    were causing the problem.
    In either case, we get the error:
    Query of Queries syntax error.
    Encountered "right" at line 0, column 0. Incorrect
    conditional expression,
    Expected one of [like|null|between|in|comparison] condition,
    What SQL functions are disallowed from query of queries?
    Thanks,
    Kris

    Nasty stuff huh. Just happened to discover myself today that
    Left doesn't work. I'd suspect that Aggregate functions are the
    ONLY ones that will work. It would have been nice if they'd at
    least allowed CF vs DB functions in their own "database" language.
    BTW, also discovered that Count() returns Null rather than 0
    when there aren't any per your WHERE clause.

  • Replace() function doesn't work in Application Designer?

    I'm using PeopleSoft Application Designer 8.51. I'm trying to do a simple Replace function so I can escape single quotes rather than allow them to blow up the sql query.
    &deptid = Replace(&deptid, "'", "''");
    App Designer chokes when I hit Save: "Invalid function parameter type. (2,19)"
    According to the docs I'm using this correctly: http://docs.oracle.com/cd/E26239_01/pt851h3/eng/psbooks/tace/book.htm?File=tace/htm/tace14.htm#H4095
    Even if I try to execute the example right out of the documentation, I get the same error: REPLACE("StringFun", "Fun", "Number");
    Is this a bug in app designer? REPLACE is a super common thing, it's not something obscure. How can this not work?
    Thanks in advance.

    I figured this out. “Replace” is a strange duck function that relies on offsets. “Substitute” is the magic I needed, works just like I was expecting Replace to work. The documentation I was reading on Replace was for “ PeopleSoft Analytic Calculation Engine” rather than peoplecode. I’ll pay closer attention to that next time. Maybe this will help someone else...

  • Replace function not working for XML CLOB data

    Hi all,
    I am generating XML using DBMS_XMLGEN in oracle 10g. After generating the XML, I am replacing the ROW tags with appropriate tag name using REPLACE function. Sometimes the tag name is not replaced correctly.
    Eg.I am replacing </Cargo_ROW> with </CargoDetail>. But sometimes in one xml, this tag is coming as </CargoDetROW> or </CargoDetaiW>. The XML size is always huge and the same tag is repeated so many time in the loop and in the same XML, only one tag will be replaced incorrectly. This also not happening for all XMLs.
    If any one knows the cause about this problem or solution, please share the same.
    thanks,

    Yes Anton, you are right..
    It was typecasting problem
    replace supports clob
    Check this out
    SQL> declare
      2  xmldata clob;
      3  Begin
      4  xmldata:='<Message transaction_log_id="" extraction_date="25/11/09 09:52:03 AM" versio
      5  <Transaction>
      6  <TransactionType>ORIGINAL</TransactionType>
      7  <ControlNumber>60022449779</ControlNumber>
      8  <BookingHeader>
      9  <PortCodeOriginal>GBSOU</PortCodeOriginal>
    10  <Contact>.</Contact>
    11  <PhoneContact>.</PhoneContact>
    12  </BookingHeader>
    13  <PartyInformation>
    14  <PartyDetails>
    15  <PartyId>10002866</PartyId>
    16  <Type>SHIP</Type>
    17  <Name1>L LTD.</Name1>
    18  </PartyDetails>
    19  </PartyInformation>
    20  <Cargo>
    21  <CargoDetROW>
    22  <CargoHeader>
    23  <CargoReceivedSeqNo>600015391790</CargoReceivedSeqNo>
    24  <CargoId>RW9330P013948</CargoId>
    25  </CargoHeader>
    26  <CargoDimensions>
    27  <Length>1</Length>
    28  <Width>2</Width>
    29  </CargoDimensions>
    30  </CargoDetail>
    31  <CargoDetROW>
    32  <CargoHeader>
    33  <CargoReceivedSeqNo>600015391791</CargoReceivedSeqNo>
    34  <CargoId>RW9330P01394AA</CargoId>
    35  </CargoHeader>
    36  <CargoDimensions>
    37  <Length>2</Length>
    38  <Width>2</Width>
    39  </CargoDimensions>
    40  </CargoDetail>
    41  <Cargo_ROW>
    42  <CargoHeader>
    43  <CargoReceivedSeqNo>600015391792</CargoReceivedSeqNo>
    44  <CargoId>RW9330P01322</CargoId>
    45  </CargoDetaiW>
    46  <CargoDimensions>
    47  <Length>1</Length>
    48  <Width>2</Width>
    49  </CargoDimensions>
    50  </Cargo_ROW>
    51  </Cargo>
    52  </Transaction>
    53  </Message>';
    54  xmldata:=to_clob(regexp_replac(xmldata,'</Cargo_ROW>|</CargoDetaiW>|</CargoDetROW>','</CargoDetail'));
    55  xmldata:=to_clob(regexp_replace(xmldata,'<Cargo_ROW>|<CargoDetaiW>|<CargoDetROW>','<CargoDetail>'));
    56  dbms_output.put_line(xmldata);
    57  end;
    58  /
    <Message transaction_log_id="" extraction_date="25/11/09 09:52:03 AM"
    version="1.0">
    <Transaction>
    <TransactionType>ORIGINAL</TransactionType>
    <Contro
    lNumber>60022449779</ControlNumber>
    <BookingHeader>
    <PortCodeOriginal>GBSOU</Por
    tCodeOriginal>
    <Contact>.</Contact>
    <PhoneContact>.</PhoneContact>
    </BookingHead
    er>
    <PartyInformation>
    <PartyDetails>
    <PartyId>10002866</PartyId>
    <Type>SHIP</Ty
    pe>
    <Name1>L
    LTD.</Name1>
    </PartyDetails>
    </PartyInformation>
    <Cargo>
    <CargoDetail>
    <CargoHea
    der>
    <CargoReceivedSeqNo>600015391790</CargoReceivedSeqNo>
    <CargoId>RW9330P01394
    8</CargoId>
    </CargoHeader>
    <CargoDimensions>
    <Length>1</Length>
    <Width>2</Width>
    </CargoDimensions>
    </CargoDetail>
    <CargoDetail>
    <CargoHeader>
    <CargoReceivedSeq
    No>600015391791</CargoReceivedSeqNo>
    <CargoId>RW9330P01394AA</CargoId>
    </CargoHe
    ader>
    <CargoDimensions>
    <Length>2</Length>
    <Width>2</Width>
    </CargoDimensions>
    <
    /CargoDetail>
    <CargoDetail>
    <CargoHeader>
    <CargoReceivedSeqNo>600015391792</Carg
    oReceivedSeqNo>
    <CargoId>RW9330P01322</CargoId>
    </CargoDetail>
    <CargoDimensions>
    <Length>1</Length>
    <Width>2</Width>
    </CargoDimensions>
    </CargoDetail>
    </Cargo>
    </Transaction>
    </Message>
    PL/SQL procedure successfully completed.
    SQL> Twinkle
    Edited by: Twinkle on Nov 26, 2009 6:05 PM

  • Sql like function in View Object for progammatically

    Hi friends,
    I used Jdeveloper 11.1.1.4.0 ,I need how to get the datas from database using sql like function(select * from tablename where name like 'p%') using viewCriteria by
    programmatically.
    Thanks & Regards,
    Priya.
    Edited by: priya on Apr 8, 2011 3:48 AM
    Edited by: priya on Apr 8, 2011 3:49 AM

    Check the docs: http://download.oracle.com/docs/cd/E15523_01/web.1111/b31974/bcadvvo.htm#sm0341
    Timo

  • Replace function in TT7

    Hi,
    I have a database in TT Release 7.0.3.1.0 and other in Release 11.2.2.4.0. I need use replace sql function over Release 7.0.3.1.0.
    I know that it not apply in this version but I've tried with ttIsqlCS in node with TT11 through connection in database TT7 but I received this error:
    ttIsqlCS database_test_R7
    Command> select replace('asjkhdfkhaskdh','a','1') from dual;
    2818: Unknown function REPLACE
    The command failed.
    Command> version;
    TimesTen Release 11.2.2.4.0
    Any idea ??
    Thanks in advance.
    Babs.

    Hi Babs,
    I am afraid that you are out of luck. SQL is implemented in the TimesTen engine/libraries not in the ttIsql client. Since 7.0 SQL does not have th REPLACE() function there is no way to execute that in 7.0 regardless of the client you use. You'll need to find some other option to accomplish what you require (maybe upgrade the 7.0 database to 11.2.2?).
    Chris

Maybe you are looking for