Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8028345
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T00:06:37+00:00 2026-06-05T00:06:37+00:00

I’m writing a SQLPlus report in which the recurring header contains an address for

  • 0

I’m writing a SQLPlus report in which the recurring header contains an address for a business, followed by several relevant rows regarding that business, followed by the address for the next business:

BOB'S GUITARS 
123 SESAME STREET 
NEW YORK, NY 10001

customer name   last purchase date   last purchase amount
-------------   ------------------   --------------------

DAVE'S CIGARS 
456 MOCKINGBIRD LANE 
WASHINGTON, DC 12345

customer name   last purchase date   last purchase amount
-------------   ------------------   --------------------

The problem is this:

Some of those businesses have multi-line addresses, while others do not.

I can handle the basic case with something like
TTITLE CENTER BUSINESSNAME SKIP 1 CENTER ADDR1 SKIP 1 CENTER CITY

(where “CITY” is a variable containing city, state, and zip)

But I’m having a hard time figuring out how to put “add the second address line if ADDR2 is not null” without risking a blank line between ADDR1 and CITY.

In other words, I don’t want

BOB'S GUITARS
123 SESAME STREET

NEW YORK, NY 10001

in order to support

DAVE'S CIGARS
456 MOCKINGBIRD LANE
SUITE 101
WASHINGTON, DC 12345

EDIT / ADDITION:
The suggestion of the combination of nvl and decode was the right first step, but now I’ve run into the problem that the two-line “line” in question exceeds the report’s LINEWIDTH, and therefore gets truncated to LINEWIDTH character. Here’s the code I’m using to generate that line. Remember that both lines must be centered:

SELECT RPAD(' ', (79 - length(trim(address)))/2) 
  || trim(address) 
  || decode(nvl(trim(address_2), '='), '=', '', 
    CHR(10) 
    || RPAD(' ', (79 - length(trim(address_2)))/2, '-') 
    || trim(address_2) || ' ') ADDR1 from business
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T00:06:38+00:00Added an answer on June 5, 2026 at 12:06 am

    After consideration of the docs and analysis, it appears that this can’t be done. The (non-technical) solution was to press the business owners to accept a formatting that SQL*Plus could actually generate. They are satisfied with that solution.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I have a text area in my form which accepts all possible characters from
Seemingly simple, but I cannot find anything relevant on the web. What is the
I am writing an app with both english and french support. The app requests

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.