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

  • Home
  • SEARCH
  • 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 8788989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:16:47+00:00 2026-06-13T22:16:47+00:00

I have a WARNINGS_INFO table that contains some info on a specific warning message,

  • 0

I have a WARNINGS_INFO table that contains some info on a specific warning message, such as it’s code and level, and a string that describes how to print the output message.

  ID  |     CODE       | LEVEL | STR_FORMAT
------|----------------|-------|----------------------------------------------
  5   | attrib_missing |   3   | On cell $R:$C, attribute $ATTRIB not found

Let’s assume I have a table GENERATED_WARNINGS with all the warnings generated from a SQL batch:

  WARN_ID  |  WARN_ROW_ID   
-----------|---------------
    5      |      32      

Also, I have another table with the columns R, C and ATTRIB and obviously a ROW_ID primary key column which WARN_ROW_ID refers to.

Is there a way in SQL to dynamically trasduce the STR_FORMAT string to a string with the data from the columns of the last table?

  • 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-13T22:16:48+00:00Added an answer on June 13, 2026 at 10:16 pm

    Here’s one stab at it using the Oracle REPLACE() function: http://www.sqlfiddle.com/#!4/7d3c4/3

    This requires a nested call to REPLACE for each $variable in your warning message, so isn’t general purpose. For this kind of thing I do not think you should do the variable replacement in SQL. Extract the warning message, and the values for $R, $C, $ATTRIB, etc and do the variable substitution using a templating library like Velocity or FreeMarker.

    Given DDL:

    create table WARNINGS_INFO (
      ID INTEGER PRIMARY KEY,
      C_CODE VARCHAR2(20),
      I_LEVEL INTEGER,
      STR_FORMAT VARCHAR2(255)
    );
    
    insert into WARNINGS_INFO values (
      5, 'attrib_missing', 3, 'On cell $R:$C attribute $ATTRIB not found'
    );
    
    create table GENERATED_WARNINGS (
      WARN_ID INTEGER NOT NULL,
      WARN_ROW_ID INTEGER
    );
    
    insert into GENERATED_WARNINGS values (5, 32);
    
    create table WARNING_MAP (
      ROW_ID INTEGER PRIMARY KEY,
      R INTEGER,
      C INTEGER,
      ATTRIB VARCHAR2(20)
    );
    
    insert into WARNING_MAP values (32, 42, 99, 'FOOBAR');
    

    The following query will do the parameter replacement:

    select
      replace(
        replace(
          replace(str_format, '$R', wm.r),
          '$C', wm.c),
        '$ATTRIB', wm.attrib) as formatted
    from warnings_info wi
    join generated_warnings gw on wi.id = gw.warn_id
    join warning_map wm on wm.row_id = gw.warn_row_id
    ;
    

    The output from this will be: “On cell 42:99 attribute FOOBAR not found”

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

Sidebar

Related Questions

I have several Code Analysis CA1704:IdentifiersShouldBeSpelledCorrectly warnings that I want to suppress. Basically, they
Here's the code I have: use strict; use warnings; use Log::Log4perl qw(:easy); Log::Log4perl->init({ level
How can i make the success message display out? I have the following code,
I have a VideoView that is playing back some .mp4 files from sdcard. The
Have some Perl code which is using the DBI module - (the code is
Some background info: We have several websites running on a 64-bit machine with IIS6
I have a Perl-Tk code and that code createas a GUI with 5 Tabs
I have a set of code that takes an image stored in a UIImageView
I have a table in sql server 2005 which holds an ip range and
I have a project that has existed for quite a while, and I recently

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.