Search in Nested Tables and Insert the result into new Nested Table!
How can I search in Nested Tables ex: (pr_travel_date_range,pr_bo_arr) using the SQL below and insert the result into a new Nested Table: ex:g_splited_range_arr.
Here are the DDL and DML SQLs;
Don't worry about the NUMBER( 8 )
CREATE OR REPLACE TYPE DATE_RANGE IS OBJECT ( start_date NUMBER( 8 ), end_date NUMBER( 8 ) );
CREATE OR REPLACE TYPE DATE_RANGE_ARR IS TABLE OF DATE_RANGE;
DECLARE
g_splited_range_arr DATE_RANGE_ARR := DATE_RANGE_ARR( );
g_travel_range DATE_RANGE := DATE_RANGE( '20110101', '99991231' );
g_bo_arr DATE_RANGE_ARR := DATE_RANGE_ARR( DATE_RANGE( '20110312', '20110317' ), DATE_RANGE( '20110315', '20110329' ) );
FUNCTION split_date_sql( pr_travel_date_range DATE_RANGE,
pr_bo_arr DATE_RANGE_ARR )
RETURN DATE_RANGE_ARR
IS
l_splited_range_arr DATE_RANGE_ARR;
BEGIN
SELECT start_date, end_date
INTO l_splited_range_arr(start_date, end_date)
FROM (WITH all_dates
AS (SELECT tr_start_date AS a_date, 0 AS black_out_val FROM TABLE( pr_travel_date_range )
UNION ALL
SELECT tr_end_date, 0 FROM TABLE( pr_travel_date_range )
UNION ALL
SELECT bo_start_date - 1, 1 FROM TABLE( pr_bo_arr )
UNION ALL
SELECT bo_end_date + 1, -1 FROM TABLE( pr_bo_arr )),
got_analytics
AS (SELECT a_date AS start_date,
LEAD( a_date ) OVER (ORDER BY a_date, black_out_val) AS end_date,
SUM( black_out_val ) OVER (ORDER BY a_date, black_out_val) AS black_out_cnt
FROM all_dates)
SELECT start_date, end_date
FROM got_analytics
WHERE black_out_cnt = 0 AND start_date < end_date
ORDER BY start_date);
RETURN l_splited_range_arr;
END;
BEGIN
g_splited_range_arr := split_date_sql(g_travel_range,g_bo_arr);
FOR index_g_splited_range_arr IN g_splited_range_arr .FIRST .. g_splited_range_arr .LAST LOOP
DBMS_OUTPUT.PUT_LINE('g_splited_range_arr[' || index_g_splited_range_arr || ']: ' || g_splited_range_arr(index_g_splited_range_arr).start_date || '-' || g_splited_range_arr(index_g_splited_range_arr).end_date );
END LOOP;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
NULL;
WHEN OTHERS
THEN
NULL;
END;Or can I create a VIEW with parameters of Nested Tables in it so I can simply call
SELECT *
BULK COLLECT INTO g_splited_range_arr
FROM view_split_date(g_travel_range,g_bo_arr);
@riedelme
For your questions:
1) I don't want to store in the database as a nested table
2) I don't want to retrieve data from the database. Data will come from function split_date() parameter and data will be processed in the function and function will return it in nested table format. For more detail please look at the raw function SQL.
I have a SQL like:
WITH all_dates
AS (SELECT tr_start_date AS a_date, 0 AS black_out_val FROM travel
UNION ALL
SELECT tr_end_date, 0 FROM travel
UNION ALL
SELECT bo_start_date - 1, 1 FROM black_out_dates
UNION ALL
SELECT bo_end_date + 1, -1 FROM black_out_dates),
got_analytics
AS (SELECT a_date AS start_date,
LEAD( a_date ) OVER (ORDER BY a_date, black_out_val)
AS end_date,
SUM( black_out_val ) OVER (ORDER BY a_date, black_out_val)
AS black_out_cnt
FROM all_dates)
SELECT start_date, end_date
FROM got_analytics
WHERE black_out_cnt = 0 AND start_date < end_date
ORDER BY start_date;I want to change the tables black_out_dates and travel to Nested Array so I can use it in a function with Nested Array travel and Nested Array black_out_dates parameters and the function will return Nested Array of date ranges.
Here is what I want in raw SQL:
DECLARE
g_splited_range_arr DATE_RANGE_ARR := DATE_RANGE_ARR( );
g_travel_range DATE_RANGE := DATE_RANGE( '20110101', '99991231' );
g_bo_arr DATE_RANGE_ARR := DATE_RANGE_ARR( DATE_RANGE( '20110312', '20110317' ), DATE_RANGE( '20110315', '20110329' ) );
FUNCTION split_date_sql( pr_travel_date_range DATE_RANGE,
pr_bo_arr DATE_RANGE_ARR )
RETURN DATE_RANGE_ARR
IS
l_splited_range_arr DATE_RANGE_ARR;
BEGIN
SELECT start_date, end_date
INTO l_splited_range_arr(start_date, end_date)
FROM (WITH all_dates
AS (SELECT tr_start_date AS a_date, 0 AS black_out_val FROM TABLE( pr_travel_date_range )
UNION ALL
SELECT tr_end_date, 0 FROM TABLE( pr_travel_date_range )
UNION ALL
SELECT bo_start_date - 1, 1 FROM TABLE( pr_bo_arr )
UNION ALL
SELECT bo_end_date + 1, -1 FROM TABLE( pr_bo_arr )),
got_analytics
AS (SELECT a_date AS start_date,
LEAD( a_date ) OVER (ORDER BY a_date, black_out_val) AS end_date,
SUM( black_out_val ) OVER (ORDER BY a_date, black_out_val) AS black_out_cnt
FROM all_dates)
SELECT start_date, end_date
FROM got_analytics
WHERE black_out_cnt = 0 AND start_date < end_date
ORDER BY start_date);
RETURN l_splited_range_arr;
END;
BEGIN
g_splited_range_arr := split_date_sql(g_travel_range,g_bo_arr);
FOR index_g_splited_range_arr IN g_splited_range_arr .FIRST .. g_splited_range_arr .LAST LOOP
DBMS_OUTPUT.PUT_LINE('g_splited_range_arr[' || index_g_splited_range_arr || ']: ' || g_splited_range_arr(index_g_splited_range_arr).start_date || '-' || g_splited_range_arr(index_g_splited_range_arr).end_date );
END LOOP;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
NULL;
WHEN OTHERS
THEN
NULL;
END;I must change the tables black_out_dates and travel in a way so it will be something like
FROM TABLE( pr_travel_date_range )to get the result into l_splited_range_arr so it will be something like
SELECT start_date, end_date
INTO l_splited_range_arr(start_date, end_date)
FROM (
Similar Messages
-
The attached file is work inprogress, with some dummy data sp that I can test it out without having to connect to equipment.
The second tab is the one that I am having the problem with. the output array from the replace element appears to be starting at the index position of 1 rather than 0 but that is ok it is still show that the new data is placed in incrementing element locations. However the main array that I am trying to build that is suppose to take each new calculation and place it in the next index(row) does not ap
pear to be working or at least I am not getting any indication on the inidcator.
Basically what I am attempting to do is is gather some pulses from adevice for a minute, place the results for a calculation, so that it displays then do the same again the next minute, but put these result in the next row and so on until the specifiied time has expired and the loop exits. I need to have all results displayed and keep building the array(display until, the end of the test)Eventually I will have to include a min max section that displays the min and max values calculated, but that should be easy with the min max function.Actually I thought this should have been easy but, I gues I can not see the forest through the trees. Can any one help to slear this up for me.
Attachments:
regulation_tester_7_loops.vi 244 KBI didn't really have time to dig in and understand your program in depth,
but I have a few tips for you that might things a bit easier:
- You use local variables excessively which really complicates things. Try
not to use them and it will make your life easier.
- If you flowchart the design (very similar to a dataflow diagram, keep in
mind!) you want to gather data, calculate a value from that data, store the
calculation in an array, and loop while the time is in a certain range. So
theres really not much need for a sequence as long as you get rid of the
local variables (sequences also complicate things)
- You loop again if timepassed+1 is still less than some constant. Rather
than messing with locals it seems so much easier to use a shiftregister (if
absolutely necessary) or in this case base it upon the number of iterations
of the loop. In this case it looks like "time passed" is the same thing as
the number of loop iterations, but I didn't check closely. There's an i
terminal in your whileloop to read for the number of iterations.
- After having simplified your design by eliminating unnecessary sequence
and local variables, you should be able to draw out the labview diagram.
Don't try to use the "insert into array" vis since theres no need. Each
iteration of your loop calculates a number which goes into the next position
of the array right? Pass your result outside the loop, and enable indexing
on the terminal so Labview automatically generates the array for you. If
your calculation is a function of previous data, then use a shift register
to keep previous values around.
I wish you luck. Post again if you have any questions. Without a more
detailed understanding of your task at hand it's kind of hard to post actual
code suggestions for you.
-joey
"nelsons" wrote in message
news:[email protected]...
> how do I create a 1d array that takes a single calculation and insert
> the result into the first row and then the next calculation the next
> time the loop passes that point and puts the results in thsecond row
> and so on until the loop is exited.
>
> The attached file is work inprogress, with some dummy data sp that I
> can test it out without having to connect to equipment.
> The second tab is the one that I am having the problem with. the
> output array from the replace element appears to be starting at the
> index position of 1 rather than 0 but that is ok it is still show that
> the new data is placed in incrementing element locations. However the
> main array that I am trying to build that is suppose to take each new
> calculation and place it in the next index(row) does not appear to be
> working or at least I am not getting any indication on the inidcator.
>
> Basically what I am attempting to do is is gather some pulses from
> adevice for a minute, place the results for a calculation, so that it
> displays then do the same again the next minute, but put these result
> in the next row and so on until the specifiied time has expired and
> the loop exits. I need to have all results displayed and keep building
> the array(display until, the end of the test)Eventually I will have to
> include a min max section that displays the min and max values
> calculated, but that should be easy with the min max function.Actually
> I thought this should have been easy but, I gues I can not see the
> forest through the trees. Can any one help to slear this up for me. -
Select from 2 tables and insert same data into 2 other tables(BPEL Process)
Hi All,
Please suggest me how to select from 2 tables and insert the same data into 2 tables. I am successful in selecting data from 2 tables, but i am not able to insert the same data into 2 other tables. There is foreign key constraint between 2 tables.
Thanks in Advance,
MAHI have created DB Adapter for selecting from 2 tables and also DB adapter for insert and i have created parent child relationship between 2 tables.
I am getting this error
<Faulthttp://schemas.xmlsoap.org/soap/envelope/>
<faultcode>env:Server</faultcode>
<faultstring>com.oracle.bpel.client.delivery.ReceiveTimeOutException: Waiting for response has timed out. The conversation id is 6f3fe20c1b031057:-6cc7dfb5:11b8bf5fbe1:-7fa4. Please check the process instance for detail.</faultstring>
</Fault> -
Generate xml from a table and insert the xml into another table
I want to generate an xml file from a table and insert it into another table all in one tsql
insert into table B(xmlfile)
select * from tableA
FOR
XML
PATH('ac'),TYPE,ELEMENTS
XSINIL,ROOT('Accum')
Is not working any helpI have solved my issue all I did was to change my column datatype to xml
-
Hi,
I have a query that joins two tables in the same database, the result needs to be loaded in a destination DB table. How do I do this in SSIS package?
thank you !
Thank You Warmest Fanny PiedPlease take a look at these links related to your query.
http://stackoverflow.com/questions/5145637/querying-data-by-joining-two-tables-in-two-database-on-different-servers
http://stackoverflow.com/questions/7037228/joining-two-tables-together-in-one-database -
How to read a table and transfer the data into an internal table?
Hello,
I try to read all the data from a table (all attribute values from a node) and to write these data into an internal table. Any idea how to do this?
Thanks for any help.Hi,
Check this code.
Here i creates context one node i.e flights and attributes are from SFLIGHT table.
DATA: lo_nd_flights TYPE REF TO if_wd_context_node,
lo_el_flights TYPE REF TO if_wd_context_element,
ls_flights TYPE if_main=>element_flights,
it_flights type if_main=>elements_flights.
navigate from <CONTEXT> to <FLIGHTS> via lead selection
lo_nd_flights = wd_context->get_child_node( 'FLIGHTS' ).
CALL METHOD LO_ND_FLIGHTS->GET_STATIC_ATTRIBUTES_TABLE
IMPORTING
TABLE = it_flights.
now the table data will be in internal table it_flights. -
How can i open a DOC or TXT file and insert the data into table?
How can i open a DOC or TXT file and insert the data into table?
I have a doc file . the doc include some columns and some rows.(for example 'ID,Name,Date,...').
I'd like open DOC file and I'd like insert them into the table with same columns.
Thanks.Use the SQL*Loader utility or the UTL_FILE package.
-
Compare String in a table and insert the common values into a New table
Hi all,
Anyone has idea on how to compare a string value in a table.
I have a Students Table with Student_id and Student_Subject_list columns as below.
create table Students( Student_id number,
Student_Subject_list varchar2(2000)
INSERT INTO Students VALUES (1,'Math,Science,Arts,Music,Computers,Law,Business,Social,Language arts,History');
INSERT INTO Students VALUES (2,'Math,Law,Business,Social,Language arts,History,Biotechnology,communication');
INSERT INTO Students VALUES (3,'History,Spanish,French,Langage arts');
INSERT INTO Students VALUES (4,'History,Maths,Science,Chemistry,English,Reading');
INSERT INTO Students VALUES (5,'Math,Science,Arts,Music,Computer Programming,Language arts,History');
INSERT INTO Students VALUES (6,'Finance,Stocks');
output
Student_id Student_Subject_list
1 Math,Science,Arts,Music,Computers,Law,Business,Social,Language arts,History
2 Math,Law,Business,Social,Language arts,History,Biotechnology,communication
3 History,Spanish,French,Langage arts
4 History,Maths,Science,Chemistry,English,Reading
5 Math,Science,Arts,Music,Computer Programming,Language arts,History
6 Finance,Stocks
I need help or some suggestion in write a query which can compare each row string value of Student_Subject_list columns and insert the
common subjects into a new table(Matched_Subjects).The second table should have the below colums and data.
create table Matched_Subjects(Student_id number,
Matching_studesnt_id Number,
Matched_Student_Subject varchar2(2000)
INSERT INTO Matched_Subjects VALUES (1,2,'Math,Law,Business,Social,Language arts,History');
INSERT INTO Matched_Subjects VALUES (1,3,'History,Langage arts');
INSERT INTO Matched_Subjects VALUES (1,4,'History,Maths,Science');
INSERT INTO Matched_Subjects VALUES (1,5,'Math,Science,Arts,Music,Language arts,History');
INSERT INTO Matched_Subjects VALUES (2,3,'History,Langage arts');
INSERT INTO Matched_Subjects VALUES (2,4,'History,Maths');
INSERT INTO Matched_Subjects VALUES (2,5,'Math,Language arts,History');
INSERT INTO Matched_Subjects VALUES (3,4,'History');
INSERT INTO Matched_Subjects VALUES (3,5,'Language arts,History');
INSERT INTO Matched_Subjects VALUES (4,5,'Math,Science');
output:
Student_id Match_Student_id Matched_Student_Subject
1 2 Math,Law,Business,Social,Language arts,History
1 3 History,Langage arts
1 4 History,Maths,Science
1 5 Math,Science,Arts,Music,Language arts,History
2 3 History,Langage arts
2 4 History,Maths
2 5 Math,Language arts,History
3 4 History
3 5 Language arts,History
4 5 Math,Science
any help will be appreciated.
Thanks.
Edited by: user7988 on Sep 25, 2011 8:45 AMuser7988 wrote:
Is there an alternate approach to this without using xmlagg/xmlelement What Oracle version are you using? In 11.2 you can use LISTAGG:
insert
into Matched_Subjects
with t as (
select student_id,
column_value l,
regexp_substr(student_subject_list,'[^,]+',1,column_value) subject
from students,
table(
cast(
multiset(
select level
from dual
connect by level <= length(regexp_replace(student_subject_list || ',','[^,]'))
as sys.OdciNumberList
select t1.student_id,
t2.student_id,
listagg(t1.subject,',') within group(order by t1.l)
from t t1,
t t2
where t1.student_id < t2.student_id
and t1.subject = t2.subject
group by t1.student_id,
t2.student_id
STUDENT_ID MATCHING_STUDESNT_ID MATCHED_STUDENT_SUBJECT
1 2 Math,Law,Business,Social,Language arts,History
1 3 Language arts,History
1 4 Science,History
1 5 Math,Science,Arts,Music,Language arts,History
2 3 Language arts,History
2 4 History
2 5 Math,Language arts,History
3 4 History
3 5 History,Language arts
4 5 History,Science
10 rows selected.
SQL> Prior to 11.2 you can create your own string aggregation function STRAGG - there are plenty of example on this forum. Or use hierarchical query:
insert
into Matched_Subjects
with t1 as (
select student_id,
column_value l,
regexp_substr(student_subject_list,'[^,]+',1,column_value) subject
from students,
table(
cast(
multiset(
select level
from dual
connect by level <= length(regexp_replace(student_subject_list || ',','[^,]'))
as sys.OdciNumberList
t2 as (
select t1.student_id student_id1,
t2.student_id student_id2,
t1.subject,
row_number() over(partition by t1.student_id,t2.student_id order by t1.l) rn
from t1,
t1 t2
where t1.student_id < t2.student_id
and t1.subject = t2.subject
select student_id1,
student_id2,
ltrim(sys_connect_by_path(subject,','),',') MATCHED_STUDENT_SUBJECT
from t2
where connect_by_isleaf = 1
start with rn = 1
connect by student_id1 = prior student_id1
and student_id2 = prior student_id2
and rn = prior rn + 1
STUDENT_ID MATCHING_STUDESNT_ID MATCHED_STUDENT_SUBJECT
1 2 Math,Law,Business,Social,Language arts,History
1 3 Language arts,History
1 4 Science,History
1 5 Math,Science,Arts,Music,Language arts,History
2 3 Language arts,History
2 4 History
2 5 Math,Language arts,History
3 4 History
3 5 History,Language arts
4 5 History,Science
10 rows selected.SY. -
I'm really new to the whole area of JSON, autocomplete and javascript. My first project in this area is personal: making it easier to search for wines in my wine cellar.
I have all my wines in a sqlite database (driven by CF 9 of course) and have a nice UI to report on, add, modify, delete, etc. What I want to add is a search capability that works like this: a user types text in a search box in any order they want and automagically, the wine is found.
To be specific, a user could start with "2005 Caymus" and the area below the text search box would be populated with all of the varietals of Caymus for 2005 that are in the cellar. Similarly the user might start the search by typing "2005 Cabernet" in which case anything in the cellar that is from 2005 and a Cabernet Sauvignon or a Cabernet Franc from all wineries would appear below the text box. Or maybe they just want to see what French wines are in the cellar, so they'd start their search with "France" or "French". (BTW, winery, vintage, wine type (varietal), country, appellation, etc. are all separate fields in the database/table.)
Is my imagined search capability possible, or does each aspect of the search (year, winery, wine type/varietal) have to be user-entered into a separate text box?
Any guidance/answers greatly appreciated! If you're local, might even be worth sharing a vintage bottle of wine!Sorry I was unclear.
Google is a single text box. If you type "coldfusion 9 new features"
you get a good listing of your results without having one box for
software one for version one for descriptor and
one for topic . Similarly with Google it's likely you'll get
somewhat similar results typing in "new features coldfusion 9" or
"coldfusion 9 features". So for my wine app I just want to present the
user with one box so they can type in "Caymus 2005 Cabernet Sauvignon"
(a "specific" search) or "2005" (a search for all wines from that year),
etc. It's the cleanness of the user experience I'm trying to
accommodate here. Make sense? -
I have a mpp screen for a cd library management system (we are practicing on it).
We have a main screen where a user should enter the enteries and while clicking a add button it should be inserted in a table, Here the problem rises the table name are ztransaction and zstatus.The fields in mpp are cdid,customerid,transaction id,date of issue and duedate.Now after entering all the values on clicking add button it should be inserted to database table ztransaction and the field cdid alone should be inserted both in ztransaction and zstatus.
Thank youHi Raghuram R G,
Check for Primary key and foreign key in the Database table??? Because of this it was not inserting...check and confirm??
Regds,
Vijay SR -
How do i upload an image to a server and put the name into a database table
Ok, i found a php image upload script that im using for a cms
image gallery on my site. But for it to work the way i need to i
have to have certain information submited into a mysql table at the
same time. I could just make it so the user types the name of the
image in a second form, but i would rather not have to as it seems
a clumsy way to do things and opens things up to typos etc.
So, i can upload the image ok, and i can upload data to the
table, but i dont know what I have to do so that the name of the
uploaded file is automaticly inserted into the mysql table.
The first bit of code below is the form I am using to upload
the file to the server. The second bit of code is what I am using
to tell the server what the file name is.
How do I combine the 2 form into one? Please help. It is
driving me to dispair.
Attach Code
<form enctype="multipart/form-data" action="uploader.php"
method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="500000"
/>
Choose a file to upload: <input name="uploadedfile"
type="file" />
<br />
<input type="submit" value="Upload File" />
</form>
<form action="<?php echo $editFormAction; ?>"
method="post" name="form2" id="form2">
<table align="center">
<tr valign="baseline">
<td nowrap="nowrap" align="right">Image One</td>
<td><input type="text" name="kingsImage1"
value="<?php echo
htmlentities($row_rskingscentre['kingsImage1'], ENT_COMPAT,
'UTF-8'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Image Two</td>
<td><input type="text" name="kingsImage2"
value="<?php echo
htmlentities($row_rskingscentre['kingsImage2'], ENT_COMPAT,
'UTF-8'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Image
Three</td>
<td><input type="text" name="kingsImage3"
value="<?php echo
htmlentities($row_rskingscentre['kingsImage3'], ENT_COMPAT,
'UTF-8'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap"
align="right"> </td>
<td><input type="submit" value="Update record"
/></td>
</tr>
</table>
<p> </p>
<p>
<input type="hidden" name="MM_update" value="form2" />
<input type="hidden" name="kingsHeader" value="<?php
echo $row_rskingscentre['kingsHeader']; ?>" />
</p>
</form>jeffoirecoupe1234 wrote:
> Ok, i found a php image upload script that im using for
a cms image gallery on
> my site. But for it to work the way i need to i have to
have certain
> information submited into a mysql table at the same
time. I could just make it
> so the user types the name of the image in a second
form, but i would rather
> not have to as it seems a clumsy way to do things and
opens things up to typos
> etc.
>
> So, i can upload the image ok, and i can upload data to
the table, but i dont
> know what I have to do so that the name of the uploaded
file is automaticly
> inserted into the mysql table.
>
> The first bit of code below is the form I am using to
upload the file to the
> server. The second bit of code is what I am using to
tell the server what the
> file name is.
>
> How do I combine the 2 form into one? Please help. It is
driving me to dispair.
>
> Attach Code
>
> <form enctype="multipart/form-data"
action="uploader.php" method="POST">
> <input type="hidden" name="MAX_FILE_SIZE"
value="500000" />
> Choose a file to upload: <input name="uploadedfile"
type="file" />
> <br />
> <input type="submit" value="Upload File" />
> </form>
>
> <form action="<?php echo $editFormAction; ?>"
method="post" name="form2"
> id="form2">
> <table align="center">
> <tr valign="baseline">
> <td nowrap="nowrap" align="right">Image
One</td>
> <td><input type="text" name="kingsImage1"
value="<?php echo
> htmlentities($row_rskingscentre['kingsImage1'],
ENT_COMPAT, 'UTF-8'); ?>"
> size="32" /></td>
> </tr>
> <tr valign="baseline">
> <td nowrap="nowrap" align="right">Image
Two</td>
> <td><input type="text" name="kingsImage2"
value="<?php echo
> htmlentities($row_rskingscentre['kingsImage2'],
ENT_COMPAT, 'UTF-8'); ?>"
> size="32" /></td>
> </tr>
> <tr valign="baseline">
> <td nowrap="nowrap" align="right">Image
Three</td>
> <td><input type="text" name="kingsImage3"
value="<?php echo
> htmlentities($row_rskingscentre['kingsImage3'],
ENT_COMPAT, 'UTF-8'); ?>"
> size="32" /></td>
> </tr>
> <tr valign="baseline">
> <td nowrap="nowrap"
align="right"> </td>
> <td><input type="submit" value="Update record"
/></td>
> </tr>
> </table>
> <p> </p>
> <p>
> <input type="hidden" name="MM_update" value="form2"
/>
> <input type="hidden" name="kingsHeader"
value="<?php echo
> $row_rskingscentre['kingsHeader']; ?>" />
> </p>
> </form>
>
>
>
Hi Jeff:
Though this does not show you how to solve this issue via a
code
snippett, there are a couple of extensions at WebAssist.com
that enable
you to do this, they are Data Assist and Digital File Pro.
When you have
time, take a look at these Solution Recipes (tutorials) that
show how
DataAssist is used and then now Digital File Pro is used in
conjunction
with DataAssist:
http://www.webassist.com/professional/products/solutionrecipe/Media_139.asp
http://www.webassist.com/professional/products/solutionrecipe/Media_112.asp
DataAssist can be used to save time when you need to build
database
search and management applications quickly, and Digital File
Pro can be
used to include file upload functionality to your form fields
while
enabling you to insert your server file name into the
database, all on
the same page.
enthusiastically,
mark haynes -
Stage tab delimited CSV file and load the data into a different table
Hi,
I pretty new to writing PL/SQL packages.
We are using Application express for our development. We get CSV files which is stored as a BLOB content in a table. I need to write a trigger that would get executed once the user the uploads the file and parse thru the Blob content and upload or stage the data in a different table.
I would like to see if there is any tutorial or article that could explain the above process with the example or sample code to do the same. Any help in this regard will be highly appreciated.Hi,
This is slightly unusual but at the same time easy to solve. You can read through a blob using the dbms_lob package, which is one of the Oracle supplied packages. This is presumably the bit you are missing, as once you know how you read a lob the rest is programming 101.
Alternatively, you could write the lob out to a file on the server using another built in package called utl_file. This file can be parsed using an appropriately defined external table. External tables are the easiest way of reading data from flat files, including csv.
I say unusual because why are you loading a csv file into a blob? A clob is almost understandable but if you can load into a column in a table why not skip this bit and just load the data as it comes in straight into the right table?
All of what I have described is documented functionality, assuming you are on 9i or greater. But you didn't provide a version so I can't provide a link to the documentation ;)
HTH
Chris -
How to execute a function and return the result into a bind variable
Hi,
I am trying to calculate the sum of salaries of all persons with a particular JOB_ID using a function TOTAL_INCOME(v_job_id).
create or replace function total_income
+(v_job_id IN varchar2)+
RETURN number IS
v_total number(6);
cursor get_sal is
select salary from employees
where job_id = v_job_id;
BEGIN
v_total := 0;
for emp in get_sal
loop
v_total := v_total emp.salary;+
end loop;
dbms_output.put_line('Total salary of '||v_job_id||' is: '|| v_total);
return v_total;
END;
Now I woud like to execute this function and assign the returned value into a bind variable test_sal
variable test_sal number(6)
SELECT total_income('AD_VP') into :test_sal FROM DUAL;
dbms_output.put_line('Total Sal:'||:test_sal);
This is returning the below errors:
SELECT total_income('AD_VP') into :test_sal FROM DUAL
*+
Error at line 0
ORA-01036: illegal variable name/number
dbms_output.put_line('Total Sal:'||:test_sal);
Error at line 3
ORA-00900: invalid SQL statement
Could someone help me what could be the problem?? Thanks for your time...Dear,
If everything you will do will be done inside PL/SQL (stored procedure or stored function) then you don't have to care about bind variable.
When using PL/SQL (static SQL) you will never encounter issues related to bind variables. PL/SQL itself takes care of your code and uses bind variables behind the scene.
The only situation where you have to look carefully to the use of bind variables within PL/SQL is when you use Dynamic sql into stored procedures or functions.
So, see in the light of the above comment, if you have to care about returning your function into a bind variable?
Best regards
Mohamed Houri -
SELECT o.OrderID,SUM((od.UnitPrice * od.Quantity) - (od.Discount/100))+ o.Freight AS TotalOrderPrice
FROM [Order Details] as od join Orders as o on o.OrderID=od.OrderID
GROUP BY o.OrderID, o.Freight
select distinct o.employeeid, count(o.OrderID)as totalorders from Orders o group by o.EmployeeIDAs suggested above, you need a common key for JOINing the queries (CTE-s):
WITH CTE1 AS
(select distinct o.employeeid, count(o.OrderID)as totalorders from Orders o group by o.EmployeeID)
CTE2 AS (SELECT o.OrderID, SUM((od.UnitPrice * od.Quantity) - (od.Discount/100))+ o.Freight AS TotalOrderPrice
FROM [Order Details] as od join Orders as o on o.OrderID=od.OrderID
GROUP BY o.OrderID, o.Freight)
SELECT
FROM CTE1 INNER JOIN CTE2 .....
CTE example: http://www.sqlusa.com/bestpractices2005/cte/
Kalman Toth Database & OLAP Architect
Free T-SQL Scripts
New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012 -
After generating a table into xml how can i save the result in a XML table?
Hello everyone,
I’ve used this function to generate a table into XML schema :
example :
SELECT xmlelement("State", xmlattributes( 'http://www.opengis.net/gml' as "xmlns:gml"),
xmlforest(name as "Name", population as "Population")) from state;
result:
<Statexmlns:gml="http://www.opengis.net/gml">
<Name>Wilkopolska</Name>
<Population>35000</Population>
</State>
Now I need to insert the result into a XML table, because i need to save the result to use it latter ,I hope that someone can help and if there's other solution to do this it would be great.
Thanks a ot and best regards,
Lama.Just insert into a table....
insert into t
SELECT xmlelement("State", xmlattributes( 'http://www.opengis.net/gml' as "xmlns:gml"),
xmlforest(name as "Name", population as "Population")) from state; and a complete example:
SQL> create table t (test xmltype)
2 /
Table created.
SQL>
SQL> create table state
2 (name varchar2(10)
3 ,population number
4 )
5 /
Table created.
SQL>
SQL> insert into state values ('WI', 35000)
2 /
1 row created.
SQL>
SQL> SELECT xmlelement("State", xmlattributes( 'http://www.opengis.net/gml' as "xmlns:gml"),
2 xmlforest(name as "Name", population as "Population")) from state;
XMLELEMENT("STATE",XMLATTRIBUTES('HTTP://WWW.OPENGIS.NET/GML'AS"XMLNS:GML"),XMLFOREST(NAMEAS"NAME",P
<State xmlns:gml="http://www.opengis.net/gml"><Name>WI</Name><Population>35000</
SQL>
SQL>
SQL> insert into t
2 SELECT xmlelement("State", xmlattributes( 'http://www.opengis.net/gml' as "xmlns:gml"),
3 xmlforest(name as "Name", population as "Population")) from state;
1 row created.
SQL> select *
2 from t
3 /
TEST
<State xmlns:gml="http://www.opengis.net/gml"><Name>WI</Name><Population>35000</
Maybe you are looking for
-
How to use mathematical functions in XSL mapping
Hi, I am using Jdeveloper 10.1.3.3. I need to insert mathematical functions like "multiply,divide,power" etc in my mapping. But in the XSL i am getting all string functions and very few math functions for number. I am newbie in Jdev. Please if anyone
-
Linking a programmatically created folder in SharePoint Document Library.
I have created folders within a document library using InfoPath & C#. To that folder I uploaded several documents using several file attachment controls within the same InfoPath Form using the code behind the form. Now I want to create an Hyperlink
-
Just bought the Lumia 520 and the Bluetooth can't pick up any devices and my car and my friends phone can't discover my phone neither. Is there a reason why?? HELP! (want to play music and answer calls via Bluetooth while driving- hands free)
-
Error thrown in FDKSession class...
Hi,<br> <br> I am Getting the following exception inside the construction of oracle.ifs.examples.content.fdk.FdkSession class., at the line <b>"int statuscode = response.getStatusCode();"</b> <br><br> 06/11/16 14:28:52 java.net.ProtocolException: Mis
-
i'm looking for a FREE lightweight java editor that supports auto-complete and possibly code generation. auto-complete is when you type the object and a dot, the editor pop-up a window listing all methods available for you to use. code generation (or