Passing a parameter to a function via an alias
Hi all,
Is it possible to pass a fixed value to a function from a alias?
For example say you have a function which opens a web browser and that function accepts a parameter for the URL that you want the browser to load. You can then just call the function and pass the URL across. This will then load the browser with the specified
URL.
What I want to try and do is create an alias called openMS. This alias would call the function and pass the url microsoft.com across. I could then create multiple aliases for opening various pages and use just one function.
I've had a bit of a search but can't seem to find anything so not sure if what I'm trying to do is possible.
Thanks
Peter
You can't do that with an alias, but you can just write another function to accomplish that. The "help" and "mkdir" functions are examples of this technique in the built-in PowerShell commands. "help" pipes Get-Help to more,
and "mkdir" calls New-Item with a hard-coded parameter of -Type Directory . You can see the code for each of those by typing $function:help and $function:mkdir .
Similar Messages
-
Problem in passing varchar2 parameter to Evaluate function in OBIEE
Hi there,
This is regarding an issue while passing parameter in EVALUATE function.
I have to call a function with varchar parameters. parameter are nothing but my table column values.
I've created session variables which holds value from my table column values.
for eg:
EVALUATE('REP1_FIRSTMONTH_F(%1)' AS CHARACTER ( 30 ), VALUEOF (NQ_SESSION."month"))
so whenever i call function using EVALUATE in OBIEE. i hve to pass ' ' (single quotes) for my varchar values. without this , i'm facing error stating :
*State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 59015] The requested column PERIOD0 does not exist in this table. (HY000)*
If i'll give parameter within single quotes in my dashboard prompt. it is working fine, but fails without the quotes.
kindly help me in solving this issue.
Thanks - Vijay
NOTE: parameter are from column values.Hi
Anyone has any input for the above issue??. Please share.
Regards - Vijay -
Passing java parameter to javascript function in oa framework
hi all,
can anybody tell how to pass parameter to javascript function from java for example
OAMessageTextInputBean txtbean = (OAMessageTextInputBean)webBean.findChildRecursive("BuyerPrice");
String row = "rowid";
txtbean.setOnKeyUp("javascript:checkNumber("+row+")");
checknumber is javascript function defined .Hi,
go through http://forum.java.sun.com/thread.jspa?threadID=174157&messageID=539357
if ur requirement is just to pass a string to a JS function.
Thanks -
Is it necessary to pass RETURN parameter in bapi function module
Hai All,
Is it necessary to pass structure to RETURN parameter in bapi_transaction_rollback function module. If it is not necessary then how can it gives return value. Please give me the answer for this one. some sample code below...
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'
IMPORTING
RETURN = i_return.
LOOP AT i_return into wa_return WHERE type EQ c_error.
wa1_out-postdoc = wa_return-message.
ENDLOOP.
Thanks & Regards.
Laxman.Phi
bapi should never throw an error as it might be called for mass data proceessing
and it is prefferred not to hault the proceess bcoz of one or two errors.
that's why the error or success messages are caught and returned in return table.
in bapi_transaction_rollback the return parameter is not necessary as it will work without that as well.
the purpose of rollback bapi is just to undo whatever done before that.
regards
vijay
<b>reward points if helpful</b>
Message was edited by:
vijay sharma -
Passing the parameter in the Function module MESSAGE_SEND_AS_MAIL
Hi all,
I have to send the same message to five different mail ID's using the Function module MESSAGE_SEND_AS_MAIL
How to pass this five mail ID's in the Parameter Reciever of the Function module
Regards
Ajaysee if this helps
REPORT Z_MESSAGE.
data receiv type standard table of SOMLRECI1 initial size 0.
data wa type SOMLRECI1.
wa-receiver = 'email address in caps'.
wa-REC_TYPE = 'U'.
append wa to receiv.
wa-receiver = 'email address in caps'.
wa-REC_TYPE = 'U'.
append wa to receiv.
do so more more three
CALL FUNCTION 'MESSAGE_SEND_AS_MAIL'
EXPORTING
msgid = 'Z_ZZZ_CA_MESSAGES'
msgno = '000'
MSGV1 = 'material'
MSGV2 = 'MAT'
MSGV3 = 'MM'
MSGV4 = 'MMM'
tables
receivers = receiv[]
COMMIT WORK AND WAIT.
then u can go to SOST transaction and see that the mail has been or is yet to be sent. It worked for me. The message comes in an PDF form to the mail box.
Edited by: Biswadeep Ghosh on Jun 25, 2008 2:28 PM
Edited by: Biswadeep Ghosh on Jun 25, 2008 2:30 PM -
How to pass servlet parameter using encodeURL function in JSP page
Hi!!!
I have a very urgently problem.
in my JSP I have this:
<IMG border="0" src='<%=response.encodeURL("/MyImageServlet")%>'>
In this way, my servlet works fine (and I have in my page my blob-image).
But I have to pass to my servlet a list of dynamic parameter. I have tried all the possibilities like:
<IMG border="0" src='<%= (response.encodeURL("/MyImageServlet") + "?Param_name=" + sessionBean.getParamValue() + "&anotherParam" + sessionBean.getAnotherParamValue())%>'
but nothing....
In my servlet I use the init function to retrieve the initial parameters(defined in my web.xml file) in this way:
public void init(ServletConfig config) throws ServletException
super.init(config);
myParam = getInitParameter( "name_of_param");
but I retrieve only the default value (-1).
How to pass to my servlet the parameters? Please help me!
Excuse me for my english,
thank you for your help!Hi!
Thanks for your reply!
I have tried this solution but it doesn't work!
When I do getInitParameter in the init function, the servlet take the default values...
Maybe I have wrote something wrong?
Excuse me for my english,
Thanks -
HOW to pass page parameter into table function in HTMLDB
I created this object and table function in database.
create or replace TYPE date_flow_type
AS OBJECT (
time date,
max_time number,
avg_total NUMBER,
sum_total NUMBER,
max_total NUMBER,
change_rate number
create or replace TYPE date_flow_table_type AS TABLE OF date_flow_type;
create or replace function ret_date(p_date date default sysdate) return date_flow_table_type is
v_tbl1 date_flow_table_type :=date_flow_table_type();
begin
v_tbl1.extend;
v_tbl1(v_tbl1.last):=date_flow_type (p_date,1,1,1,1,1);
return v_tbl1;
end;
and it is correct in htmldb when using in these ways
SELECT TIME da,
max_time max_time,
sum_total total,
max_total max_total,
change_rate
FROM TABLE ( ret_icp_date_flow ) a;
SELECT TIME da,
max_time max_time,
sum_total total,
max_total max_total,
change_rate
FROM TABLE ( ret_icp_date_flow( sysdate-1 )) a;
but return error
ORA-00904: "RET_ICP_DATE_FLOW": 无效的标识符
when pasing page parameter into the table function
SELECT TIME da,
max_time max_time,
sum_total total,
max_total max_total,
change_rate
FROM TABLE ( ret_icp_date_flow( to_date(:p1_date,'yyyy-mm-dd') )) a
and this sql is correct while running in sqlplus .Hi!
Thanks for your reply!
I have tried this solution but it doesn't work!
When I do getInitParameter in the init function, the servlet take the default values...
Maybe I have wrote something wrong?
Excuse me for my english,
Thanks -
Passing multiple parameter to SSIS package via data manager
Hi
We are trying to pass parameters from data manager to SSIS package. We are trying to give option of selecting members from Dimension using SelectInput while modifying script.
But we are not able to catch the values in SSIS package.
Code in Data manager package:
(ON)
(SELECTINPUT,%VER%,,"Select Account",%ACCOUNT_DIM%)
(Execute sp_ver_copy,SqlStatementSource,exec dbo.sp_ver_copy2 '%VER%')
We also tried with writing GLOBAL(VER,%VER%) instead of -- (Execute sp_ver_copy,SqlStatementSource,exec dbo.sp_ver_copy2 '%VER%')
But that also dosent work.
We need to use the parameters passed, in SQL code that we have written in OLE DB source, under data flow task.
Any help is appreciated.
Thanks in advanceThanks Roberto for reply.
Please find the screenprint as per your suggestion. Also I have mentioned the code in above question. We are using the stored procedure to write the value into a table , passed from front end. We are able to write the value passed from front end into a table. So it means that system is passing the value.
But when I try to bring same value into the data task flow , system is throwing a error. The description of error is also mentioned below.
Kindly advise.
Error Description in DM package:
Description = Executing the query "exec dbo.sp_ver_copy2 'Account'" failed with the following error: "An error occurred while extracting the result into a variable of type (DBTYPE_STR)". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly. -
How to pass input value to the IN parameter in a function
Hi ,
I'm new to pl/sql programming.
The below function is used inside a package and the package is invoked in visual studio.
The function uses 2 input parameters.
Out of which 'in_report_parameter_id' value comes thru job processor service 's job request.
The second IN paramter values are hard coded in the function.
I'm not able to understand this.
If the values are hard coded , how to make sure that only the hard coded values are the right ones?
Please anyone could explain to me?
I really dont have good idea about how to pass INPUT parameter to the functions or procedure
Is there any nice document which could give me good understanding about what are the ways or types we could pass values to the input parameter in subprograms?
thanks in advance.
CREATE OR REPLACE FUNCTION get_class_text_str
in_report_parameter_id IN NUMBER,
in_which IN VARCHAR2 DEFAULT 'SELECT'
RETURN VARCHAR2
IS
end_text VARCHAR2 (50) := '';
my_class_text_str VARCHAR2(10000) := '';
my_class_value_str VARCHAR2(10000) := '';
CURSOR class_text(c_1_text VARCHAR2, c_2_text VARCHAR2) IS
SELECT c_1_text || report_parameters.report_parameter_value
|| c_2_text
|| report_parameters.report_parameter_value
|| '" '
FROM report_parameters
WHERE report_parameters.report_parameter_id = 3690
AND report_parameters.report_parameter_group = 'CLASS'
AND report_parameters.report_parameter_name = 'CLASS'
GROUP BY report_parameters.report_parameter_value
ORDER BY CAST(report_parameters.report_parameter_value AS NUMBER);
BEGIN
IF (in_which = 'SUM') THEN
OPEN class_text ( 'SUM(NVL("Class ', '", 0)) "Class ' );
ELSIF (in_which = 'PERC')THEN
OPEN class_text ( 'ROUND((("Class ', '" / "Total") * 100), 2) "Class ' );
end_text := ', DECODE("Total", -1, 0, 100) "Total" ';
ELSE
OPEN class_text ( 'SUM(DECODE(bin_id, ', ', bin_value, 0)) "Class ' );
END IF;
LOOP
FETCH class_text INTO my_class_value_str;
EXIT WHEN class_text%NOTFOUND;
my_class_text_str := my_class_text_str || ', ' || my_class_value_str;
END LOOP;
CLOSE class_text;
my_class_text_str := my_class_text_str || end_text;
RETURN my_class_text_str;
END get_class_text_str;
/Edited by: user10641405 on Nov 19, 2009 8:16 AM
Edited by: user10641405 on Nov 19, 2009 8:30 AMThis is not a design I would use, but should work if coded properly. I would probably build a reference cursor query as text and use one open fetch and close.
You have 2 input parameters, in_report_parameter_id and in_which. I could not find where in_report_parameter_id was used in the program, but the value passed in for in_which is being used in IF logic to decide how to open the cursor. After the cursor is open rows are being fetched and eventually the cursor is closed.
The values in_which are compared to are hard-coded. It is the programmer's job to make sure the values listed are the right values and the actions taken are also correct. Your program is assuming that if the first 2 values are not encountered the third one listed is the one you want.
To pass input values to a procedure you merely provide the values as a literal or variable in the call, something like
whatever := get_class_text_str(1,'SELECT'); -
Pass a Parameter to Function?
Hi All,
can you please tell me is it possible to pass a parameter to a function in the Select statement
for example
select * from table(test.get_trans_by_period('141', '123456874', '20000101', '20100101'))
How can I use BI Publisher to pass the values using parameters
I tried
select * from table(test.get_trans_by_period(:p_param1, :p_param2, :p_param3, :p_param4))
but it's not working
BR,
RossyYou can write a data template, and call the function from within the xml block for the data template, as in a database query.
The rtf supports xsl code behind the tags, so can write xsl code in rtf. -
Invoking PL/SQL function (via DB Adapter) with in parameter (BPEL newbie)
Hi!
Using: JDeveloper: 10.1.3.3.0, OAS: 10.1.3
I'm new to BPEL, and now I have a simple problem:
anyway to pass in parameter value with PL/SQL function call via DB Adapter?
PL/SQL function like this:
>>
create or replace function f_test_bpel (p_in in number)
return number
is
begin
return p_in;
end;
>>
For example (audit part of invoke in BPEL Console. Output always null :( ):
>>
Invoke_F_TEST_BPEL
[2008/01/10 15:51:39] Invoked 2-way operation "F_TEST_BPEL" on partner "F_TEST_BPEL".less
- <messages>
- <Invoke_1_F_TEST_BPEL_InputVariable>
- <part name="InputParameters" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<InputParameters xmlns="http://xmlns.oracle.com/pcbpel/adapter/db/MYDB/F_TEST_BPEL/">
<P_IN>7</P_IN>
</InputParameters>
</part>
</Invoke_1_F_TEST_BPEL_InputVariable>
- <Invoke_1_F_TEST_BPEL_OutputVariable>
- <part name="OutputParameters" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <OutputParameters xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.oracle.com/pcbpel/adapter/db/MYDB/F_TEST_BPEL/">
<F_TEST_BPEL>
</F_TEST_BPEL>
</OutputParameters>
</part>
<part name="response-headers" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
</part>
</Invoke_1_F_TEST_BPEL_OutputVariable>
</messages
>>
RegardsAdding more to what 'Arcturus' has put across :
1) You can check your input & output arguments to a PL/SQL function/procedure using an assign activity, in which you tend to assign a source variable to a target variable.
Here, you can check to see, if the input & output to the DB Adapter are correct, if not, you can always recreate the adapter.
2) You can also check the schema of the PL/SQL function, to check if it has the right inputs & outputs.
It'd be a .xsd file in the format of <SCHEMA_NAME-OF-FUNCTION.xsd> viz. SCOTT_EMPDETAILS.xsd -
How to pass dynamic parameter to a database function in OBIEE
Hi,
I have a requirement like this. I have to create one report in OBIEE which was in Discoverer. Now in discoverer report there are some calculated item in the worksheet based on database pkg.functions. The parameter which user gives at run time that parameters are then passed to the discoverer calculated items dynamically. But I am not able to do this in OBIEE answers.
Can anyone tell me step by step how I can able to pass the user selected parameter values in OBIEE answer level.
The example:
GET_COMM_VALUE_PTD("AFE Cost & Commitment".Afe Id,:"Period Name(AFE)","AFE Cost & Commitment".Data Sel,"AFE Cost & Commitment".Org Id)
GET_COMM_VALUE_PTD --- Function database
("AFE Cost & Commitment".Afe Id,:"Period Name(AFE)","AFE Cost & Commitment".Data Sel,"AFE Cost & Commitment".Org Id --- Parameters... :"Period Name(AFE)" is the dynamic parameter selected run time by user.
Please help.
Thanks
TitasHi,
I already did that. But the existing discoverer re value report is showing correct value but the OBIEE report with EVALUATE function shows incorrect value.
The requirement is to create a OBIEE Dashboard from a Discoverer existing report. Now in discoverer report theere are several calculated items in worksheet level where database custom function is used and user selected parameter value is passed run time in that function. But when that is created in OBIEE with EVALUATE function in RPD, the report shows incorrect data. Could not understand how to pass the parameter value runtime.
Below is the discoverer 'Show SQL' query and EVALUATE function syntax which has been used.
SELECT APPS.XXBG_PL_PROJ_ANALYSIS_AFE_PKG.GET_COMM_VALUE_PTD(XXBG_PL_PROJ_AFE_V.AFE_ID,
:"Period Name(AFE)",
XXBG_PL_PROJ_AFE_V.DATA_SEL,
XXBG_PL_PROJ_AFE_V.ORG_ID),
XXBG_PL_PROJ_AFE_V.AFE_DESC,
XXBG_PL_PROJ_AFE_V.AFE_NUMBER,
XXBG_PL_PROJ_AFE_V.APPROVED_AFE_AMOUNT
FROM APPS.PA_PERIODS_ALL PA_PERIODS_ALL,
APPS.XXBG_PL_PROJ_AFE_V XXBG_PL_PROJ_AFE_V
WHERE ((XXBG_PL_PROJ_AFE_V.ORG_ID = PA_PERIODS_ALL.ORG_ID))
AND (XXBG_PL_PROJ_AFE_V.DATA_SEL = :"Data Selection(AFE)")
AND (PA_PERIODS_ALL.PERIOD_NAME = :"Period Name(AFE)")
AND (XXBG_PL_PROJ_AFE_V.AFE_NUMBER = :"AFE Number(AFE)")
AND (XXBG_PL_PROJ_AFE_V.OPERATING_UNIT = :"Operating Unit(AFE)")
The EVALUATE function syntax is as below:
EVALUATE('XXBG_PL_PROJ_ANALYSIS_AFE_PKG.GET_COMM_VALUE_PTD(%1,%2,%3,%4)' AS FLOAT , "BG PL Project Analysis Report_1"."AFE Cost & Commitment"."AFE Cost & Commitment.Afe Id", "BG PL Project Analysis Report_1"."Periods 1"."Periods 1.Period Name", "BG PL Project Analysis Report_1"."AFE Cost & Commitment"."AFE Cost & Commitment.Data Sel", "BG PL Project Analysis Report_1"."AFE Cost & Commitment"."AFE Cost & Commitment.Org Id")
The PERIOD needs to be passed at run time which user will select.
Please help to solve the issue. -
Pass multiple values as single input parameter into pipelined function
Hi all,
My need is to pass multiple values as single input parameter into pipelined function.
For example - "2" and "3" are values of input parameter "t":
with data as (
select 1 as t from dual union all
select 2 as t from dual union all
select 3 as t from dual union all
select 4 as t from dual union all
select 5 as t from dual
select * from data where t in (2,3)Is it possible at all?Not exactly sure, but usually 'multiple values'+'pipelined function' = some IN-LIST related approach?
See:
SQL> create table data as
2 select 1 as t from dual union all
3 select 2 as t from dual union all
4 select 3 as t from dual union all
5 select 4 as t from dual union all
6 select 5 as t from dual;
Table created.
SQL> --
SQL> CREATE OR REPLACE FUNCTION in_list (p_in_list IN VARCHAR2)
2 RETURN sys.odcivarchar2list PIPELINED
3 AS
4 l_text VARCHAR2(32767) := p_in_list || ',';
5 l_idx NUMBER;
6 BEGIN
7 LOOP
8 l_idx := INSTR(l_text, ',');
9 EXIT WHEN NVL(l_idx, 0) = 0;
10 PIPE ROW (TRIM(SUBSTR(l_text, 1, l_idx - 1)));
11 l_text := SUBSTR(l_text, l_idx + 1);
12 END LOOP;
13
14 RETURN;
15 END;
16 /
Function created.
SQL> --
SQL> select *
2 from data
3 where t in ( select *
4 from table(in_list('1,2'))
5 );
T
1
2
2 rows selected.http://www.oracle-base.com/articles/misc/dynamic-in-lists.php
or
http://tkyte.blogspot.nl/2006/06/varying-in-lists.html -
How to pass parameter into extract function (for XMLTYPE)
I have a table PROBLEMXML with XMLTYPE field xml_column. In this column there are several deffinitions for the problem. There is no max amount of deffinitions and it can be no definition at all. I need to return all definitions for every problem as a string wirh definitions separated by ";".
Query
SELECT extract(prob.Def,'/Definitions/Definition[1]/@var') || ';'|| extract(prob.Def,'/Definitions/Definition[2]/@var')
FROM PROBLEMXML j ,
XMLTABLE (
'/problem'
PASSING j.xml_column
COLUMNS probid VARCHAR (31) PATH '/problem/@id',
Def XMLTYPE PATH '/problem/Definitions') prob
where PROBLEM_ID =1;
returns exactly what I want a;m.
But
declare
my_var varchar2(2000) :=null;
n1 number;
n2 number;
begin
n1:=1;
n2:=2;
SELECT extract(prob.Def,'/Definitions/Definition[n1]/@var') || '|'|| extract(prob.Def,'/Definitions/Definition[n2]/@var') into my_var
FROM ETL_PROBLEMXML_STG_T j ,
XMLTABLE (
'/problem'
PASSING j.xml_column
COLUMNS probid VARCHAR (31) PATH '/problem/@id',
Def XMLTYPE PATH '/problem/Definitions') prob
where PROBLEM_ID =1;
dbms_output.put_line(my_var);
end;
returns NULL.
Is there is a way to pass parameter into extract function?I need to return all definitions for every problem as a string wirh definitions separated by ";".In XQuery, there's the handy function "string-join" for that.
For example :
SQL> WITH etl_problemxml_stg_t AS (
2 SELECT 1 problem_id,
3 xmltype('<problem id="1">
4 <Definitions>
5 <Definition var="var1"></Definition>
6 <Definition var="var2"></Definition>
7 <Definition var="var3"></Definition>
8 </Definitions>
9 </problem>') xml_column
10 FROM dual
11 )
12 SELECT j.problem_id,
13 prob.probid,
14 prob.def
15 FROM etl_problemxml_stg_t j,
16 XMLTable(
17 'for $i in /problem
18 return element r
19 {
20 $i/@id,
21 element d { string-join($i/Definitions/Definition/@var, ";") }
22 }'
23 passing j.xml_column
24 columns
25 probid varchar2(30) path '@id',
26 def varchar2(100) path 'd'
27 ) prob
28 ;
PROBLEM_ID PROBID DEF
1 1 var1;var2;var3 -
Pass a record type vaiable in out parameter of a function in a package
Hi All,
1.I have created a ecod inside a package.
2.Then created a function which has a out parameter of the above record.
3.Now package body i'm creating a dynamic cursor .
4.My equirement is to fetch this dynamic cursor's value into the out parameter of the function.
I have created the below code for 1,2 and 3 but not getting how to achive the point 4.
create package pkg
type t_rec is recod (id number,id_name varchar2(10));
type t_data is table of t_rec index by binary_integer;
act_data t_data;
funcion return_data is (dept in number,region in number,o_rec out t_data) return boolean;
end pkg;
create package body pkg
funcion return_data is (dept in number,region in number,o_rec out t_data) return boolean is
p_cur sys_refcursor;
l_text varchar2(100);
begin
-- As per my requirement i have built a dynamic l_text which contains where clause by taking dept and region values.In actual i have nearly 10 in paramaters with >which i'm building a dynamic where clause in l_text. So i'm using a ref cursor.
open p_cur for 'select id,id_name from tab1'||l_text';
fetch p_cur bulk collect into act_data;
exception ....
end pkg;Now as per the code snippet i could fetch all the rows returned by p_cur into act_data.
But how i will pass it though out parameter in the function which i will use somewhere in front end to show data.
Please help me in this.
Thanks in advance.bp wrote:
i need to create the where clause one the basis of the values of IN parameters.Sometimes i need to take count of the data on the basis of the IN parameters and if one of the conditions return value i will build where clause with those parameters.Please google and read up on the importance of creating shareable SQL - which needs to be done using bind variables.
The ref cursor interface in PL/SQL only support a static/fixed number of bind variables. So if you want to create cursors with variable number of bind values, you need to use conditional processing. E.g.
SQL> create or replace procedure EmpFilter( c OUT sys_refcursor, nameFilter varchar2, jobFilter varchar2 ) is
2 sqlSelect varchar2(32767);
3 begin
4 --// we pretend to built a dynamic SQL statement - so the table
5 --// name and so on is "unknown"
6 sqlSelect := 'select * from emp ';
7 case
8 when nameFilter is null and jobFilter is null then
9 open c for sqlSelect;
10
11 when nameFilter is null and jobFilter is not null then
12 sqlSelect := sqlSelect||'where job like :filter';
13 open c for sqlSelect using jobFilter;
14
15 when nameFilter is not null and jobFilter is null then
16 sqlSelect := sqlSelect||'where ename like :filter';
17 open c for sqlSelect using nameFilter;
18
19 when nameFilter is not null and jobFilter is not null then
20 sqlSelect := sqlSelect||'where ename like :filter1 and job like :filter2';
21 open c for sqlSelect using nameFilter, jobFilter;
22
23 end case;
24
25 DBMS_OUTPUT.put_line( 'Dynamic SQL: '||sqlSelect );
26 end;
27 /
Procedure created.
SQL>
SQL>
SQL> var c refcursor
SQL> begin
2 EmpFilter( :c, 'A%', null );
3 end;
4 /
Dynamic SQL: select * from emp where ename like :filter
PL/SQL procedure successfully completed.
SQL> print c
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7499 ALLEN SALESMAN 7698 1981/02/20 00:00:00 1600 300 30
7876 ADAMS CLERK 7788 1987/05/23 00:00:00 1100 20
SQL>
SQL> begin
2 EmpFilter( :c, null, 'ANALYST' );
3 end;
4 /
Dynamic SQL: select * from emp where job like :filter
PL/SQL procedure successfully completed.
SQL> print c
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7788 SCOTT ANALYST 7566 1987/04/19 00:00:00 3000 20
7902 FORD ANALYST 7566 1981/12/03 00:00:00 3000 20
SQL>And this approach is for external clients - where a Visual Basic or Java client program calls the database, executes the stored procedure, and receives a cursor handle in turn. And the client then fetches the output of this cursor and process it.
There is no need to return a record type of any sorts. The client wants the cursor handle as that is the optimal and best interface for the client to receive database data.
If the caller is not an external client, but another PL/SQL procedure, then this approach does not make much sense.
It is important that you understand basic Oracle concepts and fundamentals. What a cursor is. What the best way is to process Oracle data. How to best use the basic features of Oracle. Without that basic understanding, you as good as a low hour Cessna pilot getting into an Airbus A400M - where the Cessna pilot would not even be able to start a single engine, never mind get the plane in the air.
Likewise, without a basic understanding of Oracle cursors and fundamentals, you will be unable to code even a single line of sensible code. Not because you are a bad programmer. Even the best programmer in the world will be unable to write decent code, if the programmer has no idea how the environment works, what the concepts and fundamentals are. But it is fair to expect that a good programmer will no write such code, understand that there is a lack of knowledge, and address that accordingly.
Maybe you are looking for
-
Hello, i have a pdf form in single page, but is very long and i want cut in 3 pages (3 or more). When i cut the template the first page, mantein the configuration, but other pages not. Any can help me? Thanks.
-
Solaris 10/10 dvd not boot
I try to install Solaris 10/10 from DVD boot disc, and use Installation check CD. It boot OK, and print what my system is like to install Solaris 10/10: Vendor Device: Type Name Solaris Driver: 32BIT 64BIT nVidia Corpora... U nForce2 USB Controller Y
-
After migrating my share using robocopy destination share ends up being read only
I'm trying to migrate a share from a old fileserver to a windows server 2008. I use robocopy to copy and it seems like it copies the permissions and all of the data. I have done this at least 5 times (i checked the permissions and everything looks
-
I have had and used my Elements 9.0 for 3 months. T today I tried to go into it and an error messege came up... said the exe file is missing and when I search it is not on my computer. I tried to reinstall and it says I cant. I bought this program an
-
Adobe PDF Registry Key for setting Available PostScript Memory
Good evening, Is there a Registry Key that can be modified to set the "Available Postscript Memory" in the Device Settings tab of the Adobe PDF Converter ? Thank you, Jeff