Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to create a view with parameters in Oracle

2025-02-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

How to create a view with parameters in Oracle? for this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and easy way.

First define the package:

/ * according to individual needs, I define three parameters. Because of the needs of my project program, all three parameters are number. Of course, you can define other types, but keep in mind that the parameter types of the second create need to be consistent with the first create, otherwise the package creation failed * / create or replace package p_view_param is-parameter-function set_param (num number) return number; function get_param return number -- Parameter 2 function set_Type (num number) return number; function get_Type return number;-- Parameter 3 function set_Id (num number) return number; function get_Id return number; end paired viewpoints param;-- create or replace package body p_view_param is paramValue number; paramType number; paramId number;-- Param function set_param (num number) param Function get_param return number is begin return paramValue; end;-- Type function set_Type (num number) return number is begin paramType:=num; return num; end; function get_Type return number is begin return paramType; end;-- ID function set_Id (num number) return number is begin paramId:=num; return num; end; function get_Id return number is begin return paramId End; end p_view_param

Remember to create the first one when you create it

Next, define the view:

/ * * define the view. Where is followed by parameters, which can be assembled by yourself. Note that the view field should match the field of select * / CREATE OR REPLACE VIEW abstract_sum_view (fa_id, aircraft_num,aircraft_weight,airline_code,anchor_pos) AS SELECT f.fa_id, f. Aircraftnum _ numFindweight (f.aircraft_num), f. Airline fields FROM tb_flight_abstract f where f.fa_id=p_view_param.get_Id () -- parameters-- using views, pass parameters select * from abstract_sum_view where p_view_param.set_id (3) = 3. This is the answer to the question on how to create a view with parameters in Oracle. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report