Oracle SQL trim() vs MS Excel clean()

I have some data being extracted from Oracle 11 db views into CSV files.
When importing the data into some other system, said other system's data importer crashes.
I can open the CSV files in MS Excel, apply its clean() function to some columns, paste the values of that, and then the CSV file is a bit smaller, unprintable characters are removed, and data importer in new system is OK.
Its a cumbersome process.
I tried Oracle SQL trim() but it doesn't remove all the chars, it seems, that MS Excel clean() function removes.
Is there a comparable Oracle SQL function that does what [MS Excel clean()|http://office.microsoft.com/en-us/excel-help/clean-HP005209014.aspx] does?
Edited by: 972095 on Nov 19, 2012 2:35 PM

I've used: regexp_replace(your_string,'[[:cntrl:]]') for this.
SQL> declare
  2     s varchar2(30) := chr(10) || 'hello' || chr(10);
  3  begin
  4     dbms_output.put_line('*' || s || '*');
  5     dbms_output.put_line('*' || regexp_replace(s,'[[:cntrl:]]') || '*');
  6  end;
  7  /
hello
*hello*
PL/SQL procedure successfully completed.

Similar Messages

  • Oracle SQL Query from EXCEL 2007 with prompt

    Hello,
    I have many excel reports where I am pulling information from our Oracle 9 db through Excel using the following method:
    http://blog.mclaughlinsoftware.com/microsoft-excel/how-to-query-oracle-from-excel-2007/
    http://blog.mclaughlinsoftware.com/2009/11/30/sql-query-in-excel-2007/
    However, I am having trouble when I try the following query due to the prompt:
    SELECT
    IM.ITEM_GROUP,
    IM.ITEM,
    IM.DESCRIPTION
    FROM
    LAWSON.ITEMMAST IM
    WHERE
    IM.ITEM = '&ITEM';
    Does any one know how I can connect a prompt to an excel cell and then pass the query on to Oracle, or have a PL SQL prompt work from Excel?
    Thanks,
    Ben

    The 'prompt' as you call it is a sqlplus feature, so does not belong to the SQL language
    You would need to write a stored procedure returning a resultset.
    create or replace procedure foo(rc in out sys_refcursor, p_item) as
    begin
    open rc for
    'SELECT
    IM.ITEM_GROUP,
    IM.ITEM,
    IM.DESCRIPTION
    FROM
    LAWSON.ITEMMAST IM
    WHERE
    IM.ITEM = '||p_item;
    end;
    and call that using ODBC or asp.net
    Obviously this is profusely documented.
    Sybrand Bakker
    Senior Oracle DBA

  • Copying SQL Script from Oracle SQL Developer into Excel with formatting

    I need to copy a SQL Script into Excel in order to develop some VBA code. Is there any nice way that I can copy SQL Script from Oracle SQL Developer into Excel and retain its formatting? I am a stickler for having legible, readable SQL and like to have all my columns lined up and aliases lined up. When we used to use SQL Navigator, the tab formatting seemed to copy and paste just fine. Now that we have migrated to Oracle SQL Developer, the formatting seems to get all messed up.
    And suggestions are greatly appreciated and Thanks in advance for your review and am hopeful for an answer.
    Thanks.
    PSULionRP

    I suppose you want a real tabulator instead of spaces. You can configure this in the preferences (SQL Formatter - Oracle). You have to apply it then to your existing code (e.g. CTRL-F7), but new code should get it right from the start.
    Hope that helps,
    K.

  • Oracle SQL/ Excel Visual Basic Consulting Opportunity in New York City

    Hello:
    Is anyone interested in a consulting opportunity?
    I am marketing director for a catalog/internet business in Manhattan. I am running Oracle 9.2i . We use the datawarehouse for many marketing/merchandising reports. I have SQL code embedded in Excel workbooks using an ODBC interface. The SQL code gets the data and then I have a lot of Visual Basic macros that run and create the reports.
    I need someone to come in and help me optimize the queries and macros (since I am self-taught on both SQL and VB there is LOTS of room for improvement).
    Since some of the reports are popular, I am getting overwhelmed with requests for new reports and it is taking time away from my marketing responsibilities.
    If anyone out there is interested, please let me know
    Thanks

    Hello:
    Is anyone interested in a consulting opportunity?
    I am marketing director for a catalog/internet
    business in Manhattan. I am running Oracle 9.2i .Sounds interesting, but as you can see in my profile, I'm not able to just "come in". Maybe someone else here wants to pick up this opportunity.
    We use the datawarehouse for many
    y marketing/merchandising reports. I have SQL code
    embedded in Excel workbooks using an ODBC interface.Reminds me of one of my customers that had a ms access frontend and oracle backend.
    The SQL code gets the data and then I have a lot of
    f Visual Basic macros that run and create the
    reports. Memories comin' back ... ;-)
    I need someone to come in and help me optimize the
    queries and macros (since I am self-taught on both
    SQL and VB there is LOTS of room for improvement). I'd say one approach could be to move some of the logic to views or pipelined functions, maybe ref cursors.
    Since some of the reports are popular, I am getting
    overwhelmed with requests for new reports and it is
    taking time away from my marketing responsibilities.Maybe it's also time to rethink the tool selection? ms access or a decent report generator could be an option.
    C.

  • Power Query for Excel - Need Help with Oracle SQL Syntax

    Hello everyone,
    I am new to Power Query and am not able to figure this out.  I am trying to pull in data into my Excel spreadsheet using a specific Oracle SQL query.  While in query editor, how do I take the Oracle.Database function and add my SQL statement? 
    I already know what I want, I don't want it to download all the table names.  According to the help page, I should be able to do this but it does not provide a syntax example
    Also, I don't understand what "optional options as nullable record" means.
    Below is what function and arguments the help page notes.  How do I use this?
    Oracle.Database(server as text, optional options as nullable record) as table
    Any help is greatly appreciated.
    Thank you,
    Jessica

    When I try this, I get an error 
    DataSource.Error: Oracle: Sql.Database does not support the query option 'Query' with value '"Select * from Owner.View_Name"'. Details: null
    I'm trying to download oracle data from a view into power query - Power Query navigator does not list th eviews from my source, it lists only the tables. When I try write sql statements, it throws me the above
    error. This is what I tried
     Oracle.Database("Source/Service",[Query="Select * from Owner.View_Name"])
    Any ideas how to fix this? 

  • Import data using Excel and Oracle SQL Developer - I need some help

    Dear friends,
    I'm using Oracle SQL Developer 1.5.1 and I need to import an Excel file into a database table. If I try to import this file in XLS format, fields and headers are correctly being shown and separated, but if I press "Next" button, it simply doesn't do anything - it stays stopped.
    I did some search here in this forum and it seems to me that, when you try to import a file via XLS format, SQL Developer has bugs. Is this correct?
    If I save the same file in CSV format and try to import the same file, it goes ahead, but SQL Developer is not separating fields and headers correctly. It combines all CSV fields into one - let's say Column0 and fields 1;TEST;01/01/2000 below the same Column0.
    Saving the file in CSV format is not a problem, taking a very little time. But I don't know how to make SQL Developer import it correctly. Could somebody please help me? Thanks in advance.
    Best regards,
    Franklin

    Hello K,
    yes, you're right. I found the following topic after posting this question here.
    Re: After update to 1.5.1, import from Excel fails
    I downloaded version 1.5.0 and I'll use it whenever I import data from Excel.
    Thanks,
    Franklin

  • Data Transformation Service (DTS) available in Oracle SQL Developer?

    Hi All,
    Sorry to bother you again. Is Data Transformation Service (DTS) available in Oracle SQL Developer? So far I cannot find it. For example, i want merge First Name, Last Name column from Access,excel or cvs to migrate as Full Name in Oracle or Full name in Access,Xls or cvs split into First name & last name column in Oracle. What method or service should I use.
    Regards,
    Tun Tun

    On wikipedia, I see that's a SQL Server component, so I don't think it's possible to use it in any other program.
    But you can always tweak columns through normal queries, and even create a new table based on that, like
    CREATE TABLE Table_New AS
    SELECT First_Name || Last_Name FROM Table_OldHope that helps,
    K.

  • Differences between TOAD for Oracle and Oracle SQL Developer?

    Does someone know the advantages and disadvantages of using TOAD for Oracle and Oracle SQL Developer?
    I work making reports with TOAD, but in a few days I will have to use the SQL Developer (because it´s free) unless I justify the necessity of using TOAD.
    Could some that used both compare them?
    Thanks,
    Facundo.

    Hello Facundo,
    since we are rolling out new client PCs we switch from Toad to SQL Developer. Therefore I'm doing some training for the "normal" users and our developers.
    Most users simply want to have access to the data in tables and views. For those there are 2 main issues:
    - Filters get lost when exiting table while sorting is still applied. Since there is no way to apply filtering before entering the data tab this can become a great performance issue because sorting is applied to many many rows. For views it is sometimes impossible to open the data tab.
    - Exporting date values to Excel needs some know how if you want to sort by this column in Excel, because the date is formatted as "Standard" meaning that the sorting is done as for a text column: 01.01.2009 is less than 02.01.2008. Here you have to use a workaround column with a formula (=1*<datecolumn>)
    The greatest Pro is the easy sharing of connections and reports by XML files.
    Our developers like the easy debugging in SQL Developer. Though they miss the feature that the source is compiled for debug automatically as in Toad. For this we have distributed a script that compiles any PL/SQL object for debugging.
    There are only some Toads installed for DBAs and for users that need access to tables protected by policies that require authentification by OS user since this information is not passed under every circumstance.
    Regards
    Marcus

  • Oracle SQL developer tool vs toad

    Hi - I am trying to do a feature comparison on these 2 tools and am not very familiar with them could someone please tell me if Oracle SQL developer tool has these features:
    Project Manager
    Result Set Compare
    Chart Designer
    Toad Report Wizard
    Pivot & Chart
    Data Compare and Synch
    Automation
    Simple Cross-Platform Queries
    Advanced Cros-Platform Queries
    Local Data Storage
    Data Transformation and Cleansing
    Data Browser
    ER Diagrammer
    Charts & Pivot Table Reports
    Automation & Scheduling Engine
    Data Compare & Sync
    Cross-connection Query

    Hi!
    I have worked with several Oracle IDE's in the past:
    * TOAD
    * PL/SQL Developer
    * Navigator
    * SQL/Developer
    Right now I tend to do most of my work with SQL-Developer and only some tasks with TOAD.
    SQL-Developer feels faster and has a cleaner interface than TOAD, while TOAD has better tools.
    Im currently publishing a series of tips for SQL-Developer in my blog:
    http://oracledeli.wordpress.com/
    Some of the posts are focussing on overcomming SQL-developers disadvantages versus TOAD:
    * SQL-Developer: Using macros http://oracledeli.wordpress.com/2011/09/28/sql-developer_using_macros/
    * Execute current worksheet file via SQL*Plus (external tools) http://oracledeli.wordpress.com/2011/09/23/sql-developer_execute_via_sqlplus/
    Best regards,
    Matt
    Best regards,
    Matt

  • Ms sql date format is coming as oracle.sql.TIMESTAMP

    Hi,
    Instead of getting the date as mm-dd-yy i am getting the dates in ms sql as below. Can someone pls advise how to rectify this.. Thanks
    oracle.sql.TIMESTAMP@16dcbc9
    oracle.sql.TIMESTAMP@15e3974
    oracle.sql.TIMESTAMP@10e0904
    oracle.sql.TIMESTAMP@721e92

    Rectify what?
    No Oracle database version number?
    Where is the table's DDL or description?
    No idea what you are getting the date from ... is it MS SQL across a heterogenous link or a .NET app?
    No idea what tool you are using ... SQL*Plus or TOAD or Excel with ODBC
    If you want help you need to provide sufficient information such that the person trying to help you understands what is actually happening.
    Try as I might I can not look through my monitor and see yours. ;-)

  • Oracle.sql.AnyDataFactory ThreadLocal? causing classloader leak

    I am running a standard Jersey (JAX-RS), Spring, JPA, Hibernate, Oracle application on Tomcat.
    Hot-redeploys to Tomcat 6.0.32 are causing classloader leaks which you can see with the Find Leaks button on the manager page.
    Using jmap and Memory Analyzer Tool, I can see two objects that are keeping the classloader from gc'ing.
    The first is that the Diagnosability MBean is not getting unregistered. That is easy to find and unregister.
    The other is a ThreadLocal in oracle.sql.AnyDataFactory but as I have no code (and a static field for it is not available), I don't see how to clean that up.
    Also the ThreadLocal reporting that Tomcat does doesn't find it which is odd.
    Any thoughts? Are other people seeing this?
    Brian

    Hi, I realize this is an old thread, but I reached the exact same conclusion for a classloader leak in my app and I couldn't find any other solution. Did you?
    I found the same two classes: oracle.jdbc.driver.OracleDiagnosabilityMBean and oracle.sql.AnyDataFactory
    I guess moving the driver to the global lib folder will solve the redeploy problem but I always found more practical to have the driver in the war.

  • Exported CSV files are locked by Oracle SQL Developer 2.1.0.63

    Whenever I export my query result into a CSV file, the resulting file is always locked for editing by Oracle SQL Developer 2.1.0.63.
    Have anybody encountered the same problem? Do you know how can I report this as a bug to Oracle?
    Thanks,
    Adrian Wijasa
    Banner Programmer/Analyst
    College of St. Benedict/St. John's University MN
    [email protected]

    I got it too if I left SQl Developer open then go to Excel to edit my CSV - got message 'table_export.csv is locked for editing by another user'. If I close SQL Developer then open the file, it works. Seems SQL Developer's holding onto the file after creation.
    Bugs are being reported in this forum.
    Evita
    Edited by: Evita on Jan 8, 2010 12:53 PM

  • Java.sql.SQLException: [Microsoft][ODBC Excel Driver] Syntax err

    Hi
    I am trying to implement the bulk data transfer from source(DB) and target(Excel File) but i am getting the below error.
    can some please help me on that.
    Knowledge USED:
    LKM SQL TO SQL
    IKM SQL INCREMENTAL UPDATE
    CODE:
    create table C$_0Sheet1
    *     C1_TEST     NUMBER(15)*
    ODI-1228: Task SrcSet0 (Loading) fails on the target MICROSOFT_EXCEL connection Ms_EXCE_TGT.
    Caused By: java.sql.SQLException: [Microsoft][ODBC Excel Driver] Syntax error in CREATE TABLE statement.
         at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6957)
         at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7114)
         at sun.jdbc.odbc.JdbcOdbc.SQLPrepare(JdbcOdbc.java:4830)
         at sun.jdbc.odbc.JdbcOdbcConnection.prepareStatement(JdbcOdbcConnection.java:475)
         at sun.jdbc.odbc.JdbcOdbcConnection.prepareStatement(JdbcOdbcConnection.java:443)
         at sun.reflect.GeneratedMethodAccessor70.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at oracle.odi.core.datasource.dwgobject.support.OnConnectOnDisconnectDataSourceAdapter$OnDisconnectCommandExecutionHandler.invoke(OnConnectOnDisconnectDataSourceAdapter.java:200)
         at $Proxy2.prepareStatement(Unknown Source)
         at oracle.odi.runtime.agent.execution.sql.SQLCommand.doInitializeStatement(SQLCommand.java:83)
         at oracle.odi.runtime.agent.execution.sql.SQLCommand.getStatement(SQLCommand.java:117)
         at oracle.odi.runtime.agent.execution.sql.SQLCommand.getStatement(SQLCommand.java:111)
         at oracle.odi.runtime.agent.execution.sql.SQLCommand.execute(SQLCommand.java:158)
         at oracle.odi.runtime.agent.execution.sql.SQLExecutor.execute(SQLExecutor.java:102)
         at oracle.odi.runtime.agent.execution.sql.SQLExecutor.execute(SQLExecutor.java:1)
         at oracle.odi.runtime.agent.execution.TaskExecutionHandler.handleTask(TaskExecutionHandler.java:50)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.processTask(SnpSessTaskSql.java:2913)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2625)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:558)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:464)
         at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:2093)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$2.doAction(StartSessRequestProcessor.java:366)
         at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:216)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:300)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$0(StartSessRequestProcessor.java:292)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$StartSessTask.doExecute(StartSessRequestProcessor.java:855)
         at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:126)
         at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:82)
         at java.lang.Thread.run(Thread.java:662)

    Hi
    i refereed the blog and i modified the same but still it is throwing an error.
    ODI-1228: Task SrcSet0 (Loading) fails on the target MICROSOFT_EXCEL connection TGT_Excel_TEST.
    Caused By: java.sql.SQLException: [Microsoft][ODBC Excel Driver] Syntax error in CREATE TABLE statement.
    Code:
    create table C$_0POSITION_DEFINITION_ID
         C1_POSITION_DEFINITION_ID     NUMBER(15) ,
         C2_ID_FLEX_NUM___________     NUMBER(15)
    The above code is executed in the sql developer and it's successfully created the table.
    Edited by: 985498 on May 16, 2013 3:54 AM

  • Oracle query export into the Excel file

    Hi,
    How can i automatically export oracle query result into the excel file in oracle?

    SQL and PL/SQL FAQ
    Re: Excel query to Oracle Database
    http://blog.mclaughlinsoftware.com/microsoft-excel/how-to-query-oracle-from-excel-2007/
    Edited by: swapnil kambli on May 28, 2013 11:07 PM

  • How to print a something in oracle sql developer

    Hello all
    Do you know How to print a something in oracle sql developer? i mean for example in the query we write something, (offcourse i dont mean comments)
    thank u in advance.
    best

    1003209 wrote:
    Hello all
    Do you know How to print a something in oracle sql developer? i mean for example in the query we write something, (offcourse i dont mean comments)
    thank u in advance.
    bestDBMS_OUTPUT()

Maybe you are looking for

  • Open letter to Nokia Messaging dev team: imap idle...

    Hi, I would like to ask the developers of Nokia Messaging if they are aware of the fact themailclient in the E72 isn't supporting Imap IDLE anymore. Before, in the E71 for example, there was indeed a timesetting in the native client BUT this was used

  • Images are fuzzy

    I am converting files containing psd images into pdfs using Acrobat 8. The images appear fuzzy in the pdfs. I know I sorted this out in Acrobat 6 but can't remember how and the help files are not very helpful. What should I do ?

  • CONTROLLER PXI-PCI

    MY NAME IS ASHOK. I WORK AT AGILENT. MY EMAIL IS [email protected] DOES THE CONTROLLER CHASSIS PXI AND PC MUST BE SAME MODEL? FOR EXAMPLE, CAN I USE PXI-8330 (CHASSIS) AND PCI-8331 (PC) TO CONTROLLER? I HAVE HARDWARE ADAPTOR E/M/S, SHC-68-68 EPM AND

  • RegisterSchema errors for include and URN

    Hello I am trying to take advantage of XDB in processing XML documents. The XML Schema is provided by a third party and has several xsd files and a "master" file that imports the rest. I am having two problems with registerSchema. 1) For two of the n

  • Resetting problems

    i just bought a new ipod touch and want to give my old 8gb 1st. generation ipod touch to a friend. im trying to get it back to its factory settings and clear off my old stuff so he can start over from scratch. using itunes, im trying to restore facto