Store the result of a function in a variable
HelloI have an interface where I do some transformations (get Oracle COST of the corresponding values of PeopleSoft). For research, I have a PL/SQL function in place. This function takes the values of the columns in my input in the runtime source data store. I want to store the result of the function in a variable, use the variable instead of calling the function again later. Any help is appreciated.
Hello
I had the problem...
Gotta 'keep' the same order value to execute the PL/SQL only once...
In this case, a first suggestion is:
(1) create an interface to load a temporary table (yellow interface). The target table will be the PK and a field with the PL/SQL returned returns. The source will have the same tables as the real interface.
Remember, IKM, to set the create table and options to truncate to 'yes '.
2) add the temporary table to the real interface (drag / move the yellow interface itself in the source of real interface box) and create a join by PK.
(3) just to map the column transformed (from the temporary table) for columns 4 targets...
This help you?
Published by: Cezar Santos on 02/12/2008 13:52
Tags: Business Intelligence
Similar Questions
-
How to store the result of a query in a variable in the data model
In a model of date I want to do something like this
< name of dataTemplate = than one dataSourceRef "HURDetail" = "BRM_DATA_SOURCE" >
< Parameters >
< parameter name = "PARAM_THRESHOLD_VALUE" dataType = "number", defaultValue = "0" / >
< / Parameter >
< SQLStatement instance name = "Q1" >
<! [CDATA]
SELECT count (*) FROM TABLE_NAME
[]] >
< / sqlStatement >
-I want to assign the output of the above query to PARAM_THRESHOLD_VALUE so I can use it in future requests...
-My query is complex, for reason of performance I want to store the output of the query.
Please suggest how do...
Made a package with the PARAM_THRESHOLD_VALUE parameter and the function value entry assigns the done variable to work?
Thank you
ShivaHey Shiva,
If you want to use the value of the counter in the other queries in the data model, you can have an alias for the extraction of County and use it as a bind variable in other queries as
SELECT count (*) PARAM_THRESHOLD_VALUE
FROM TABLE_NAME
]]>
and can use it in another query as
SELECT XYZ
FROM TABLE_NAME2
WHERE XXX = *: PARAM_THRESHOLD_VALUE *.
]]>
Hope this is what you want.
Thank you. -
SQL Query - store the result for optimization?
Good day experts,
I'm looking for advice on a report. I did a lot of analytical functions to get the basic data that I have to do my report and its takes about 50 min for SQL finish. Now, with these data, I need to create 3 different reports and I can't use the SQL even since there are a lot of aggregation (example would be product group in one case and by customer in 2nd). For each of these different group garages I need another report.
So how to create 3 reports of 1 SQL query without running the query 3 times?
First thing that comes to mind is to store the result set in a fictitious table, and then query the table since I get the basic data are about 300 lines and then perform different garages group.
Best regards
Igor
So how to create 3 reports of 1 SQL query without running the query 3 times?
You already know the obvious answer - store data 'somewhere '.
If any 'somewhere' depends on your needs and you have not provided ALL the.
MV - if the query is always the same, you might use a MV and make a complete refresh when you want that new data. The data are permanent and can be queried by other sessions, but the query that accesses the data is frozen in the definition of MV.
GTT (global temporary table) - If a NEW charge of data AND three reports will be ALWAYS executed by a single session and then data are no longer necessary so a TWG may work. The application that loads the TWG can be different for each race, but the data won't be available for a single session and ONLY for the duration of this session. So if something goes wrong and the session ends the data are missing.
First thing that comes to mind is to store the result set in a fictitious table, and then query the table since I get the basic data are about 300 lines and then perform different garages group.
Which is commonly called a "table of REPORT-READY." Those that are useful when data must be permanent and available for multiple sessions/users. Generally, there is a batch (for example the package procedure) that periodically refreshes / updates the data during a window of failure. Or the table can have a column (for example AS_OF) that allows it to contain multiple data sets and the update process let alone the existing data and creates a new set of data.
If your database is about 300 lines you can consider a table report and even use it to contain multiple data sets. Then, the reports can be written to query the data by using a value AS_OF that wraps and returns the appropriate data. You don't need a window of failure since the oldest data are still available (but can be removed when you no longer need.
If you need a set of data, you can use a partitioned table work (with only one partition) to collect the new set of data, then a SWAP PARTITION to 'swap' in the new data. Only, this "Exchange" takes a fraction of a second and avoids a window of failure. Once the swap done no matter what user query will get new data.
-
How to store the result of the second SP in variable in first SP
Hello
I have two stored procedures "sp1" and "sp2". I want to call sp1 sp2, but I want to store the result of sp2 in any variable or derive from table or anything else
so that I can use the result of sp2 in sql sp1.
Yours sincerely.>
I have two stored procedures "sp1" and "sp2". I want to call sp1 sp2, but I want to store the result of sp2 in any variable or derive from table or anything elseso that I can use the result of sp2 in sql sp1.
>
Too many questions and not enough information.1. the number of rows of data are you talking about?
2. have you already written procedures? If you could put the two procs in the same package and use a collection of share plan.
3. what actually does sp2? Could you do it in sp1 query/cursor instead of having a separate procedure?
4. you could make sp2 a procedure in pipeline and then sp1 can query sp2 such as table data.
5. for large amounts of data, you can use a global temporary Table.
6. for small amounts of data, you can use a collection of PL/SQL. -
The right way to store the results of the query
Hey wizards Oracle,.
I have a few questions that take a long time to run. Given that the results of these queries change only once a day, I will execute queries every morning and store their results in a table.
I was going to serialize them in chains to the CSV format and then store them as CLOB. But shit, Oracle is a data table, storage system! This is reinventing the wheel within a wheel.
Then I thought about creating one table per query would be the right way to store their results. But ordinary tables data recovery would be slow, because I would need to create an additional of ORDER_BY column to maintain the order of the results of the query.
It seems that there is a way to store varrays in the LOB columns, but it does not seem to be appropriate.
There may be a caching mechanism that could help?
Does anyone know the proper way to store the result of a query?What you describe is a reinvention of the materialized views.
Have you considered using them?----------
Sybrand Bakker
Senior Oracle DBA -
Store the result of SQL in the local file?
Hello
Is it possible to store the results of SQL (executed from ksh scripts) in the file on the local client (server not DB), I know how to do in SQLPlus, but want to simpify process using existing script .ksh calling Oracle and exec any SQL.
Is this possible?
TX
MWell, you always need SQL * more:
#!/bin/sh sqlplus -s username/password@tnsentry << EOF set trimout on trimspool on tab off echo off feed off verify off pages 0 lines 20000 spool result.txt replace select * from emp; spool off exit EOF exit
NOTE: code not tested, not Linux/Unix to play with for now
-
Store the result in the file in SQL Developer
Hello
Is it possible to store the results of the query, or MS in physical file?
I found no option to do this, I'm under it from Windows using SQL Developer machine.
then I expect output file will be stored on the server of Ora machine, right? There is probably no option for Oracle to store on the local computer of W.
TX all
TRentRight-click in the selection of grid, export data, an option.
-
defining the results of a query to a variable
Hi all
I'm having a problem affecting the results of a query to a variable. What I'm trying to do, is to do an AJAX call to a .cfc file and pass back the results of the function. The main problem is, I'm again moving a block of HTML (resulting from a cfquery in a cfoutput) stored in a variable. My code is something like...
< name cffunction = "getText" access = "remote" returntype = 'Cancel' >
< datasource = "" #request.dsn # cfquery "name ="queryTable">"
SELECT kort, infoBOf infoTable
< / cfquery >
< cfset result = ' <!-this is the part I'm stuck, I want the table go here. -> ">"< table >
< cfoutput query = "tablequery" >
< b >
< td > #infoA # < table > < td > #infoB # < table >
< /tr >
< / cfoutput >
< /table >
< cfwddx action = "cfml2js" input = "" # result # ' toplevelvariable 'o' = > "< / cffunction >
It is a simplified version of what I want to do, but you get the idea...
Is it still the right way to go about this? Thank you
That's what I get for trying the E-mail response feature! Are you not happy, that I double checked my post.
You could do a lot of string concatenation here to do stuff like
"& Kort &" "& infoB &" "> time and time again." But in reality the tagsis so much easier to use.
#infoA #. #infoB #.
-
where to store the result of comparison data
Hello
No one knows who / record from the table that the result data (tab in the application designer upgrade) compares the PeopleSoft store?
Thanks in advance.
DennisOf Enterprise PeopleTools 8.51 PeopleBook: PeopleSoft Application Designer Lifecycle Management Guide, part of Definition of Report Options
"+ * PSCOMPDEFN *: contains high-level information related to compare it, for example the name of the project, target, source database name database name, compare and so on." +
+ * PSCOMPITEM *: contains the data related to each of the definitions which are compared, including the type, name of the definition, the source state definition, status of target and so on. +
+ * PSCOMPITEMDATA *: contains specific data about individual attributes compared. + »Nicolas.
-
How to send the result of a function as an input to another function
Hello
I wrote a function wich return string. I want to send string returned as an input to another function. How can I integrate these two functions.
Thank you...I want to send the result of the first function as input for another function
It's what do all these examples.
Do not get hung up on BOM - function1 and function2 - the one call it first (with or without argument) returns a value that is passed in a second and even, in my example, the output of the last second in a third (dbms_output).
select function72727347(function9596943 (argument)) from dual
Published by: Dom Brooks on February 18, 2011 12:08
-
Is it possible to put the results of a query in a variable to use in the bean class?
Hello, I am using JDeveloper 12.1.2.0.0
I like to keep the result of my queries (the method that I created in the AppModule) in a richeTableau or another type of variable, so I can get results and I don't have to make unnecessary after queries. I don't think that the query is the problem but keeping the results.
I tried to do in using this:
public String testVFactSales (String conditions) {}
PreparedStatement query = getDBTransaction () .createPreparedStatement ("" + "select * from v_fact_sales"+ conditions, 0 ");
ResultSet rs;
Outcome of the result set;
Result of the richeTableau;
String result = null;
try {}
query.setString (1, conditions);
Query.Execute ();
Query.Execute ();
result = query.getGeneratedKeys ();
Query.Close ();
System.out.println ("result:" + result.toString ());
return result.toString ();
} catch (SQLException e) {}
e.printStackTrace ();
}
Return ' ';
}
As you can see, I have already tried a few solutions, but so far I have only errors (cannot convert or null exception, when I try to put the result in a richeTableau in my bean class)
Any ideas?
It is very important for me, because it would improve the performance of my project a lot.
Kind regards
Frederico.
Although the issue is not 100% responded, I used the idea that Shay told me, where you can create a method in your AppModule to set your where clause!
Good luck to everyone who has the same problem.
As an attack similar to what I wanted in the first place, you can check this:
https://community.Oracle.com/thread/2619669
Kind regards
Frederico.
-
How to store the results in several digital Test
My VI returns two double individual (not in a table), output power and frequency
I am configuring a multiple digital test in TestStand but struggling to store readings.
Using the following, I get an error.
Output power of VI: Step.Result.Measurement ["Measurement 0"]. Data
VI output frequency: Step.Result.Measurement ["Measurement 1"]. Data
Would appreciate some advice.
Thank you
Got, it works
Results were to be stored in Step.NumericArray [0], Step.NumericArray [1] and not Step.Result.Measurement ["Measurement 0"] as I've had.
Thank you
-
How to store the XML Fragments using functions such as XMLElement
Hello
Don't know what I'm missing. I want to store XML fragments in variables so that can move around and concatenate it with the other fragments to make the final XML document. Even before trying to concatenate XML fragments, I fight to store any XML fragment in a variable. I try to use simple functions such as XMLElement to generate XML data can be stored in the variable. I've seen many examples of XMLElement in SQL select statement. XMLElement is usable in plsql? XMLElement said she returned the value of type XMLType. Functions such as XMLElement to generate XML easy to create all the tags manually.
Here is a simple example that illustrates what I would do. I wish I could pass the XML as clob or XMLType fragment. I get error saying PLS-00201: identifier "XMLELEMENT" must be declared
declare
XMLType vTheData;
CLOB vTheDataClob;Start
vTheData: = XMLelement("empno",'1234567');
vTheDataClob: = xmlelement("empno",'1234567').getclobval ();
end;Wherever I can use below, but certainly do not use select double method of. I just can use the XMLElement function in plsql even than sql, like most of the other functions for example length, rtrim etc.
declare
XMLType vTheData;
CLOB vTheDataClob;Start
Select xmlelement("empno",'1234567')
in vTheData
Double;Select xmlelement("empno",'1234567').getclobval)
in vTheDataClob
Double;
end;Hope it makes sense.
Thank you
That said, is there a more elegant way to achieve below. It is fill two XML fragments and concatenate together.
Of course, why not just a single statement?
Select XMLConcat)
XMLElement (...)
XMLElement (...)
)
in vTheResult
Double;
As is a second question, better to build and send XML as clob or XMLType fragments?
I would say that staying with XMLType, but it depends on your condition.
I generally avoid passing around data elements, SQL/XML functions are powerful in the way that they can be used with set operations, until their use in a piecemeal approach some deny what they are for.
-
PLSQL function to return the result of the query
Dear all,
Oracle Database SE1 11.2.0.1
I need to create a plsql function which should accept SQL as a parameter, execute it and return the result set.
Is this possible?
Madhu.149 wrote:
I need to create a plsql function which should accept SQL as a parameter, execute it and return the result set.
Be careful - results games indicate a set of data stored in memory. This is not what are sliders. This isn't how Oracle should be used.
Imagine that you implement such a result set function - which, on average, requires 1 MB of memory (private server) to store the results of the SQL query. A 100 users mean a 100 MB of memory required server. This is not suitable. Not at all. Never.
The correct back 'thing' is a handle to SQL cursor (called a ref cursor in this case). A SQL cursor is a "program" - that the appellant runs via the fetch command and generates one or more lines accordingly. Appellant repeatedly runs this slider through calls to fetch until this slider found and returns all rows affected (using consistent readings).
If you want an abstraction interface that the client can call via PL/SQL code in the database, so this crafting optimal SQL interface, creates the SQL cursor and returns the handle of the cursor (via the ref cursor data type) to the client.
-
Report based on the result of the sorting function?
Dear all,
I will make this issue in general terms:
We have a report based on a query that reads data from a single table (P). It will take to provide a field more (X) in the report which is obtained using more than two tables (E, 1 m approx).
I wrote a function that produces this extra field based on a join of tables E and P1. Please note that this function depends on the report query variables. This output is correct and provides all the necessary information, but it is necessary to sort the report based on the result of this function, i.e. the value of field X.
Is this possible?
I appreciate your comments.
Note: I've tried incorporating pictures E, P1 in the request report (I can then sort on the required field) but gets reduced the number of lines in the report. This is because the join between the tables, P, E and P1 reduces the number of lines (which is not the correct result).
Yes, it is possible. If you have ended up above a formula column.
Create the formula column. For example, CF_SALARY_TOTAL. Place a level to the top of the query and set your desired sort (Asc/Desc)
Hope this helps
Hamid
Maybe you are looking for
-
File sent in Gmail is not sync with Thunderbird
I use Gmail on my phone (Android) and Thunderbird on my laptop (Win 8.1). When I send an email using my phone, I'd like to see this email sent to my folder sent to Thunderbird, but apparently not appears. Is it possible to do? Thanks in advance.
-
Laptop will not turn on or charge
My laptop only turns on when I press the power button. It will be not too to recharge the battery. I've had this phone for almost 2 years now, a this is the first time I have had this problem. I tried removing the battery and pressing the power for 3
-
I want aero to work but also to set up a game for my kids fisher price system but I need to change the resolution in order to make it work and trying to drag the slider, he's not moving that I also need to change to 32 bit which I'll beable when I ch
-
How to solve error code: 0x800106ba?
When I try to turn on my windows Defender is the answer "this program service has stopped. You can manually start the service or restart your computer, which should start the service. (Error code: 0x800106ba)
-
I have a company calling me saying they are in collaboration with Microsoft and the support. Is it a scam?