Creating a collection from a list and joining the list to a database table
I would like to have opinions on good ways to process rows, based on a provided list of key values, joining the collected list against a source table to retrieve additional information related to the key. In this simple example, the procedure accepts a list of employee numbers. The goal is to print a list of names associated with those numbers. The method is to materialize the list of employee numbers as rows and join those rows to a source table to get the names. I have used BULK COLLECT. I don't know if this is a good approach and I would value suggestions. I would also like to understand why we cannot cast PLSQL tables using a type defined in the procedure's specification (why the type needs to exist as an object before we can cast it, like this:
SELECT * FROM TABLE ( CAST ( SOME_FUNCTION(&some parameter) AS SOME_TYPE ) );
Anyway, here is my demo SQL, which you should be able to execute against the SCOTT schema without any changes. Thanks for your help!
declare
type employee_numbers is table of emp.empno%type index by binary_integer;
type employee_names is table of emp.ename%type index by binary_integer;
type employees_record is record (empno employee_numbers, person_name employee_names);
records employees_record;
employees_cursor sys_refcursor;
employee_number_list varchar2(30) default '7369,7499,7521';
begin
open employees_cursor for
with t as (
select regexp_substr(employee_number_list, '[^,]+', 1, level) as employee_number
from dual
connect by regexp_substr(employee_number_list, '[^,]+', 1, level) is not null
) select emp.empno, emp.ename
from t join emp on (emp.empno = t.employee_number)
order by 2
fetch employees_cursor bulk collect into records.empno, records.person_name;
dbms_output.put_line('number of records: '||records.empno.count());
for i in 1 .. records.empno.count
loop
dbms_output.put_line(chr(39)||records.empno(i)||chr(39)||','||chr(39)||records.person_name(i)||chr(39));
end loop;
end;
>
It looks like I have confirmation that BULK COLLECT is a good way to go collect rows for processing
>
Well maybe and maybe not. Bear in mind that those demos were only basic demos for the purpose of illustrating how functionality CAN be used. They do not tell you WHEN to use them.
BULK COLLECT uses expensive PGA memory and unless you know that only a small number of rows will be collected you can have some serious memory issues. Any heavy duty use of BULK COLLECT should generally have a LIMIT clause to limit the number of elements in the collection for each loop iteration.
Always use SQL if possible.
Also, for your use case you might be bette served using a PIPELINED function. Instead of collecting ALL rows into a nested table as in your example a PIPELINED function returns one row at a time but is still used as if it were a table using the same TABLE operator.
Here is simple example code for a PIPELINED function
-- type to match emp record
create or replace type emp_scalar_type as object
(EMPNO NUMBER(4) ,
ENAME VARCHAR2(10),
JOB VARCHAR2(9),
MGR NUMBER(4),
HIREDATE DATE,
SAL NUMBER(7, 2),
COMM NUMBER(7, 2),
DEPTNO NUMBER(2)
-- table of emp records
create or replace type emp_table_type as table of emp_scalar_type
-- pipelined function
create or replace function get_emp( p_deptno in number )
return emp_table_type
PIPELINED
as
TYPE EmpCurTyp IS REF CURSOR RETURN emp%ROWTYPE;
emp_cv EmpCurTyp;
l_rec emp%rowtype;
begin
open emp_cv for select * from emp where deptno = p_deptno;
loop
fetch emp_cv into l_rec;
exit when (emp_cv%notfound);
pipe row( emp_scalar_type( l_rec.empno, LOWER(l_rec.ename),
l_rec.job, l_rec.mgr, l_rec.hiredate, l_rec.sal, l_rec.comm, l_rec.deptno ) );
end loop;
return;
end;
select * from table(get_emp(20))
Similar Messages
-
Ability to create a collection from a text file containing the names of the pictures
1 thing that would be very good is the ability to create a collection / quick collection from a text file that contains the names of the picture we want in that collection...
The reason for that is when i receive an order from a customer typicaly 100-200 different pictures (i'm a wedding photographer), i ask my customer to send me an excel spread sheet with all the name or number of the picture thay want with size & quantity...
I would like to be able to use that file as an input for a batch job that would add all those files to a collection "customer order" instaid od adding them 1 by 1... it would save me lots of time and would prevent some errors in the order...
I am currently able to do that with the help of a small utility (Useful File Utility) is the name... with the other RAW converter i use... BibbleWell, it is workflow software, true, but it's really focussed on image development. What you're proposing would necessarily make the primary focus be on the business angle, I suspect.
If you're talking about tools to help customers sit down and pick what they want for manual processing later, that's one thing - but going the rest of the distance to order processing and fulfillment would be out of scope, at least in my view. The reason is that there is just so much room for potential variation in how this gets conducted that I can't see how Adobe could possibly satisfy every pro with one implementation. Even just dealing with all of the possible payment vendors is a hugely problematic area.
I agree with Don; a third-party plugin via the upcoming SDK might be a distinct possibility, particularly if it were for a "plus services" solution in which the plugin were designed to work with a specific fulfillment vendor. THAT could work quite nicely, and the plugin might even be free (in return for giving the vendor your business, of course).
In other words, it's not that I see it as a bad idea, it's just that I don't think it belongs in the "core" of LR. This is something that is best dealt with using the SDK so that differences in processes can be allowed for. -
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 -
How Do i create a list that will show in a dropdown box with the list being pulled from another tab and not the cell data format junk?
I currently run OS X 10.10.1
Now i have been trying to work on this for a while now and what i want to do should be simple but its apparently not.
Here is an example of what i want to happen.
I will have 2 tabs: Contact | Sales
Now Contacts will have the list of names and various information about a customer, While Sales will have one drop-down box for each Cell Row that will show the names of the person in tab contacts
for what i am wanting to do i cant use the data format pop-up menu because the list is edited everyday several times a day.
Now how do i do this, Excel can do this so how can numbers do it?Hi Shegra,
Paste this into a applescript editor window and run it from there. In the script you may need to adjust the four properties to agree with your spreadsheet. Let me know if you have any questions.
quinn
Script starts:
-- This script converts column A in one table into an alphabetized list of popups. It copies the last cell in that column. Then reverts the column to text. It then refreshes popups in column A of a data table starting with a user defined row.
property DataEntrySheet : "Sheet 1" --name of sheet with popups to be refreshed
property DataEntryTable : "Sales" --name of table with popups to be refreshed
set copyRange to {}
property PopValueSheet : "Sheet 1" --name of sheet with popup values table
property PopValueTable : "Contacts" --name of table with popup values
set PopStartRow to {}
tell application "Numbers"
set d to front document
set ps to d's sheet PopValueSheet
set pt to ps's table PopValueTable
set s to d's sheet DataEntrySheet
set t to s's table DataEntryTable
set tf to t's filtered --this records filter setting on data Entry Table
display dialog "Start from row #..." default answer "" with icon 1 -- with icon file "Path:to:my.icon.icns" --a Week # row
set PopStartRow to {text returned of result}
tell pt --convert list to alphabetized popups
set ptRows to count rows
set copyRange to ("A2:" & name of cell ptRows of column "A")
set selection range to range copyRange
set selection range's format to text
sort by column 1 direction ascending
set selection range's format to pop up menu
-- popupsmade
set selection range to cell ptRows of column 1 of pt
set v to value of cell ptRows of pt
end tell
activate application "Numbers"
tell application "System Events" to keystroke "c" using command down
tell pt
set selection range to range copyRange
set selection range's format to text
end tell
tell t
set filtered to false
set tRows to count rows
set pasteRange to ((name of cell PopStartRow of column "A") & ":" & (name of cell tRows of column "A"))
set selection range to range pasteRange
tell application "System Events" to keystroke "v" using command down
set filtered to tf
end tell
end tell -
Hi, I just installed CS6 master collection from order history and when I try to enter Serial Number it tells me that: Serial number you provided is valid, but qualifying product can not be found on this computer. Then it gives me options under drop down menu but Master Collection CS6 is the only one not appearing in a drop down menu.
Your CS6 must have been purchased as an upgrade. What it is asking you to select/provide is the name/serial number of the previous version you purchased that qualifies you to install and activate the CS6 upgrade version... this would be likely be one of CS3 thru CS5.5.
Error "This serial number is not for a qualifying product" | CS6, CS5.5, CS5
http://helpx.adobe.com/creative-suite/kb/error-serial-number-qualifying-product.html -
I purchased Adobe sc6 master collection from software city and i cannot locate the redemption code, but I do have the serial number for mac, do i still need the redemption code and where would i find it?
Hello,
please have a look there: https://helpx.adobe.com/x-productkb/global/redemption-code-help.html
>>> Redeem your redemption code in three easy steps.
Hans-Günter -
Hi
I am trying to set up an Azure RemoteApp Hybrid solution.
I have created RemoteApp net and uploaded a custom image and all that is fine.
When I link my template to my Collection it fails after provisioning for about an hour.
I recive the following message: Could not provision the RemoteApp collection. Error: Could not join the domain. Unable to reach the domain.
The join domin works fine and I have tryed with account with different lvl of access to my AD.
Any suggestion how to solve this?Hello Eric,
I am landing into the same Problem and i read your guidance on this issue. Let me answer it point by point.
1. Check the VPN state to ensure it is active or connected state:
Sundesh:My Azure RemoteApp Virtual Network after successfull S2S configuration shows as Ready. Is that what you mean by Connected State? Earlier to S2S, it was just under connecting state.
2. Verify your VNET configurations have proper IP address ranges
Sundesh: The VNET address range, the Local address range and DNS has already been verified twice. In fact the same address ranges(with exception to VNET) are working fine on a VENT config on Azure VM instance. Verified.
3. Verify your DNS IP configurations are valid, (often this is the problem)
Sundesh: Yes its done and verified
4. Verify the credentials entered for domain join are valid.
Sundesh: Tested these credentials by joining a regular Azure VM to domain and it works there.
5. Make sure your VPN endpoint that Azure RemoteApp service is connecting to is not blocking traffic.
Sundesh: Can you please let us know the specific port numbers that we need to consider and i can have it checked with the Network team
Thanks
SUndesh -
Is it possible to import photos from a disk and retain the same order?
Is i possible to import photos from a disk and retain the same order they appear on the disk? When I import them, the come out in random order.
When first imported the photos will be sorted in the Event chronologically. On the disk they well be sorted by the Finder and that's usually alphanumerically by file name. So select the photos in the event and type Commnad+N. That will create a new album at the left with the photos in it. Then go to the View ➙ Sort Photo menu and select "By Title". That should give you the same order as you view the photos on the disk via the Finder.
OT -
How Do I create Windows Form file in VS and add the form to my VS project?
C#, How Do I create Windows Form file in VS and add the form file to my VS project by using C# code?
I like to create a Windows Form file into my VS Win Form project by using C#. I have the path and the file name.
I need a Win Form with FileName.cs, FileName.Designer.cs, FileName.resx, and FileName (as you see it VS by adding a Win Form manually by using VS)
Rune BrattasYou cannot create a Form from code at run time.
For one thing, the user running your application will, almost certainly, not have a copy of Visual Studio to hand with which to build anything. (Not that you actually need 'Studio at all; Notepad and csc.exe are all you actually
need), but that's another story).
You can do this with an awful lot of pain, using the innards of the compiler from iside your own program, compiling the new Form's source code on the fly and then executing the resulting assembly within your application. IMHO, that's a simply terrifying
prospect especially as the code you will be compiling will be on someone else's machine and over which you will have absolutely no control. If you're lucky, they'll spell something wrong and it won't compile.
The "usual" way to do this sort of thing is to create additional, "plug-in" forms as library assemblies and have your program load and execute these at run-time.
Regards, Phill W. -
I have had a file disappear from creative cloud and then the name get reassigned to a different file. How do I retrieve the missing file?
If a file with the same name is saved again then a version is created. You can see versions from the Files page at https://creative.adobe.com/files. From the Files page click on the file to go to its page. Switch from the Details tab to the Activity tab if needed. You will see the Current Version and any past versions.
-
Attempted to create a slideshow (version 9.3) and get the dreaded spinning ball that will not go away; iphoto locked up when open. how do I get rid of the ball. Have forced quit seveal times and opens with the spinning ball.
Make a temporary, backup copy if you don't have a backup copy of the library (select the library and type Command+D) and apply the two fixes below in order as needed:
Fix #1
Launch iPhoto with the Command+Option keys held down and rebuild the library.
Since only one option can be run at a time start with Option #1, followed by #3 and then #4
Launch iPhoto and try again.
Fix #2
Using iPhoto Library Manager to Rebuild Your iPhoto Library
Download iPhoto Library Manager and launch.
Click on the Add Library button, navigate to your Home/Pictures folder and select your iPhoto Library folder.
Now that the library is listed in the left hand pane of iPLM, click on your library and go to the File ➙ Rebuild Library menu option
In the next window name the new library and select the location you want it to be placed.
Click on the Create button.
Note: This creates a new library based on the LIbraryData.xml file in the library and will recover Events, Albums, keywords, titles and comments but not books, calendars or slideshows. The original library will be left untouched for further attempts at fixing the problem or in case the rebuilt library is not satisfactory.
OT -
Creating a Master virtual hard disk and using the same for all other VM's
Hi,
We would like to create a master virtual hard disk and use the same for all other VM's. Can we do that ?
my requirements :
1) create 10 VM's
2) first create a master virtual hard disk with win OS and use the same to create the 10 VM's.
3) After creating the VM's change the HDD size.
-- if i have created master virtual disk with 500GB , and use the same for creating a virtual machine. can we change the HDD size to 1TB ?
After creating the VM's ,i will change the system names and activate the windows accordingly.
Will there be any implications ,if we can/will do like this.
Thanks.Hi Suren424,
I think Using Differencing Disks may cover your needs .
Please refer to following setps:
"Create the Parent Virtual Machine Configuration and Virtual Hard Disk
Install the Operating System, updates, and common software
Generalize the installation
Prepare the parent virtual hard disk
Create the differencing disks
Create virtual machines that use the differencing disks
For details please refer to follwing link:
http://social.technet.microsoft.com/wiki/contents/articles/1393.hyper-v-virtual-machine-vm-parent-child-configuration-using-differencing-disks.aspx
Hope this helps
Best Regards
Elton Ji
We
are trying to better understand customer views on social support experience, so your participation in this
interview project would be greatly appreciated if you have time.
Thanks for helping make community forums a great place. -
I'm trying to remove Exchange 2007 from an SBS 2008 server
(Server 2008 Standard FE). My ultimate goal is to completely remove the SBS 2008 Server from the network environment.
We have an Exchange 2010 Coexistence Scenario and Mailboxes/Public Folders/etc have been moved over to the 2010 mail server, on Server 2008 R2.
I have moved all Shares, FSMO roles, DHCP, DNS, etc over to their respective servers. We have two full blown DC's in the environment.
I'm ready to remove Exchange 2007 from SBS 2008 and DCPROMO the server. I can NOT seem to find a TechNet article that shows me how
to proceed in this kind of scenario. I am trying to use the TechNet article:
http://technet.microsoft.com/en-us/library/dd728003(v=ws.10).aspx
This article references Disabling Mailboxes, Removing OAB, Removing Public Folder Databases, then uninstalling Exchange using the Setup Wizard.
When I go to Disable Mailboxes I get the following error:
Microsoft Exchange Error
Action 'Disable' could not be performed on object 'Username (edited)'.
Username (edited)
Failed
Error:
Object cannot be saved because its ExchangeVersion property is 0.10 (14.0.100.0), which is not supported by the current version 0.1 (8.0.535.0). You will need a later version of Exchange.
OK
I really don't see why I need to Disable Mailboxes, Remove OAB and Public Folder Databases since they have been moved to 2010. I just want
to remove Exchange 2007 and DCPROMO this server (actually I just want to remove any lingering Exchange AD Objects referring to the SBS 2008 Server, using the easiest and cleanest method possible).
Can someone point me in the right direction?
Thanks!Hi,
Based on your description, it seems that you are in a migration process (migrate SBS 2008 to Windows Server
2008 R2). Now, you want to remove Exchange Server and demote server. If anything I misunderstand, please don’t hesitate to let me know.
On current situation, please refer to following articles and check if can help you.
Transition
from Small Business Server to Standard Windows Server
Removing SBS 2008 –
Step 1: Exchange 2007
Removing SBS 2008 – Step 2:
ADCS
Removing
SBS 2008 – Step 3: remove from domain / DCPROMO
Please Note: Since the web site is not hosted by Microsoft, the link may change without notice. Microsoft
does not guarantee the accuracy of this information.
Hope this helps.
Best regards,
Justin Gu -
Greetings from a Photoshop Newbie. I need a computer, preferably a Mac laptop, with some serious processing power. I take photos with a Pentax 645Z; files are 50MB raw. I upload from Adobe Bridge and manipulate the photo, sometimes turning them into files in excess of 250MB. I cannot resize as the large files are needed for enlargements. Have all sorts of problems trying to manipulate, add effects and saving most large files. I need some serious processing power. Can anyone suggest what Mac i should purchase? I thank you in advance for your help :-)
It sounds as if you're having some system-related problems now, unrelated to processing power as such. In particular, a buggy video driver can cause everything to slow to a crawl.
Medium format files are big, true, but not so big as to cause significant slowdowns on a normally functioning and reasonably current computer. A laptop will always be slower than a well-equipped desktop system, though. Mac vs PC plays no part in this, performance is unrelated to platform.
Bottlenecks are different in ACR and Photoshop, so that should give you a clue. ACR is computing-intensive and mostly limited by CPU speed. Photoshop, however, is mostly bandwidth-intensive and mainly limited by memory and disk throughput. It's also sensitive to GPU issues. -
How do I extract email from a form and send the PDF to that user?
How do I extract email from a form and send the PDF to that user?
here you can add email to send to, CC, Subject, and body message
var oDoc = event.target;
oDoc.mailDoc({
bUI: false,
cTo: "Agency Contact Email",
cCC: "",
cSubject: "Write your title here,
cMsg: "Dear" + AgencyContact + "(" + AgencyContactEmail + ")\nThe student, " + FirstName + " " + LastName + " has applied to work at your agency. Please confirm they can work here blah blah blah.......\n\nThanks.\n\nrespectuflly,\n\nme"
Maybe you are looking for
-
Nokia PC Suite - Message not save in "Sent" folder...
If you are using "Nokia Communication Center" in "Nokia PC Suite" than observe while sending the message that it will not save in "sent" folder. can anybody help me out?
-
I have recently noticed that there are about 8 or so Genius Playlists on my iPad without me ever having created them. I haven't turned on Genius, nor iTunes Match and would like to know why they got on there and how I can delete them.
-
IOS 4.2.1 to 4.1
Hi! I am using an iPhone 3G running on iOS 4.2.1, and am currently a little more than 2 thirds through a three year contract. I have never jailbreaked or unlocked my phone, nor do I have the intention to. But now, I need to downgrade very, very badly
-
Dreamweaver Template Editable Region Old Problem
Hello, Please, I need urgent help regarding the Adobe Dreamweaver CS3 program for Mac OS X. It is, unfortunately, driving me crazy, because I have now a problem that is not letting me edit any editable region in the child pages I create and apply the
-
24p Back to Tape; LP or DVD?
Hi, I am trying to output my DVX-100 24p advanced footage back to miniDV tape. Since the footage was imported into my sequence removing advanced pulldown, is there a way for Final Cut Pro to reinsert the flagged frames onto miniDV tape properly? Also