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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:21:08+00:00 2026-05-14T03:21:08+00:00

I have this function: CREATE OR REPLACE FUNCTION CREATE_AIRSPACE_AVAILABILITY_RECORD (cur_user VARCHAR, start_time VARCHAR, start_date

  • 0

I have this function:

CREATE OR REPLACE FUNCTION CREATE_AIRSPACE_AVAILABILITY_RECORD
 (cur_user VARCHAR, start_time VARCHAR, start_date VARCHAR, end_time VARCHAR, end_date VARCHAR, airspace_name VARCHAR)

  RETURNS VOID AS '
  DECLARE
 c_user ALIAS for $1;
BEGIN
   IF start_time IS NULL OR
      start_date IS NULL OR
      end_time IS NULL OR
      end_date IS NULL  THEN
         INSERT INTO c_user.AIRSPACE_AVAILABILITY
            (ASP_AIRSPACE_NM, ASA_TIME_ID, ASA_START_DT, ASA_END_DT)
         SELECT airspace_name,
                 1,
                 ABP.ABP_START_DT,
                 ABP.ABP_STOP_DT
           FROM ABP 
          WHERE EXISTS
             (SELECT ASP.ASP_AIRSPACE_NM
                FROM AIRSPACE ASP
               WHERE ASP.ASP_AIRSPACE_NM = airspace_name);
   ELSIF start_time IS NOT NULL AND
      start_date IS NOT NULL AND
      end_time IS NOT NULL AND
      end_date IS NOT NULL  THEN
         INSERT INTO c_user.AIRSPACE_AVAILABILITY
            (ASP_AIRSPACE_NM, ASA_TIME_ID, ASA_START_DT, ASA_END_DT)
         SELECT airspace_name,
                 1,
                 TO_DATE(start_date||start_time,''YYMMDDHH24MI''),
                 TO_DATE(end_date||end_time,''YYMMDDHH24MI'')
           FROM DUAL
          WHERE EXISTS
             (SELECT ASP.ASP_AIRSPACE_NM
                FROM c_user.AIRSPACE ASP
               WHERE ASP.ASP_AIRSPACE_NM = airspace_name);
   END IF;

END ;
   ' LANGUAGE plpgsql;

I try calling it like so:

select * from CREATE_AIRSPACE_AVAILABILITY_RECORD('user1','','','','','');

and I get this error:

ERROR: schema "c_user" does not exist
SQL state: 3F000
Context: SQL statement "INSERT INTO c_user.AIRSPACE_AVAILABILITY (ASP_AIRSPACE_NM, ASA_TIME_ID, ASA_START_DT, ASA_END_DT) SELECT  $1 , 1, TO_DATE( $2 || $3 ,'YYMMDDHH24MI'), TO_DATE( $4 || $5 ,'YYMMDDHH24MI') FROM DUAL WHERE EXISTS (SELECT ASP.ASP_AIRSPACE_NM FROM c_user.AIRSPACE ASP WHERE ASP.ASP_AIRSPACE_NM =  $1 )"
PL/pgSQL function "create_airspace_availability_record" line 23 at SQL statement

Why isn’t c_user being replaced with my param (user1)?

  • 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-14T03:21:09+00:00Added an answer on May 14, 2026 at 3:21 am

    When you write something like this:

    INSERT INTO c_user.AIRSPACE_AVAILABILITY
    

    the database assumes that the ‘c_user’ is a namespace, not a variable. If you want to use the value of the c_user variable in such a query, you should use execute statement:

    execute 'INSERT INTO ' || c_user || '.AIRSPACE_AVAILABILITY';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this procedure in the database: CREATE OR REPLACE FUNCTION replacePageRelevance(id INT, value
I have function like this : CREATE OR REPLACE FUNCTION f_insert_account(usernames character varying, passwds
I have this function to create a request to another file to update the
I have this function above to create url slugs from posts title, the problem
i have this function in my code and I'm using throw to create meaningful
How would I create a nested list, I currently have this public function getNav($cat,$subcat){
I have this class that have a function to load other classes and create
This didn't happen until I have added jQuery. function mfunc() {} mfunc.prototype.create = function(value)
I have function CREATE OR REPLACE FUNCTION public.GetSoilCod ( cod1 integer = 0, cod2
I have the following function: CREATE OR REPLACE FUNCTION GetVarchar2 (iclCLOB IN Nvarchar2) return

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.