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 3696588
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:45:25+00:00 2026-05-19T04:45:25+00:00

Is there a space or other non-printing character I can insert to a varchar2

  • 0

Is there a space or other non-printing character I can insert to a varchar2 column that will not be trimmed away and result in a NULL?

I just want to insert a blank into the column so it displays nothing on an SSRS 2008 report. The column is part of a PK so it cannot be NULL. Of course using '' doesn’t work as this is seen as NULL in Oracle, and ' ' doesn’t work because it’s varchar2 and trimmed to be NULL.

So is there a literal value I can insert instead that will display as nothing in SSRS but also can be inserted to a non-nullable varchar2 column in Oracle 11g?

Thinking about it for a moment, I guess something like a tab character could do the job. But I look forward to your suggestions.

UPDATE

Whoops. Guess where the trimming behavior came from? My own RTRIM! Sorry about that. Let’s just say I was mislead by my inexperience with Oracle and my frustration over this leading me to determine the error was in the product rather than in my query. But hey, it’s not exactly a simple query.

INSERT INTO WeeklyInvoice (GUID, Mo, VendorName, CostCenter, WkNum, Amt)
SELECT
   ExecID,
   Mo,
   VendorName,
   CostCenter,
   WkNum,
   Amt
FROM (
   WITH CostCenters AS (
      SELECT REGEXP_SUBSTR(CostCenterList, '[^,]+', 1, LEVEL) CostCenter
      FROM DUAL
      CONNECT BY LEVEL <= Length(CostCenterList) - Length(Replace(CostCenterList, ',', '')) + 1
   ), Invoices AS (
      SELECT
         TRUNC(I.Invoice_Dte, 'MM') Mo,
         (TRUNC(I.Invoice_Dte, 'W') - TRUNC(I.Invoice_Dte, 'MM')) / 7 + 1 WkNum,
         I.Vendor,
         V.Vendor_VName,
         RTrim(D.Dis_Acct_Unit) CostCenter,
         D.To_Base_Amt
      FROM
         CostCenters CC
         CROSS JOIN prod.IcCompany C
         INNER JOIN prod.ApDistrib D
            ON C.Company = D.Company
            AND D.Dis_Acct_Unit = CC.CostCenter
         INNER JOIN prod.ApInvoice I
            ON D.Invoice = I.Invoice
            AND D.Vendor = I.Vendor
            AND D.Suffix = I.Suffix
            AND D.Company = I.Company
         INNER JOIN prod.ApVenMast V ON I.Vendor = V.Vendor
      WHERE
         D.Cancel_Seq = 0
         AND I.Cancel_Seq = 0
         AND I.Invoice_Dte >= ADD_MONTHS(FromDate, -2)
         AND I.Invoice_Dte < ToDate
   ), Months AS (
      SELECT ADD_MONTHS(FromDate, LEVEL - 1) Mo
      FROM DUAL
      CONNECT BY LEVEL <= MONTHS_BETWEEN(ToDate, ADD_MONTHS(FromDate, -2))
   ), Names AS (
      SELECT DISTINCT
         I.Mo,
         I.Vendor,
         I.Vendor_VName,
         I.CostCenter
      FROM Invoices I
      UNION ALL
      SELECT M.Mo, '0', 'No Paid Invoices', ' '
      FROM Months M
      WHERE
         NOT EXISTS (
            SELECT I.*
            FROM Invoices I
            WHERE I.Mo = M.Mo
         )
   ), Weeks AS (
      SELECT LEVEL WkNum FROM DUAL CONNECT BY LEVEL <= 5
   )
   SELECT
      N.Mo,
      N.Vendor_VName VendorName,
      N.CostCenter,
      W.WkNum,
      Sum(I.To_Base_Amt) Amt
   FROM
      Names N
      INNER JOIN Weeks W
         ON W.WkNum < 5
         OR EXTRACT (MONTH FROM (N.Mo + 28)) = EXTRACT (MONTH FROM N.Mo)
      LEFT JOIN Invoices I
         ON N.CostCenter = I.CostCenter
         AND N.Vendor = I.Vendor
         AND N.Mo = I.Mo
         AND W.WkNum = I.WkNum
   GROUP BY
      N.Mo,
      N.Vendor_VName,
      N.CostCenter,
      W.WkNum
) X;
  • 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-05-19T04:45:25+00:00Added an answer on May 19, 2026 at 4:45 am

    In my test below, the single space was not converted to a null:

      SQL> CREATE TABLE t (col VARCHAR2 (10) NOT NULL);
    
      Table created.
    
      SQL> INSERT INTO t (col)
        2       VALUES (' ');
    
      1 row created.
    
      SQL> SELECT CASE col WHEN ' ' THEN 'I am a single space' ELSE 'I am not a space' END AS col FROM t;
    
      COL
      -------------------
      I am a single space
    
      1 row selected.
    
      SQL> SELECT LENGTH (col) FROM t;
      LENGTH(COL)
      -----------
                1
    
      1 row selected.
    

    Are you trimming the values before inserting?

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

Sidebar

Related Questions

I figured out that of course . and SPACE aren't allowed. Are there other
Using sed, if there is a space character on a line in a file,
There are other questions about this in other languages , and other non-lazy JavaScript
There is a space in the string, but when I run program, it returns
Is there any speed/space/general performance gains in using array based implementation of a binary
I'm developing a ASP.NET MVC application. There is little space for me to put
I'm sure I've overlooked something here but cannot work it out. There's white space
In my current simple project, Copybin , there is some space at the bottom
We are writing a TCPServer and Client program. How much space is there in
Is there a smart and space-efficient symmetric matrix in numpy which automatically (and transparently)

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.