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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:03:39+00:00 2026-06-06T00:03:39+00:00

CREATE OR REPLACE FUNCTION layer2layerAttribute RETURN VARCHAR2 AS /** * This function properly joins

  • 0
CREATE OR REPLACE FUNCTION layer2layerAttribute RETURN VARCHAR2 AS
/**
 * This function properly joins all layers to their appropriate fields
 */
  cursor PLACES is select * from layer l where l.layer_name like '%place%';
BEGIN
  FOR place IN PLACES
  LOOP
     Insert all
      into LAYER_JOIN_LAYER_ATTRIBUTE (ID_LAYER, ID_LAYER_ATTRIBUTE) 
        values (place.id_layer, select id_layer_attribute from layer_attribute where name_attribute = 'filter.street')
      into LAYER_JOIN_LAYER_ATTRIBUTE (ID_LAYER, ID_LAYER_ATTRIBUTE) 
        values (place.id_layer, select id_layer_attribute from layer_attribute where name_attribute = 'filter.city')
      into LAYER_JOIN_LAYER_ATTRIBUTE (ID_LAYER, ID_LAYER_ATTRIBUTE) 
        values (place.id_layer, select id_layer_attribute from layer_attribute where name_attribute = 'filter.state')
      into LAYER_JOIN_LAYER_ATTRIBUTE (ID_LAYER, ID_LAYER_ATTRIBUTE) 
        values (place.id_layer, select id_layer_attribute from layer_attribute where name_attribute = 'filter.zip')
      into LAYER_JOIN_LAYER_ATTRIBUTE (ID_LAYER, ID_LAYER_ATTRIBUTE) 
        values (place.id_layer, select id_layer_attribute from layer_attribute where name_attribute = 'filter.country')
      select * from dual;
  END LOOP;
  RETURN null;
END layer2layerAttribute;
  • 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-06T00:03:41+00:00Added an answer on June 6, 2026 at 12:03 am

    You can, but you can’t use a select inside the values clause, or in place of the values clause for each into. You can either use values, or a single subquery. (See the syntax diagram). I’m also not sure why you’re using a cursor, rather than having the select from layer as the subquery instead of selecting from dual.

    You can do this with a single insert though and skip the explicit cursor at the same time; in a procedure (rather than a function since you don’t need to return anything, and functions aren’t generally used when data can be updated) if neccessary:

    CREATE OR REPLACE PROCEDURE layer2layerAttribute AS
    BEGIN
        insert into layer_join_layer_attribute (id_layer, id_layer_attribute)
        select l.id_layer, la.id_layer_attribute
        from layer l
        cross join layer_attribute la
        where l.layer_name like '%place%'
        and la.name_attribute in ('filter.street', 'filter.city', 'filter.state',
            'filter.zip', 'filter.country');
    END layer2layerAttribute;
    

    Although this looks like a one-off task to populate a new table, so you might be able to run it as a simple SQL statement. If it isn’t a one-off then you’ll get duplicates on the second execution unless you check and exclude them.

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

Sidebar

Related Questions

create or replace function gen.sample_func(owner varchar2) return varchar2 as data_t varchar2(10); cursor cur is
This is fu function: create or replace FUNCTION pk_max_value(t_name VARCHAR) RETURN NUMBER is rws
i have the following function: create or replace FUNCTION MXUPGKEYVAL(tbname varchar2,colname varchar2) return number
I have function like : create or replace function dedup_temp return varchar2 as TYPE
Is there any reason this function call would not return 'result'? CREATE OR REPLACE
I have this function: CREATE OR REPLACE FUNCTION CREATE_AIRSPACE_AVAILABILITY_RECORD (cur_user VARCHAR, start_time VARCHAR, start_date
I have a stored function CREATE OR REPLACE FUNCTION schedule(name in varchar2,pass in varchar2
I have the following function: CREATE OR REPLACE FUNCTION GetVarchar2 (iclCLOB IN Nvarchar2) return
I can't quite get this right.. my function looks like: create or replace function
i am using this function in a trigger: CREATE OR REPLACE FUNCTION xx() RETURNS

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.