On-demand process query works only on some columns
I've run into what seems a strange problem. I have an on-demand process that queries the DB and returns a populated select list, which I've successfully used in several places. The query used returns values as it should when I query the DB directly. Within my process however, it returns no rows. I know the process works because if I replace the query that i need, with one on another column in same table, my select list populates. There are several other columns that also don't work, though there is no pattern in terms of data type, size, etc, that I can see, except that the non-working columns are rather far down a list of over 30 columns for that table.
Here is the process text:
begin
owa_util.mime_header('text/xml', FALSE );
htp.p('Cache-Control: no-cache');
htp.p('Pragma: no-cache');
owa_util.http_header_close;
htp.prn('<select>');
for rec in (select distinct op_comm d, op_comm r from CPUJAN2006
where upper(stream) = upper(:P100_TEMP_STREAM))
loop
htp.prn('<option value="' || rec.r || '">' || rec.d || '</option>');
end loop;
htp.prn('</select>');
end;
As mentioned, I can use this select statement directly on the DB and I can replace it in the process, with something like "select db_version from CPUJAN2006" and that works. Any ideas why this would not work on certain columns - could it have anything to do with number of columns in the table or column size?
Any advice appreciated. Thanks,
Michelle
I can and will if this doensn't clarify. I've narrowed down problem to specific records returned from the process query.
The text entries populating the select list sometimes contain the char '&'. When I get rid of these, my select lists look fine. The select list is populated with following bit:
htp.prn('<option value="' || rec.d || '">' || rec.r || '</option>');
I am thinking the & in some rec.d entries is interpreted as something other than text. I cannot change these text values in the DB, because they are fed from another DB. Can I somehow tell the process to view speacial characters as text?
Similar Messages
-
IMessage works only with some contacts
Why is iMessage working (blue) with some contacts and not with others? Obviously all with iPhones and iMessage activated
Hi there Bretsinclair,
You may find the troubleshooting steps in the article below helpful.
iOS: Troubleshooting Messages
http://support.apple.com/kb/ts2755
-Griff W. -
GetCustomAttributes FlagAttribute working only on some Enums
I have a bit of code that checks an enum to see if it has [Flags]. however, It only works for one of the enums that has a flag. the other ones are ignored for some reason.
var currentEnum = new EnumInfo() { Name = t.Name, IsFlagsEnum = t.GetCustomAttributes<FlagsAttribute>().Any() };
It loads the enums from an assembly and iterates through them. Nothing seems to be completely different between the enums other than the name and the values inside.
the t is the element in the foreach loop
foreach (Type t in query)
What would cause the get custom attributes to fail to find the [flags] attribute.The OrderBy seems to work, since all of the Enums are in order once it returns.
here's a couple of the enums, with scrubbed names.
This one returns false for flags.
[Flags]
public enum Method
Undefined = 0,
Site = 1,
Manual = 2,
API = 4
and this one gets the boolean IsFlagsEnum = true;
[Flags]
public enum Type
New = 0,
Existing = 1
Hi
Fullmetal99012,
Thanks for posting more useful information, Now i have tried reproed your issue. As
CoolDadTx said, you code works fine on my side. Here is my screenshot
>>the only difference on the two enumerations I posted above is that the one that isn't getting picked up by the code is reporting that the "members" of the enum have a CustomAttribute, while the one that is shows 0 for the custom attribute
count.
I doubt you put the Method enum as members of a class.
Best wishes,
Kristin
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.
Click
HERE to participate the survey. -
The question is not so clear i will try to explain here.
I have a trackBar scroll event:
private void trackBar1_Scroll(object sender, EventArgs e)
LoadPictureAt(trackBar1.Value, sender);
ConvertedBmp = ConvertTo24(trackBar1FileInfo[trackBar1.Value].FullName);
ConvertedBmp.Save(ConvertedBmpDir + "\\ConvertedBmp.bmp");
mymem = ToStream(ConvertedBmp, ImageFormat.Bmp);
backTexture = TextureLoader.FromStream(D3Ddev, mymem);
scannedCloudsTexture = new Texture(D3Ddev, 512, 512, 1, Usage.Dynamic, Format.A8R8G8B8, Pool.Default);
timer1.Stop();
Button1Code();
timer1.Start();
b1 = ConvertedBmp;
b1.Save(ConvertedBmpDir + "\\b1.bmp");
trackBar2.Enabled = false;
if (!this.backgroundWorker1.IsBusy)
label2.Text = "מעבד נתונים";
this.backgroundWorker1.RunWorkerAsync();
else
this.backgroundWorker1.CancelAsync();
First LoadPictureAt method:
private bool LoadPictureAt(int nIndex, object c)
bool bRet = false;
if (nIndex >= 0 && nIndex < trackBar1FileInfo.Length)
if (c.Equals(trackBar1))
pictureBox1.Load(trackBar1FileInfo[nIndex].FullName);
bRet = true;
if (bitmaps != null)
if (nIndex >= 0 && nIndex < bitmaps.Length)
if (c.Equals(trackBar2))
pictureBox1.Image = bitmaps[nIndex];
bRet = true;
return bRet;
Then the ConvertTo24 method:
private Bitmap ConvertTo24(string inputFileName)
sw = Stopwatch.StartNew();
Bitmap bmpIn = (Bitmap)Bitmap.FromFile(inputFileName);
Bitmap converted = new Bitmap(bmpIn.Width, bmpIn.Height, PixelFormat.Format24bppRgb);
using (Graphics g = Graphics.FromImage(converted))
// Prevent DPI conversion
g.PageUnit = GraphicsUnit.Pixel;
// Draw the image
g.DrawImageUnscaled(bmpIn, 0, 0);
//converted.Save(outputFileName, ImageFormat.Bmp);
sw.Stop();
return converted;
Then ToStream method:
public static Stream ToStream(Image image, ImageFormat formaw)
var stream = new System.IO.MemoryStream();
image.Save(stream, formaw);
stream.Position = 0;
return stream;
What it does is taking a Bitmap image and make a doppler radar effect on it and detect color only places that there are pixels(clouds) in it.
Here is a screenshot:
You can see the doppler shape and it's moving around and highlight the places with clouds.
So when i move the trackBar1 to the left each time on another Bitmap image it's showing the doppler effect and the clouds.
The problem is with the trackBar2 scroll event:
First when i'm running my program and enteric to this new form that scan the clouds and show the doppler radar effect a backgroundworker1 is working:
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
BackgroundWorker bgw = (BackgroundWorker)sender;
if (bgw.CancellationPending == true)
return;
else
while (true)
bitmaps = ImagesComparison.get_images_with_clouds(b1);
for (int i = 0; i < bitmaps.Length; i++)
bitmaps[i] = ConvertTo1or8Bit.ColorToGrayscale(bitmaps[i]);
break;
What it does is getting into bitmaps(Bitmap[]) 15 new bitmaps from one given bitmap. The given bitmap is b1.
b1 i'm using it in trackBar1 scroll event.
All the new Bitmaps in bitmaps variable array are Format32bppArgb.
While i checked on my hard disk the images(GIF type) i'm using with trackBar1 are all Bit Depth 8.
The images i'm using with trackBar1 scroll event are GIF types and Bit Depth 8 on the properties.
The images i'm using in trackBar2 are Bitmaps and they are Format32bppArgb.
So first thing i thought to convert all the 15 Bitmaps in bitmaps to 8bit:
for (int i = 0; i < bitmaps.Length; i++)
bitmaps[i] = ConvertTo1or8Bit.ColorToGrayscale(bitmaps[i]);
But it didn't work it's just turning them to black gray scale colors not what i was thinking about.
In the backgroundworker completed event i'm converting the bitmaps to 24 like i'm doing with the Gifs in trackBar1 scroll event:
private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
trackBar2.Enabled = true;
trackBar2.Maximum = bitmaps.Length -1;
bitmaps[0].Save(ConvertedBmpDir + "\\bitmapsfirstimage.bmp");
for (int i = 0; i < bitmaps.Length; i++)
ConvertedBitmaps.Add(ConvertTo24(bitmaps[i]));
ConvertedBitmaps[0].Save(ConvertedBmpDir + "\\ConvertedBitmapsFirstImage.bmp");
label2.Text = "עיבוד הנתונים הסתיים";
b1.Dispose();
Then in the trackBar2 scroll event:
private void trackBar2_Scroll(object sender, EventArgs e)
LoadPictureAt(trackBar2.Value, sender);
ConvertedBmp = ConvertedBitmaps[trackBar2.Value - 1];
ConvertedBmp.Save(ConvertedBmpDir + "\\ConvertedBmp.bmp");
mymem = ToStream(ConvertedBmp, ImageFormat.Bmp);
backTexture = TextureLoader.FromStream(D3Ddev, mymem);
scannedCloudsTexture = new Texture(D3Ddev, 512, 512, 1, Usage.Dynamic, Format.A8R8G8B8, Pool.Default);
timer1.Stop();
Button1Code();
timer1.Start();
The same i did with the trackBar1 scroll event.
But the result in trackBar2 i'm getting without using the grayscale convertion is this:
You can see that the color that make the scan now is more yellow or green/yellow and not the same like it is when i'm using the trackBar1.
I can't figure out where the problem is:
1. Maybe since the Bitmaps in the variable array bitmaps are all Format32bppArgb ?
2. Maybe they are Bitmaps and not Gif types like the images in trackBar1 ?
If it does working good with the gifs in trackBar1 scroll event then the whole code in the new form ScanningClouds is working fine so i will not add to here the whole ScanningClouds form code since it's long.
The problem is somewhere with the Bitmaps formas or bits in the variable bitmaps.
Maybe they are not the same or the right Bit Depth or maybe they are Bitmaps and should be Gifs.
bitmaps = ImagesComparison.get_images_with_clouds(b1);
This is the get_images_with_clouds method where i'm getting the new 15 Bitmaps.
public static Bitmap[] get_images_with_clouds(Bitmap radar_image)
int e = 0;
int f = 0;
int image_clock_area_x = 0;
int image_clock_area_y = 0;
int image_clock_area_x1 = 140;
int image_clock_area_y1 = 21;
Bitmap[] localImages;
localImages = new Bitmap[15];
Bitmap image;
image = new Bitmap(Properties.Resources.radar_without_clouds);
BitmapData bmD = null;
BitmapData bmD2 = null;
try
bmD = image.LockBits(new Rectangle(0, 0, image.Width, image.Height), ImageLockMode.ReadWrite,
PixelFormat.Format32bppArgb);
bmD2 = radar_image.LockBits(new Rectangle(0, 0, radar_image.Width, radar_image.Height), ImageLockMode.ReadOnly,
PixelFormat.Format32bppArgb);
IntPtr sc0 = bmD.Scan0;
unsafe
int* p = (int*)sc0.ToPointer();
int* p2 = (int*)bmD2.Scan0.ToPointer();
for (e = image_clock_area_x; e < image_clock_area_x + image_clock_area_x1; e++)
for (f = image_clock_area_y; f < image_clock_area_y + image_clock_area_y1; f++)
Color clock_color = Color.FromArgb(p2[e + f * bmD2.Width]);
p[e + f * bmD.Width] = clock_color.ToArgb();
image.UnlockBits(bmD);
radar_image.UnlockBits(bmD2);
catch
try
image.UnlockBits(bmD);
catch
try
radar_image.UnlockBits(bmD2);
catch
int c;
for (c = 0; c < localImages.Length; c++)
localImages[c] = new Bitmap(image);
Bitmap new_image = new Bitmap(Properties.Resources.radar_without_clouds);
Bitmap new_image1 = new Bitmap(Properties.Resources.radar_without_clouds);
Bitmap localbmptest = black_and_white(new_image, radar_image);
Image image1 = black_and_white(new_image, radar_image);
image1.Save(@"c:\temp\testclouds666.jpg");
Bitmap clouds = new Bitmap(image1);
int x;
int y;
int a;
int b;
int d = 0;
Bitmap redImage;
redImage = new Bitmap(512, 512);
using (Graphics g = Graphics.FromImage(redImage))
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
g.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.Half;
g.Clear(Color.Red);
BitmapData bmData = null;
BitmapData bmData2 = null;
BitmapData bmDataArray = null;
try
bmData = clouds.LockBits(new Rectangle(0, 0, clouds.Width, clouds.Height), ImageLockMode.ReadOnly,
PixelFormat.Format32bppArgb);
bmData2 = radar_image.LockBits(new Rectangle(0, 0, radar_image.Width, radar_image.Height), ImageLockMode.ReadOnly,
PixelFormat.Format32bppArgb);
IntPtr scan0 = bmData.Scan0;
IntPtr scan02 = bmData2.Scan0;
unsafe
int* p = (int*)scan0.ToPointer();
int* p2 = (int*)scan02.ToPointer();
double h, mm;
for (d = 0; d < localImages.Length; d++)
bmDataArray = localImages[d].LockBits(new Rectangle(0, 0, localImages[d].Width, localImages[d].Height), ImageLockMode.ReadWrite,
PixelFormat.Format32bppArgb);
IntPtr scan0Array = bmDataArray.Scan0;
int* pArray = (int*)scan0Array.ToPointer();
for (a = 0; a < new_image.Width; a++)
for (b = 0; b < new_image.Height; b++)
Color color1 = Color.FromArgb(p[a + b * bmData.Width]);
Color color2 = Color.FromArgb(p2[a + b * bmData2.Width]);
if (color1.R != 0 || color1.G != 0 || color1.B != 0)
h = color2.GetHue();
mm = RadarAnalysis.Hue2MMPerHour(h);
if (mm >= treshhold_array[14 - d])
pArray[a + b * bmDataArray.Width] = color2.ToArgb();
localImages[d].UnlockBits(bmDataArray);
clouds.UnlockBits(bmData);
radar_image.UnlockBits(bmData2);
catch (Exception error)
try
clouds.UnlockBits(bmData);
catch
try
radar_image.UnlockBits(bmData2);
catch
try
localImages[d].UnlockBits(bmDataArray);
catch
Logger.Write("Error Exception ==> " + error);
MessageBox.Show("Error Exception ==> " + error);
return localImages;
I think not sure but i think the problem is that the images on my hard disk i'm using with the trackBar1 scroll event are Gif type and the images i'm using with the trackBar2 scroll event are 15 Bitmaps.Hi,
"But it didn't work it's just turning them to black gray scale colors not what i was thinking about."
If you want it to be colored, you'll need to create a color-palette for the 8bppIndexed bitmaps. The keyword for this process is "Color-Quantization".
The whole yellow-green pie you get is from the wrong format. If you convert the 32bpp bitmaps to 24 bpp bitmaps, you loose the alpha channel ("transparency"). You can manually set one color to "transparent" with the mMakeTransparent-method
of the Bitmap class, or simply use gif-images (they are 8bpp with a transparent "key"-color)
Regards,
Thorsten -
Valuechange listener works only for some components in page
This is a portion of XHTML, which is that included into the page. It hash 2 <h:selectOneRadio> which have the same listener, but only in the first case the method is called right after user changes value of radio. In the second case its triggered only when submiting the form.
*<h:selectOneRadio id="workType"*
*valueChangeListener="#{orderingPage.valueChanged}"*
*value="#{orderingPage.ordering.orderedObject.workType}"*
*layout="pageDirection">*
*<f:selectItem itemLabel="#{enums['WorkType.scan']}" itemValue="SCAN" />*
*<f:selectItem itemLabel="#{enums['WorkType.filmcopy']}"*
*itemValue="FILMCOPY" />*
*<f:selectItem itemLabel="#{enums['WorkType.papercopy']}"*
*itemValue="PAPERCOPY" />*
*<f:selectItem itemLabel="#{enums['WorkType.print']}" itemValue="PRINT" />*
*<f:selectItem itemLabel="#{enums['WorkType.readerPrinter']}"*
*itemValue="READER_PRINTER" />*
*<f:selectItem itemLabel="#{enums['WorkType.photo']}" itemValue="PHOTO" />*
*<f:ajax*
*render="scanTypesGrid copyFormatGrid copyColorGrid deliveryTypeGrid" />*
*</h:selectOneRadio>*
*<h:panelGroup id="copyFormatGrid">*
*<h:selectOneRadio layout="pageDirection"*
*value="#{orderingPage.ordering.orderedObject.copyFormat}"*
*valueChangeListener="#{orderingPage.valueChanged}"*
*rendered="#{(orderingPage.ordering.orderedObject.workType == 'PAPERCOPY') or (orderingPage.ordering.orderedObject.workType == 'PRINT')}">*
*<f:selectItem itemLabel="#{enums['PaperCopyFormat.a0']}" itemValue="A0" />*
*<f:selectItem itemLabel="#{enums['PaperCopyFormat.a1']}" itemValue="A1" />*
*<f:selectItem itemLabel="#{enums['PaperCopyFormat.a2']}" itemValue="A2" />*
*<f:selectItem itemLabel="#{enums['PaperCopyFormat.a3']}" itemValue="A3" />*
*<f:selectItem itemLabel="#{enums['PaperCopyFormat.a4']}" itemValue="A4" />*
*</h:selectOneRadio>*
Can't see anything, why also the 2nd should not be working fine. Generally in this page i have some listeners working, some not, don't know why.
thanks for help!
PS: I use primefaces 2.2.1 and jsf-api 2.1.2
Edited by: 851668 on 17.11.2011 08:06
Edited by: 851668 on 17.11.2011 08:08Note that the first has an f:ajax attached to it and the second does not.
-
Flash Player works only on some sites
Hey, ever since I've installed the new Flash 10.1 Flash has only worked on some sites. Good example is Youtube where it
works and then again on Zero Punctuation site it doesn't work. This only happens if my user account is standard user. If I switch it to Admin account (the rights, I don't switch to a different account totally) then Flash works on all sites. Why does Flash require Admin account on this computer to work properly with 10.1?
EDIT: Forgot to mention that Flash 10.1 works fine with Standard account on my laptop.'
2nd EDIT: Windows 7 with Internet Explorer 8 btw. Forgot to mention that tooHey.
I'm basing this on currently loaded IE addons. My desktop has more running atm. I can list them: Java Plugin 2 SSV helper, Windows Media Player, XML DOM Document 6.0, Free Threaded XML DOM Document, XSL Template 6.0 and Windows Live Sign-In Helper alongside with Flash. Laptop has only Windows Live Sign-in Helper on with Flash. The java is disabled and rest are from Microsoft and are well, needed to display XML sites I guess
I have Microsoft Security Essentials with just Windows Firewall on both computers. And I just meant that probably some weird security setting in flash or IE since something, like I said, seems to be partially blocking flash from different domain. For example, I know that a site "istartedsomething" has a video that is linked from Youtube. It doesn't work in that site but everything works just fine in Youtube.
I thought of that too first, that the websites haven't managed to update, but for some reason they do work on my laptop which has same flash installed.
On sidenote, for example http://kb2.adobe.com/cps/155/tn_15507.html does work on my laptop but doesn't work on this desktop while http://www.adobe.com/software/flash/about/ works on both.
Whew, wall of text done -
Record Mic using SampleDataEvent works only on some computers.
I made a swf that records your mic and allows you to play it back. I load the soundBytes into a float and play the float back. It works fine on the computer I developed it on (in IE, Chrome and Firefox) . It does not work on my second laptop. And a few people in some forums have said it is not working either.
Here is the file. http://www.buttonbeats.com/images/MicCapture.html
Here is the code. Do I need certain plugins besides the flash player?
micRec.addEventListener(MouseEvent.CLICK,recordMic);
function recordMic(event:MouseEvent){
micRec.x = -250;
stopRecord.x = 0;
const DELAY_LENGTH:int = 4000;
var mic:Microphone = Microphone.getMicrophone();
mic.setSilenceLevel(0, DELAY_LENGTH);
mic.gain = 80;
mic.rate = 40;
mic.addEventListener(SampleDataEvent.SAMPLE_DATA, micSampleDataHandler);
stopRecord.addEventListener(MouseEvent.CLICK,SREC);
var soundBytes:ByteArray = new ByteArray();
function micSampleDataHandler(event:SampleDataEvent):void
while(event.data.bytesAvailable)
var sample:Number = event.data.readFloat();
soundBytes.writeFloat(sample);
function SREC(event:MouseEvent):void
stopRecord.x = -250;
mic.removeEventListener(SampleDataEvent.SAMPLE_DATA, micSampleDataHandler);
soundBytes.position = 0;
var sound:Sound = new Sound();
sound.addEventListener(SampleDataEvent.SAMPLE_DATA, playbackSampleHandler);
soundPlay.addEventListener(MouseEvent.CLICK,SP1);
function SP1(event:MouseEvent){
soundBytes.position = 0;
sound.play();
function playbackSampleHandler(event:SampleDataEvent):void
for (var i:int = 0; i < 8192 && soundBytes.bytesAvailable > 0; i++)
var sample:Number = soundBytes.readFloat();
event.data.writeFloat(sample);
event.data.writeFloat(sample);you need fp 10. what's the problematic player version?
-
Query working only after resaving
Hi all,
I am not able to execute a particular query .But other queries work on the same cube. I have been fixing this by re-saving.
Please tell why do we have to go in to queries, that have not been modified and re-save them for them to work?
Experts Please help,Its very urgent.
Regards
PriyaHI,
Generate your Query in RSRT t-code. Check the appropriate Cache Settings in Properties tab in RSRT.
Whenever you are not able to execute your Query, try to understand the error message. There will be a dump generated in BW system
Make sure you have a BEx Transport request available in RSA1.
Regards,
Suman -
Webcam works only in some applications
Hi,
I'm having an issue with a friend's PC (Dell XPS 12). His integrated webcam is not working with neither Cheese nor WebRTC via Firefox. In Cheese, the rendered video is broken (black and green) and in Firefox no video is displayed. However, when testing the "video pipe" via gstreamer-properties the video is displayed as it should be: no errors. I believe both Firefox and Cheese use gstreamer so this is puzzling. . . I've tried Arch, Ubuntu and Fedora images. The problem persists across all of them and it's preventing my friend from ditching Windows.
Any ideas what could cause this error or how to change the configuration of gstreamer/webcam to try to resolve this issue?
Thanks in advance,
Rasmus
PS: Unfortunately, I don't have logs or outputs here.
PPS: I tried the LD_PREPATH suggestions from the wiki, but this did not work...
Edit: Notes
ID of webcam 0bda:5716
openSuse report, Fedora report, launchpad report.
Last edited by Pank (2015-01-27 17:31:27)Cf https://bbs.archlinux.org/viewtopic.php … 9#p1503299 for a workaround.
-
Automatic row processing query should not update key columns
We have an APEX application to maintain a table A, which is referenced by a huge table B (several millions rows). If a row is updated (by automatic row processing), the following update statement is executed.
update "MM_DWH"."A" set "ID" = :DML_BV0001,"NAME" = ... where "ID" = :p_rowid
Due to the foreign key constraint of table B, we have situations where this update statement is blocked (Enq: TM - contention) for a long time if we have inserts into table B at the same time - I guess.
My questions are:
Why is column ID updated, this does not make sense?
Is there a way to prevent that behavious or do I have to code the update statements manually instead of using the automatic row processing feature?
Thanks and regards, Marenm_eschermann wrote:
We have an APEX application to maintain a table A, which is referenced by a huge table B (several millions rows). If a row is updated (by automatic row processing), the following update statement is executed.
update "MM_DWH"."A" set "ID" = :DML_BV0001,"NAME" = ... where "ID" = :p_rowid
Due to the foreign key constraint of table B, we have situations where this update statement is blocked (Enq: TM - contention) for a long time if we have inserts into table B at the same time - I guess.
My questions are:
Why is column ID updated, this does not make sense?
Is there a way to prevent that behavious or do I have to code the update statements manually instead of using the automatic row processing feature?Make sure that you have all the required Primary Key and Foriegn Key indices for the two tables - if missing, it's possible that each update of A is requiring a full table scan of B.
What is column "ID" - the PK for A or the FK to B? -
JTABLE - horizontal scrolling only for some columns
Hi all,
In my JTABLE I have to scroll the horizontal scrollbar only from column 5 to the last, the columns 0 - 4 should be fixed ! Is this possible ?
Thanks in advance,
ArpanaPlease see
http://www.senun.com/Left/Programming/Java_old/Examples_swing/JTableExamples1.html
http://www.senun.com/Left/Programming/Java_old/Examples_swing/src/examples/FixedColumnExample.java -
Upload/import procedure works only when last column filled
To upload csv-files I use something like
TYPE line_tab_type IS TABLE OF VARCHAR2 (4000)
INDEX BY BINARY_INTEGER;in the package header
and the procedure itself looks like
PROCEDURE get_mitglieder_csv (p_file_name IN VARCHAR2,
p_rec_sep IN VARCHAR2,
p_header IN VARCHAR2,
p_blzkto IN VARCHAR2
) IS
v_binary_file BLOB;
v_text_file CLOB;
-- Conversion Variables
v_dest_offset INTEGER := 1;
v_src_offset INTEGER := 1;
v_lang_context INTEGER := DBMS_LOB.default_lang_ctx;
v_warning INTEGER;
-- Parsing Variables
v_rec_sep_len PLS_INTEGER;
v_start_pos PLS_INTEGER := 1;
v_end_pos PLS_INTEGER := 1;
v_line_num PLS_INTEGER := 1;
v_file_length PLS_INTEGER;
-- Parsing Line Variables
v_field_array wwv_flow_global.vc_arr2;
p_lines line_tab_type;
doszeilen CONSTANT VARCHAR2(2) := CHR(13) || CHR(10);
unixzeilen CONSTANT VARCHAR2(1) := CHR(10);
geloescht BOOLEAN := FALSE;
err_code NUMBER;
err_msg VARCHAR2(400);
BEGIN
IF p_file_name IS NULL THEN
raise_application_error(-20000, 'Dateiname wird benoetigt');
END IF;
IF p_rec_sep IS NULL THEN
raise_application_error(-20000, 'Feldtrenner wird benoetigt');
END IF;
IF (UPPER(p_rec_sep) LIKE '%DOS%') THEN
v_rec_sep_len := LENGTH(doszeilen);
ELSE
v_rec_sep_len := LENGTH(unixzeilen);
END IF;
SELECT blob_content
INTO v_binary_file
FROM my_wwv_flow_files
WHERE my_wwv_flow_files.name = p_file_name
--AND mime_type = 'text/plain'
AND doc_size > 0;
DBMS_LOB.createtemporary(v_text_file, TRUE);
DBMS_LOB.converttoclob(v_text_file,
v_binary_file,
DBMS_LOB.lobmaxsize,
v_dest_offset,
v_src_offset,
DBMS_LOB.default_csid,
v_lang_context,
v_warning);
IF v_warning = DBMS_LOB.warn_inconvertible_char THEN -- error converting
raise_application_error(-20000, 'Kann Datei nicht konvertieren');
END IF;
v_file_length := DBMS_LOB.getlength(v_text_file);
--INSERT INTO DEBUG_TAB (a) VALUES (v_file_length);
LOOP
EXIT WHEN v_start_pos > v_file_length;
-- erste Vorkommen von p_rec_sep in v_text_file, starte suche bei v_start_pos
IF (UPPER(p_rec_sep) LIKE '%DOS%') THEN
v_end_pos := DBMS_LOB.INSTR(v_text_file, doszeilen, v_start_pos);
ELSE
v_end_pos := DBMS_LOB.INSTR(v_text_file, unixzeilen, v_start_pos);
END IF;
--INSERT INTO DEBUG_TAB (a,b) VALUES ('p_rec_sep',UPPER(p_rec_sep));
--INSERT INTO DEBUG_TAB (a,b) VALUES ('v_end_pos',v_end_pos);
IF v_end_pos = 0 --- nichts gefunden, leeres v_text_file
THEN
v_end_pos := v_file_length + 1;
END IF;
IF v_end_pos - v_start_pos > 4000 --- mehr als 4000 Zeichen in Zeile
THEN
raise_application_error(-20000, 'Zeile hat mehr als 4000 Zeichen, Dateiformat beachten');
END IF;
--- DBMS_LOB.SUBSTR(source, amount, position)
p_lines(v_line_num) := DBMS_LOB.SUBSTR(v_text_file,
v_end_pos - v_start_pos,
v_start_pos);
--- Change the ',' field delimiter to ':' , to use the built-in string_to_table function
--- optionale Hochkomma " entfernen
p_lines(v_line_num) := REPLACE(p_lines(v_line_num), '"', '');
p_lines(v_line_num) := REPLACE(p_lines(v_line_num), ':', ' ');
--- passende Feldtrenner auswaehlen , ; |
p_lines(v_line_num) := REPLACE(p_lines(v_line_num), '|', ':');
-- p_lines(v_line_num) := REPLACE(p_lines(v_line_num), ',', ':');
-- p_lines(v_line_num) := REPLACE(p_lines(v_line_num), ';', ':');
v_field_array := wwv_flow_utilities.string_to_table(p_lines(v_line_num));
IF v_field_array.COUNT <= 1 THEN
raise_application_error(-20000, 'Benoetige mindestens 2 Spalten');
ELSE
BEGIN
IF geloescht = FALSE THEN
EXECUTE IMMEDIATE 'TRUNCATE TABLE UP_MITGLIEDER';
geloescht := TRUE;
END IF;
IF ( (v_line_num = 1 ) AND (UPPER(p_header) = 'MITKOPF') ) THEN
NULL;
------ mit Konto-Daten ------------------ 24 Felder
ELSIF ( UPPER(p_blzkto) = 'MITBLZ' )
THEN
EXECUTE IMMEDIATE 'INSERT INTO UP_MITGLIEDER(
MG_NR
,MG_ZS
,MG_KONTONR
,MG_BLZ
VALUES ( TRIM(:1), TRIM(:2), TRIM(:3), TRIM(:4), TRIM(:5), TRIM(:6), TRIM(:7), TRIM(:8), TRIM(:9), TRIM(:10),
TRIM(:11), TRIM(:12), TRIM(:13), TRIM(:14), TRIM(:15), TRIM(:16), TRIM(:17), TRIM(:18), TRIM(:19), TRIM(:20),
TRIM(:21), TRIM(:22),
TRIM(:23), TRIM(:24) )'
-- VALUES (:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14, :15, :16, :17, :18, :19, :20, :21, :22 :23 :24 )'
USING
v_field_array(1), v_field_array(2), v_field_array(3), v_field_array(4), v_field_array(5),
v_field_array(6), v_field_array(7), v_field_array(8), v_field_array(9), v_field_array(10),
v_field_array(11), v_field_array(12), v_field_array(13), v_field_array(14), v_field_array(15),
v_field_array(16), v_field_array(17), v_field_array(18), v_field_array(19), v_field_array(20),
v_field_array(21), v_field_array(22), v_field_array(23), v_field_array(24);
------------ ohne Konto-Daten , bis MG_ZS ---- 22 Felder
ELSE
-- EXECUTE IMMEDIATE 'INSERT INTO EINS(LFD,BEM) VALUES(:1,:2)'
EXECUTE IMMEDIATE 'INSERT INTO UP_MITGLIEDER(
MG_NR
,MG_ZS
VALUES ( TRIM(:1), TRIM(:2), TRIM(:3), TRIM(:4), TRIM(:5), TRIM(:6), TRIM(:7), TRIM(:8), TRIM(:9), TRIM(:10),
TRIM(:11), TRIM(:12), TRIM(:13), TRIM(:14), TRIM(:15), TRIM(:16), TRIM(:17), TRIM(:18), TRIM(:19), TRIM(:20),
TRIM(:21), TRIM(:22) )'
-- VALUES (:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14, :15, :16, :17, :18, :19, :20, :21, :22 )'
USING
v_field_array(1), v_field_array(2), v_field_array(3), v_field_array(4), v_field_array(5),
v_field_array(6), v_field_array(7), v_field_array(8), v_field_array(9), v_field_array(10),
v_field_array(11), v_field_array(12), v_field_array(13), v_field_array(14), v_field_array(15),
v_field_array(16), v_field_array(17), v_field_array(18), v_field_array(19), v_field_array(20),
v_field_array(21), v_field_array(22);
END IF; --- v_line_num = 1 AND p_header
END; --- von Begin im Else-Zweig
END IF;
--INSERT INTO DEBUG_TAB(a)
--VALUES ('P_lines: ' || p_lines(v_line_num));
-- hilfscounter := v_field_array.COUNT;
--INSERT INTO DEBUG_TAB(a)
--VALUES ('v_field_array.count: ' || TO_CHAR(hilfscounter));
-- neue Zeile
v_line_num := v_line_num + 1;
v_start_pos := v_end_pos + v_rec_sep_len;
END LOOP;
DBMS_LOB.freetemporary(v_text_file);
EXCEPTION
WHEN NO_DATA_FOUND THEN
raise_application_error(-20000,
'Datei existiert nicht in my_wwv_flow_files, ist keine Textdatei (text/plain) oder hat die Groesse 0');
WHEN OTHERS THEN
err_code := SQLCODE;
err_msg := SUBSTR(SQLERRM, 1, 400);
raise_application_error(-20011,
'Datei entspricht nicht erwartetem Format ! '
||CHR(13) || CHR(10)||' '||err_msg||CHR (10)|| v_line_num ||CHR (10)|| p_lines(v_line_num));
END get_mitglieder_csv;If the last column e.g. MG_ZS contains NULL-values the import into UP-MITGLIEDER does not work , stops with error
Fehler ORA-20011: Datei entspricht nicht erwartetem Format !Why isn't it possible to import Null values from the last column ?Here is now a general example based on scott.emp
CREATE OR REPLACE PROCEDURE import_emp_csv (p_file_name IN VARCHAR2,
p_rec_sep IN VARCHAR2,
p_header IN VARCHAR2
) IS
TYPE line_tab_type IS TABLE OF VARCHAR2 (4000)
INDEX BY BINARY_INTEGER;
v_binary_file BLOB;
v_text_file CLOB;
-- Conversion Variables
v_dest_offset INTEGER := 1;
v_src_offset INTEGER := 1;
v_lang_context INTEGER := DBMS_LOB.default_lang_ctx;
v_warning INTEGER;
-- Parsing Variables
v_rec_sep_len PLS_INTEGER;
v_start_pos PLS_INTEGER := 1;
v_end_pos PLS_INTEGER := 1;
v_line_num PLS_INTEGER := 1;
v_file_length PLS_INTEGER;
-- Parsing Line Variables
v_field_array wwv_flow_global.vc_arr2;
p_lines line_tab_type;
doszeilen CONSTANT VARCHAR2(2) := CHR(13) || CHR(10);
unixzeilen CONSTANT VARCHAR2(1) := CHR(10);
geloescht BOOLEAN := FALSE;
err_code NUMBER;
err_msg VARCHAR2(400);
BEGIN
IF p_file_name IS NULL THEN
raise_application_error(-20000, 'Dateiname wird benoetigt');
END IF;
IF p_rec_sep IS NULL THEN
raise_application_error(-20000, 'Feldtrenner wird benoetigt');
END IF;
IF (UPPER(p_rec_sep) LIKE '%DOS%') THEN
v_rec_sep_len := LENGTH(doszeilen);
ELSE
v_rec_sep_len := LENGTH(unixzeilen);
END IF;
SELECT blob_content
INTO v_binary_file
FROM my_wwv_flow_files
WHERE my_wwv_flow_files.name = p_file_name
--AND mime_type = 'text/plain'
AND doc_size > 0;
DBMS_LOB.createtemporary(v_text_file, TRUE);
DBMS_LOB.converttoclob(v_text_file,
v_binary_file,
DBMS_LOB.lobmaxsize,
v_dest_offset,
v_src_offset,
DBMS_LOB.default_csid,
v_lang_context,
v_warning);
--INSERT INTO DEBUG_TAB (a) VALUES (v_text_file);
IF v_warning = DBMS_LOB.warn_inconvertible_char THEN -- error converting
raise_application_error(-20000, 'Kann Datei nicht konvertieren');
END IF;
v_file_length := DBMS_LOB.getlength(v_text_file);
--INSERT INTO DEBUG_TAB (a) VALUES (v_file_length);
LOOP
EXIT WHEN v_start_pos > v_file_length;
-- erste Vorkommen von p_rec_sep in v_text_file, starte suche bei v_start_pos
IF (UPPER(p_rec_sep) LIKE '%DOS%') THEN
v_end_pos := DBMS_LOB.INSTR(v_text_file, doszeilen, v_start_pos);
ELSE
v_end_pos := DBMS_LOB.INSTR(v_text_file, unixzeilen, v_start_pos);
END IF;
--INSERT INTO DEBUG_TAB (a,b) VALUES ('p_rec_sep',UPPER(p_rec_sep));
--INSERT INTO DEBUG_TAB (a,b) VALUES ('v_end_pos',v_end_pos);
IF v_end_pos = 0 --- nichts gefunden, leeres v_text_file
THEN
v_end_pos := v_file_length + 1;
END IF;
IF v_end_pos - v_start_pos > 4000 --- mehr als 4000 Zeichen in Zeile
THEN
raise_application_error(-20000, 'Zeile hat mehr als 4000 Zeichen, Dateiformat beachten');
END IF;
--- DBMS_LOB.SUBSTR(source, amount, position)
p_lines(v_line_num) := DBMS_LOB.SUBSTR(v_text_file,
v_end_pos - v_start_pos,
v_start_pos);
--- Change the ',' field delimiter to ':' , to use the built-in string_to_table function
--- optionale Hochkomma " entfernen
p_lines(v_line_num) := REPLACE(p_lines(v_line_num), '"', '');
p_lines(v_line_num) := REPLACE(p_lines(v_line_num), ':', ' ');
--- passende Feldtrenner auswaehlen , ; |
p_lines(v_line_num) := REPLACE(p_lines(v_line_num), '|', ':');
-- p_lines(v_line_num) := REPLACE(p_lines(v_line_num), ',', ':');
-- p_lines(v_line_num) := REPLACE(p_lines(v_line_num), ';', ':');
v_field_array := wwv_flow_utilities.string_to_table(p_lines(v_line_num));
IF v_field_array.COUNT <= 1 THEN
raise_application_error(-20000, 'Benoetige mindestens 2 Spalten');
ELSE
BEGIN
IF geloescht = FALSE THEN
EXECUTE IMMEDIATE 'TRUNCATE TABLE UP_EMP2';
geloescht := TRUE;
END IF;
IF ( (v_line_num = 1 ) AND (UPPER(p_header) = 'MITKOPF') ) THEN
NULL;
ELSE
EXECUTE IMMEDIATE 'INSERT INTO UP_EMP2(
EMPNO
,ENAME
,JOB
,MGR
,HIREDATE
,SAL
,DEPTNO
,COMM
VALUES ( TRIM(:1), TRIM(:2), TRIM(:3), TRIM(:4), TRIM(:5), TRIM(:6), TRIM(:7), NVL( TRIM(:8), NULL )
USING
v_field_array(1), v_field_array(2), v_field_array(3), v_field_array(4), v_field_array(5),
v_field_array(6), v_field_array(7), v_field_array(8);
END IF; --- v_line_num = 1 AND p_header
END; --- von Begin im Else-Zweig
END IF;
-- neue Zeile
v_line_num := v_line_num + 1;
v_start_pos := v_end_pos + v_rec_sep_len;
END LOOP;
DBMS_LOB.freetemporary(v_text_file);
EXCEPTION
WHEN NO_DATA_FOUND THEN
raise_application_error(-20000,
'Datei existiert nicht in my_wwv_flow_files, ist keine Textdatei (text/plain) oder hat die Groesse 0');
WHEN OTHERS THEN
err_code := SQLCODE;
err_msg := SUBSTR(SQLERRM, 1, 400);
raise_application_error(-20011,
'Datei entspricht nicht erwartetem Format ! '
||CHR(13) || CHR(10)||' '||err_msg||CHR (10)|| v_line_num ||CHR (10)|| p_lines(v_line_num));
END import_emp_csv;Here is my csv test file
7370|"schmid"|"CLERK"|7902|"17.12.1980"||20|20
7500|"ALLENT"|"SALESMAN"|7698|"20.02.1981"|1600|30|
7522|"WART"|"SALESMAN"|7698|"22.02.1981"|1250|30|500The second row is missing the last element (in excel table it is a NULL Value), this causes a NO-DATA-FOUND error.
Any ideas how to solve this problem ? -
On-Demand Process Running only for authenticated user
I have noticed that an on-demand process is running only for authenticated users - for example a download of a document. For public users it doesn't. I remember seeing a similar question related to ajax on demand in this forum but couldn't locate the thread. Does anyone knows why the process is not running for not authenticated user? The result of a download for a public user is a blank page where the authenticated user gets the file by clicking on the same link.
Thanks in advance,
Denes Kubicek
http://deneskubicek.blogspot.com/
http://htmldb.oracle.com/pls/otn/f?p=31517:1
-------------------------------------------------------------------Hello Denes,
Please check if the following can help you -
Re: AJAX on public page
Re: Calling an application level on-demand process from JavaScript
Regards,
Arie. -
My Iphone 4, to which all my outlook email is forwarded to. is only receivng some of the emails but not all. It has worked beautifully in the past but no longer. What can I do to get all emails?
I would just explain that this just started happening, that nothing has changed on the phone, that it is an original iPhone and I wondered if they are implementing a change in coverage with their Edge network in my area.
If you restore your phone, you will be given an option to back up your phone at the beginning of the process (see step 6 here: http://support.apple.com/kb/HT1414). You will be given the option to restore to that backup at the end of the restore process. Your messages are stored in the backup so restoring to the backup will return the messages to your phone. Be sure to import your photos and videos to your computer (see http://support.apple.com/kb/HT4083) and back up your contacts somewhere before restoring your phone as these sometimesget lost in the restore process. -
My photo stream is not working correctly. only importing some..help?
my photo stream is only importing some of my photos...settings all seem to be correct..any advise?
I'd advise you to provide details so we do not have to make wild guesses
What version of iPhoto? Of the OS? what exactly is happening? What have you tried to resolve this? How long have you waited for them to downad? have you looked at http://www.apple.com/support/icloud/photo-stream/ and verified tha tyour set up is correct and looked through the FAQs and troubleshooting tips? Has it ever worked? What has changed since it worked?
LN
Maybe you are looking for
-
Itunes repeatedly requests to authorize on one song
http://support.apple.com/kb/TS1389 I have been having some trouble playing one or two songs in my library that I previously purchased from iTunes. I have followed each of the different troubleshooting solutions in the above article. The only one I
-
Adobe pdf 8.0 not outputting correct page size from publisher 2007
i have windows vista home premium with microsoft office 2007. microsoft publisher is not outputting the correct page size when converting to pdf. In Word 2007 i have the document size 4.5 x 6, and if i convert with the adobe add in, the new pdf is ex
-
Viewing iWeb site from other devices
I published a simple site from iWeb 09 to http://web.me.com/nicholas.spratt/site/home.html to try an learn how to use the software. From my imac i am able to view the website. But when i try using the same URL on a PC (windows-based explorer) or my i
-
Took some notes on my iPad in a meeting this morning, and they're refusing to sync to my Mac. Help! iPad iOS 6.1.3 Mac OS 10.8.3 iTunes 11.0.2 I have WiFi syncing on, and both devices are using the same
-
I need to be able to take my project from premiere elements and put it in after effects.
I need to keep the format the same, and also be able to see all individual clips and move them around/trim them in the workbar area in after effects just like what you can do in elements 11.