Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to print string using pl/sql without appending the new line character at end

If I use DBMS_OUTPUT.PUT_LINE() method, it always appends a new line character at end.

But what if I want to print lets say Fibonacci series in same line.

I know the logic of fibonacci...

I just want to know which method would I use to put whole output in same line.

I am using PL/SQL

like image 962
Tarun Avatar asked Oct 16 '11 16:10

Tarun


People also ask

How do I cut a new line character in Oracle?

Hi: select replace(column_name,CHR(13),'') from table_name; If it didn't work, try CHR(10) intead of CHR(13).

How do I display a string in PL SQL?

To work with strings in your PL/SQL programs, you declare variables to hold the string values. To declare a string variable, you must select from one of the many string data types Oracle Database offers, including CHAR, NCHAR, VARCHAR2, NVARCHAR2, CLOB, and NCLOB.

How do I print a single quote in PL SQL?

Simply stating you require an additional single quote character to print a single quote character. That is if you put two single quote characters Oracle will print one. The first one acts like an escape character. This is the simplest way to print single quotation marks in Oracle.


2 Answers

Use DBMS_OUTPUT.PUT instead of DBMS_OUTPUT.PUT_LINE

like image 190
cagcowboy Avatar answered Oct 06 '22 13:10

cagcowboy


The entry point for all the doc of version 11gR2 is All Books for Oracle Database Online Documentation Library 11g Release 2 (11.2).

For other Oracle database versions you might want to start your exploration from Database Documentation. Since version 12.1 the URLs are easier : http://docs.oracle.com/database/121/nav/portal_booklist.htm for 12.1 and http://docs.oracle.com/database/122/nav/portal_booklist.htm for 12.2.

You might want to check PL/SQL Packages and Types Reference for that kind of question. In particular the Summary of DBMS_OUTPUT Subprograms. The doc is really handy as a reference when you have questions about the PL/SQL API.

like image 25
Ludovic Kuty Avatar answered Oct 06 '22 14:10

Ludovic Kuty