New line in SQL plus

Hi all,
I would like to include content with a new line into an column of a table. I would like to run the script through SQL plus but because I want a new line in this content, SQL plus determines it as the end of the query.
e.g. update <tablename>
set <columnname> = ' bla bla
bla bla'
Is there a way I can get around this?

Joyce,
Try:
SET SQLBL[ANKLINES] ON
http://download-west.oracle.com/docs/cd/B13789_01/server.101/b12170/ch13.htm#sthref2829
Alison

Similar Messages

  • Newer version of SQL*Plus for Linux

    Is there a newer, more featured version of SQL*Plus for Linux than 8.1.6.0.0? Where would I get it?
    Thanks.

    I have problems installing the oracle 8i client.
    i ordered the oracle servers 8i CD kit for linux .am using the standard edition to install the client.
    but am facing problems.
    the net8 configuration fails.
    what can i do?
    which CD should i look at?
    what do i need to install a client.?
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Boris Mironov ([email protected]):
    Hello,
    I had some problem (mixed OS environment). I solved it by ordering Linux version from Oracle. Oracle send me Linux CD Pack (All software for Linux) with free license for SQL-client only. It means that I have no licenses for products (eg. Oracle8i EE, Oracle8i SE, WebDB, ...). Anyway, I have access to my DB-server from my Linux box and I do not need to pay extra money for licensing because we have enough user licenses for our server.
    Good luck,
    Boris<HR></BLOCKQUOTE>
    null

  • Command line in SQL/PLUS

    When I start SQL/PLUS I see the following
    13:56:06 sql>
    13:56:06 sql>
    13:56:06 sql>
    ...But I want so see sysdate, username and database
    13:56:06 scott@entw>
    13:56:06 scott@entw>
    13:56:06 scott@entw>Does anybody have an idea?

    in your client ORACLE_HOME/sqlplus/admin directory is the file gloogin.sql
    This is executed whenever you login. As part of it, you can set your prompt. Here is the code I use.
    COLUMN connect_id NEW_VALUE prompt_str
    COLUMN carat NEW_VALUE carat
    SELECT LOWER(user) || '@' || LOWER(i.host_name) ||':'||LOWER(t.instance) as connect_id,
    DECODE(user, 'SYSTEM', '$',
    'SYS', '#',
    '>') carat
    FROM v$thread t, v$instance i
    SET sqlprompt "&prompt_str&carat " ;
    SET sqlcontinue "&carat "
    It requires access to v$thread and v$instance views. It will be simple enough to also include the time portion of sysdate with TO_CHAR(sysdate,'hh24:mi:ss') if you wish.

  • String with new lines in sql and java

    i'm using mysql as my database. In one of the columns (nameCol) stores a string, 'hello, my name is earl'
    In my java app i want to display this in a text area so that it looks like:
    hello,
    my name is earl
    in mysql i did: INSERT INTO Table (......,nameCol) VALUES(.....,'hello,\nmy name is earl'); This inserted the data into the database in the format i wanted (as above) but when i printed it in my app it came out like hello, my name is earl.
    My sample code:
    //some code above to set a parameter for a select statement to get a unique row
    //get data from the nameCol field  ..this all works fine
    String nameC = (String)nameDataProvider.getValue("Table.nameCol");
    //set the text area
    myTextArea.setText(nameC);Anyone know how i can get it to display in the format at the top?

    Well, one reason for that is that \n not necessarily leads to a line wrap. Wrap chars are system dependant. Try using System.getProperty("line.separator") instead.

  • How do you create a complete database in notepad and execute it in SQL*Plus

    I am new to Oracle / SQL*PLUS / and the SQL Language. I have never done anything with these products before. I am running Oracle 9i Enterprise Edition. I have a database created and I was able to get a table created.
    That's it so far....
    I would like to start doing all coding and editing in Windows Notepad and then execute the code from within the SQL*Plus editor.
    Can someone please tell me......How do I do this???
    I have my data, that I will be running queries on, located in a text file.
    How do I get my SQL code to import the data from a text file into my tables???
    Thanks,
    Bobby Howerton

    Actually, @your_text_file would start executing this textfile - which is ok if there is SQL code in the file. But how I understand the question, is that the data to load into one ore more tables is in the text file. Is that correct?
    If so, if it's a lot of data, it's worth entering the documentation on the Server Utilities, search for SQL loader for example.
    If it's only a view records, than simply alter the contents to something like:
    insert into <put_table_name_here> (<put_column_names_here>) values (<data in the text file, seperated with comma's>);
    And there should be one line like this for each record, or look up the command "insert all" in the SQL reference.
    Good luck!

  • Different behaviour in SQL*Plus and PL/SQL

    Does anyone know why the following SQL works from the command line in SQL*Plus but results in a syntax error when included within a cursor in a PL/SQL procedure?
    SELECT (SELECT 'dummy' FROM dual)
    FROM dual;
    null

    Is this what you require? This works...
    declare
    cursor cur_dummy is
    SELECT d.dum
    FROM (
    SELECT 'dummy' dum
    FROM dual
    ) d
    v_dummy varchar2(30);
    begin
    open cur_dummy;
    fetch cur_dummy into v_dummy;
    close cur_dummy;
    dbms_output.put_line(v_dummy);
    end;
    Cheers
    BigB
    =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Aqueel ([email protected]):
    In PL/SQL, every SELECT Statement must have a INTO clause. But still It's not working. Anyother know the answer?
    <HR></BLOCKQUOTE>
    null

  • Code runs correctly when compiled by SQL developer but not SQL Plus

    I have a rather large package body I need to deploy and compile ... It's big and complex (I inherited the project). Our it dept is huge and scripts are deployed by the dba team and they seem to only use sql plus. My code deploys and runs fine when compiled in sql developer. Once I compile it from SQL plus it stops working. It runs and using debug statements I can see the values are correct but it no longer inserts the data into the proper tables. I get ZERO errors or warnings when this is compiled in SQL Plus and no errors are generated from the code at run time. I've diffed the extracts of the code from the DB after each deployment and the only difference is the blank lines which SQL Plus strips out when you load the file. Has anyone run into anything remotely similar and if so how did you solve it? I've tried modifying the code to no avail, adding in comments to preserve the white space makes no difference. The thing that really kills me is that there is no error at all.

    Ok this is the problem area.... vReplyMessage is a clob. I've replaced it in this section of processing with a varchar2(32000). And now it works. I still would like to know why though. Nothing is changed when I load it though sqlplus or sql developer but this line " update swn_recip_response_t set SWN_RECIP_RESPONSE = vTextReply where notification_id = v_notification_id; " would never execute with the clob. Logging showed that the clob had the correct value though. I am puzzled.
    begin
    call_SWNPost('http://www.sendwordnow.com/usps/getNotificationResults',vMessageText, vReplyMessage, v_status_code, v_status_phrase, '');
    exception
    when others then
    raise eJavaException;
    end;
    vTextReply := dbms_lob.substr( vReplyMessage, 32000, 1 );
    if (vDebug) then
    update PEMS_PROD_2.SWN_POST_LOG set response = 'notif_id == '|| v_notification_id || 'status code == '|| v_status_code|| ' '||vTextReply where log_pk = vLogPK;
    commit;
    end if;
    IF v_status_code = 200 then
    v_has_error := 'N';
    ELSE
    v_has_error := 'Y';
    END IF;
    -- we handle all exceptions below in case something goes wrong here.
    -- this area can die silently.
    vTextReply := replace(vTextReply,'<getNotificationResultsResponse xmlns="http://www.sendwordnow.com/usps">', '<getNotificationResultsResponse xmlns:xyz="http://www.sendwordnow.com/usps">');
    begin
    insert into swn_recip_response_t(notification_id) values (v_notification_id);
    exception
    when others then
    if (vDebug) then
    err_num := SQLCODE;
    err_msg := SUBSTR(SQLERRM, 1, 100);
    insert into PEMS_PROD_2.SWN_POST_LOG (LOG_PK, create_date, REQUEST, notification_id) values(pems_prod_2.swn_post_log_seq.nextval,sysdate,
    'err_num - '||to_char(err_num)|| ' error_msg - '|| err_msg, v_notification_id);
    commit;
    else
    null;
    end if;
    end;
    commit;
    begin
    update swn_recip_response_t
    set SWN_RECIP_RESPONSE = vTextReply
    where notification_id = v_notification_id;
    exception
    when others then
    if (vDebug) then
    err_num := SQLCODE;
    err_msg := SUBSTR(SQLERRM, 1, 100);
    insert into PEMS_PROD_2.SWN_POST_LOG (log_pk, create_date, REQUEST, notification_id) values(pems_prod_2.swn_post_log_seq.nextval,sysdate,
    'err_num - '||to_char(err_num)|| ' error_msg - '|| err_msg, v_notification_id);
    commit;
    else
    null;
    end if;
    end;
    commit;
    -- parse through the XML document and update the notification and recipient records
    -- parse the clob into an xml dom object
    begin
    vReplyMessage := vTextReply;
    ...

  • SQL Plus flat file

    I'm trying to write a SQL script that will generate a comma delimited file for use with Excel. When I execute the following line by line in SQL Plus, everything works fine. However, when I save the script in a file and open the file with SQL plus, it doesn't generate the file.
    Can someone please tell me what I'm missing here?
    Thank you very much.
    Robert
    set heading off
    set feedback off
    set trimspool on
    set echo off
    set pagesize 0
    spool c:\spool\data.txt
    select la.code ||','|| lai.code|| ',' || la.title as data
    from drLAInstanceMeeting laim
    inner join drLearningActivityInstance LAI on lai.id=laim.learningActivityInstanceID
    inner join drLearningACtivity LA on la.id=lai.learningActivityID
    where abs(meetingEnd - meetingStart) > (6/24);
    spool off

    I have continued to play with the above script, and found more information that may be helpful. When the script is executed I receive the following error:
    Is there something I need to do to use the SET command in a saved script?
    SQL> list
    1 set heading off
    2 set feedback off
    3 set trimspool on
    4 set echo off
    5 set pagesize 0
    6 spool c:\spool\data.txt
    7 select la.code ||','|| lai.code|| ',' || la.title as data
    8 from drLAInstanceMeeting laim
    9 inner join drLearningActivityInstance LAI on lai.id=laim.learningActivityInstanceID
    10 inner join drLearningACtivity LA on la.id=lai.learningActivityID
    11 where abs(meetingEnd - meetingStart) > (6/24)
    12 /
    13* spool off
    SQL> /
    set heading off
    ERROR at line 1:
    ORA-00922: missing or invalid option

  • Issue with new line when manually executing a procedure in SQL*Plus

    The below procedure works fine in SQL*Plus when the entire EXEC <procedure_name> (parameter1, parameter2, ..); is put in a single line
    SQL > exec cust_admin_util.create_schema (P_SCHEMA_NAME => 'SCOTT_01', P_SCHEMA_PWD => 'scott123', P_TBS_NAME => 'TRAG_TBS', p_temptbs_name => 'TEMP' );
    PL/SQL procedure successfully completed.I wanted to execute the same procedure with more readability. So, I put each parameters on a separate line and try to execute. But it is erroring out.
    SQL > exec cust_admin_util.create_schema
    P_SCHEMA_NAME => 'TESTUSR_01',
    P_SCHEMA_PWD => 'scott123',
    P_TBS_NAME => 'TRAG_TBS',
    p_temptbs_name => 'TEMP'
    );BEGIN cust_admin_util.create_schema; END;
    ERROR at line 1:
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'CREATE_SCHEMA'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    SQL >   2    3    4    5    6    7
    P_SCHEMA_NAME => 'TESTUSR_01',
    ERROR at line 2:
    ORA-00928: missing SELECT keywordAny workaround for this ?

    Hi Tom,
    At SQL Plus,
    You have to use the -(Hyphen) as the concatenation Operator.
    For Instance,
    SQL>  exec host_command( -
    p_command => 'dir');
    PL/SQL procedure successfully completed.
    Thanks,
    Shankar                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Hide new/old value of bind variable in SQL*Plus

    Hi,
    I have a SQL*Plus script to create a new user. It asks for username & password and then passes these values to a SP to do some checks and finally create the user.
    The output is currently the following :
    New user will be created in ORCL LAB
    Enter the requested username : fleet2
    Enter the password for fleet2 : *****
    Re-enter the password for fleet2 : *****
    old 2: labadmin_cr_user('&username', '&pswd', '&pswd2');
    new 2: labadmin_cr_user('fleet2', 'fleet', 'fleet');
    The requested username is already in use in the database. Please choose another username.
    As you can see the passwords are now exposed when the procedure is called. This is not what I want off course. I cannot do termout off as the serveroutput is not shown as well in that case. I use dbms_output to show error messages to users. (see example above in case of an existing user).
    Can anybody tell me how to hide these 2 lines (old 2, new 2) without hiding my dbms_output.
    Thanks!
    Kris

    set verify offhttp://download-uk.oracle.com/docs/cd/B10501_01/server.920/a90842/ch13.htm#1013382

  • Very new to sql plus

    I am using sql plus by the command line, I am using the ed mode. My problem is, I have two inserts one right after another. in note pad:
    insert into table values
    insert into table values
    ('d')
    The problem is only one insert gets done.
    What is the correct way to write this ?
    Eric

    If it is the same table, you could do something like:
    SQL> create table mytable(col1 varchar2(10));
    Table created.
    SQL> insert into mytable(col1) values(&value);
    Enter value for value: ' '
    old   1: insert into mytable(col1) values(&value)
    new   1: insert into mytable(col1) values(' ')
    1 row created.
    SQL> r
      1* insert into mytable(col1) values(&value)
    Enter value for value: 'd'
    old   1: insert into mytable(col1) values(&value)
    new   1: insert into mytable(col1) values('d')
    1 row created.
    SQL> select * from mytable;
    COL1
    d
    SQL> set feedback on
    SQL> /
    COL1
    d
    2 rows selected.

  • Strange error in sql*plus in a line with "&"

    Hi friends, this error is very strange:
    Open your SQL*PLUS.
    write this:
    DECLARE
    V_1 VARCHAR2(10);
    V_2 VARCHAR2(10);
    BEGIN
    V_1:=&var1;
    --V_2:=&var2;
    END;
    Why it ask me for a value to var2 ???????????
    Does it ignore the -- at the begining of the line
    (same result with /* */ )
    Thanks,
    Jose.

    It is not an error.
    There are two parsers here doing their thing. The SQL*Plus Parser. The Oracle (SQL and/or PL/SQL) parser.
    SQL*Plus reads a line at a time and processs it. It has no idea whether or a line is actually a comment line for SQL or PL/SQL. It however does see that the line contains a SQL*PLUS substitution variable called &var2. Thus it prompts for a value for this variable (as VERIFY is ON). It substitutes &var2 with the value that the user supplies.
    When the SQL*Plus parser encounters the end-of-block marker (the forward slash in this case), it transmits that block to the Oracle Server for execution. There the Oracle Server runs it through the PL/SQL or SQL parsers (depending on whether the block is SQL or anonymous PL/SQL).
    Nothing strange about it. Nothing wrong with it.

  • New Line Character in SQL Query

    Dear All,
    I am wondering if some one tell me how to insert new line character in the SQL Query Output for example I need out put in the following format. Every line on new line.
    The total count is:
    Registration: 1111
    Fees paid: 2222
    Admission Done: 3333
    Total:4000
    Many thanks

    Hi
    SQL> select
      2  'The total count is:
      3  Registration: 1111
      4  Fees paid: 2222
      5  Admission Done: 3333
      6  Total:4000
      7  ' dummy_txt from dual
      8  /
    DUMMY_TXT
    The total count is:
    Registration: 1111
    Fees paid: 2222
    Admission Done: 3333
    Total:4000
    SQL>
    SQL> select 'a'||chr(10)||'b' from dual;
    'A'
    a
    b
    SQL> T

  • New Line Character of  pl/sql in Insert Query

    Iam in need of New Line Character in pl/sql.
    In forms at the time of concatenation of two text box values into a single text box and a new line inbetween the two text box values and it is inserted into the database.
    (ie) Name :
    (We need a new line Character in between Name and Designation)
    Designation :
    Thankyou

    Hi,
    You could use something like this.
    insert into <table>....... :name||chr(10)||:designation;
    HTH.
    Regards,
    Arun

  • How to search for a new line character in sql

    hi..i am using oracle 10g.
    basically i am looking for usage of columns.I want to see which all columns are used in
    joins.
    this is the quey i have written.
    but
    if there a new line between WHERE ,AND those scenarios are ignored.how to take care of these new line characters?
    SELECT DISTINCT s.TYPE, s.NAME, s.owner, table_name, column_name --,line,text
    FROM all_source s, cols c, all_dependencies d
    WHERE s.NAME = d.NAME
    AND d.referenced_name = c.table_name
    AND c.table_name = 'WSF_EDUCATION_ORGUNIT'
    AND column_name ='ORGUNIT_TYPECODE_OID'
    AND d.TYPE = s.TYPE
    AND d.TYPE <> 'PACKAGE'
    AND d.owner = s.owner ---FOR OVERLOADED OBJECTS
    AND ( (UPPER (text) LIKE
    '%' || 'AND' || '%' || column_name || ' ' || '=%'
    OR (UPPER (text) LIKE
    '%' || 'AND' || '%=' || ' ' || '%' || column_name
    || '%'
    UNION ---if there is where
    SELECT DISTINCT s.TYPE, s.NAME, s.owner, table_name,
    column_name ----,line,text
    FROM all_source s, cols c, all_dependencies d
    WHERE s.NAME = d.NAME
    AND d.referenced_name = c.table_name
    AND c.table_name = 'WSF_EDUCATION_ORGUNIT'
    AND column_name ='ORGUNIT_TYPECODE_OID'
    AND d.TYPE = s.TYPE
    AND d.TYPE <> 'PACKAGE'
    AND d.owner = s.owner ---FOR OVERLOADED OBJECTS
    AND ( (UPPER (text) LIKE
    '%' || 'WHERE' || '%' || column_name || ' ' || '=%'
    OR (UPPER (text) LIKE
    '%' || 'WHERE' || '%=' || ' ' || '%' || column_name
    || '%'
    )

    Hi,
    Not sure if I get it, but you can look for characters using the ascii and chr functions.
    You can change them using replace:
    A new line:
    SQL> select ascii('
      2  ') from dual;
    ASCII('')
            10(Just press enter between the quotes)
    Example how to replace it with a space:
    SQL> with t as ( -- generating test string:
      2  select 'this string has
      3  a new line' str from dual
      4  )
      5  --
      6  -- actual query:
      7  --
      8  select str
      9  ,      replace(str, chr(10), chr(32))
    10  from   t;
    STR                        REPLACE(STR,CHR(10),CHR(32
    this string has            this string has a new line
    a new lineIf that isn't clear of when I'm missing the point then please post some narrowes down examples of what you get now and your desired output. Remember to put the tag around any code example you're posting.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Maybe you are looking for