Have a column which is having comma seperated values.. and i am trying to s

Have a column which is having comma seperated values.. and i am trying to seperate it.
I am trying to create a stored procedure ..Version 11g xe. .and apex version 4..
Here is the part of code..I cant make a procedure. .cause my statement consist with clause..
create or replace procedure ins_adv_invoice
(mmagazine_no number,madvtno number,missueno number,msection varchar2,mpagenumber varchar2,msalesman_code varchar2)
is
cursor cx is with testa as
(select pagenumber name from advertiser)
select regexp_substr(pagenumber, '[^,]+', 1, rownum) result
from advertiser
connect by level <= length(regexp_replace(pagenumber, '[^,]+')) + 1
where advt_no = madvtno;
begin
for xxx in cx
loop
insert into adv_invoice (magazine_no,advtno,adissue,section,page_number,salesman_code)
values (mmagazine_no,madvtno,missueno,msection,xxx.result,msalesman_code);
end loop;
end;
But when i run this .. it doesnt create procedure. .I get he following error..
LINE/COL ERROR
5/14 PL/SQL: SQL Statement ignored
9/69 PL/SQL: ORA-00933: SQL command not properly ended
SQL>
Still not able to figure it out..Can any one help..
Thanks

Change the query to swap the last two lines:
cursor cx is with testa as
(select pagenumber name from advertiser)
select regexp_substr(pagenumber, '[^,]+', 1, rownum) result
from advertiser
where advt_no = madvtno
connect by level <= length(regexp_replace(pagenumber, '[^,]+')) + 1;
...

Similar Messages

  • HT1420 How can you deauthorise devices from an iPad? I no longer have the computer which is associated with my account and I'm trying to add my new laptop but all i have is iPod iPad and iPhone that are associated with that account.

    I had an old apple ID and now I have a new one. I made many purchases in my old ID and I'm trying to transfer that information to my iPad and iPhone however, it won't let me connect my new laptop so I can make those changes. It says I have 5 devices but I don't have 2 of those old devices. The only ones i have are my iphone ipad and ipod but it looks like i can deauthorize all devices on those.
    What do i do?!?!?!?!?

    Deauthorize all then authorize the active computers.
    ipods/ipads/iphones are not authorized at all.  Authorization applies only to computers.

  • Hi  I have Iphone 4 which the 2yrs warranty is over and now having problem with the phone LCD is flickering wat should i do.

    Hi  I have Iphone 4 which the 2yrs warranty is over and now having problem with the phone LCD is flickering wat should i do.

    Service Answer Center - iPhone - http://support.apple.com/kb/index?page=servicefaq&geo=US&product=iphone  <-- enter correct country in drag-down menu once on page.
    Repair Pricing section - http://www.apple.com/support/iphone/service/faq/
    iPhone model     Out-of-Warranty Service
    iPhone 4, iPhone 3GS, iPhone 3G, Original iPhone     $149
    If out of warranty and you don't ever want Apple to repair it again ("Certain damage is ineligible for out-of-warranty service ...  unauthorized modifications."- http://www.apple.com/support/iphone/service/faq/, http://support.apple.com/kb/index?), search for third party repair services, e.g., http://www.iresq.com

  • How to store Comma Seperated Value in a File with Jsp

    Hai friends,
    I need to get all the filed values like Empname,salary ,location..........
    and at the end of jsp page i have to put a browse button when i choose a file using theis browse button the total content in the form shoud store in that file as comma seperated values.

    1. Create JSP
    2. When you click the button call the event that saves the data in CSV format
    Your question is so broad, I don't have exact answer for you.
    What have you done so far?
    The man with blues.

  • How to query the comma seperated values stored in Database

    Hi,
    I have a strange scenario, I am storing the specific data as a comma seperated value in the database. I want to query the DB with the comma seperated value as a Bind variable against the comma seperated value stored in DB.
    For eg : The data stored in DB has
    Row1 - > 1,2,3,4,5,6,7,8
    Row2 - > 4,5,6,7,8,9,10
    When I pas the Bind variable as '4,8' I should get Row1 and Row2 .
    Quick help his highly appreciated.. Thanks in Advance

    Oh, and if you actually wanted the data returned rather than just the row primary keys....
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select 1 as rw, '1,2,3,4,5,6,7,8' as txt from dual union all
      2             select 2, '4,5,6,7,8,9,10' from dual union all
      3             select 3, '1,6,7,9' from dual)
      4  -- end of test data
      5      ,r as (select '4,8' as req from dual)
      6  -- end of required data
      7      ,split_t as (select rw, regexp_substr(txt, '[^,]+', 1, rn) as val
      8                   from t, (select rownum rn from dual connect by rownum <= (select max(length(regexp_replace(t.txt, '[^,]'))+1) from t))
      9                   where regexp_substr(txt, '[^,]+', 1, rn) is not null
    10                  )
    11      ,split_r as (select regexp_substr(req, '[^,]+', 1, rownum) as val
    12                   from r
    13                   connect by rownum <= length(regexp_replace(req, '[^,]'))+1
    14                  )
    15  --
    16  select distinct t.rw, t.txt
    17  from   split_t st join split_r sr on (st.val = sr.val)
    18                    join t on (t.rw = st.rw)
    19* order by 1
    SQL> /
            RW TXT
             1 1,2,3,4,5,6,7,8
             2 4,5,6,7,8,9,10
    SQL>

  • TS1538 Hi, I have the problem which iTunes cannot detect my iPhone 4s. I tried the steps you have provided in your troubleshooting, but it won't work for me because the Apple Mobile Devilce is perfectly installed on my windows.

    Hi, I have the problem which iTunes cannot detect my iPhone 4s. I tried the steps you have provided in your troubleshooting, but it won't work for me because the Apple Mobile Devilce is perfectly installed on my windows. However, the driver "Microsoft teredo Tunneling adapter" has a yellow exclamation mark, which i believe means it's not installed correctly or something is wrong with it. This driver is under the Network Adapters (Please see picture below).
    This is what happens when I connect my iPhone 4s to my laptop (Windows 7 Starter 32-bit)
    1. The phone charges it's battery
    2. I can open it in My Computer and import/export media files.
    In iTunes
    3. It start to sync until step 3 then stops.
    4. The iPhone option with an arrow appears beside the iTunes Store, but when the arrow is clicked it disappears.
    I hope you can provide me a solution for this problem.
    Thanks,
    Ralph

    Hi ralphagir,
    Welcome to the Apple Support Communities!
    For your iTunes issue with it not recognizing your iPhone, I would go ahead and suggest deleting iTunes and all of its components from your Windows computer and installing fresh.
    Removing and reinstalling iTunes and other software components for Windows Vista, Windows 7, or Windows 8
    http://support.apple.com/kb/HT1923
    Remove iTunes and related components from the Control Panel
    Use the Control Panel to uninstall iTunes and related software components in the following order and then restart your computer:
    iTunes
    Apple Software Update
    Apple Mobile Device Support
    Bonjour
    Apple Application Support (iTunes 9 or later)
    Important: Uninstalling these components in a different order, or only uninstalling some of these components may have unintended affects.
    As far as the arrow button that you click and the iPhone disappears, it sounds like you may be clicking on the eject button. Please take a look at the following article for information on the eject button in iTunes.
    Safely disconnect iPod
    http://support.apple.com/kb/HT1853
    Have a great day,
    Joe

  • I have a MacBook running OS X v10.6.8 and I'm trying to upgrade to Mouton Lion but I can"t download it from the app store. It says I need a intel core duo which i have. does anyone know whats happening here?

    I have a MacBook running OS X v10.6.8 and I'm trying to upgrade to Mouton Lion but I can"t download it from the app store. It says I need a intel core duo which i have. does anyone know whats happening here?

    Check that your computer is compatible with Mountain Lion.
    To check the model number hold down the option/alt key, go to the Apple menu and select System Information.
    MacBook (Late 2008 Aluminum, or Early 2009 or newer) model number 5,1 or higher
    MacBook Pro (Mid/Late 2007 or newer) model number 3,1 or higher
    Your Mac needs:
    OS X v10.6.8 or OS X Lion already installed
    2 GB or more of memory (More is better - 4 GB minimum seems to be the consensus)
    8 GB or more of available space
    If your computer isn't compatible, you might be able to upgrade to Lion. 
    Computer Compatibility - Lion
    Check to make sure your applications are compatible. PowerPC applications are no longer supported.      
    Application Compatibility
    You can also check which applications are PowerPC by going to the  menu, select About this Mac, click on More info…, then click System Report and select Software/Applications.

  • I have forgotten my answers to the questions which are asked to identify me, and I am trying to press "send instructions to my e-mail", but this does not work, what should I do?

    I have forgotten my answers to the questions which are asked to identify me, and I am trying to press "send instructions to my e-mail", but this does not work, what should I do?

    If the email hasn't arrived after a few hours and isn't in a spam filter, you need to ask Apple to reset your security questions. To do this, click here and pick a method; if that page doesn't list one for your country or you're unable to call, fill out and submit this form.
    (113969)

  • I downloaded quick time becausei tried watching a movie i purchased on itunes and and have watched it before on my laptop but paused and continued. i tried opening it today and it said i needed to download quicktime and i did. it still says i need to

    I downloaded quick time because i tried watching a movie i purchased on itunes and and have watched it before on my laptop but paused and continued. i tried opening it today and it said i needed to download quicktime and i did. it still says i need to download it, what do I do

    Hi morgangang,
    Although that message is not listed in the following article, I would still go through it for help.  Things like installing in safe mode may help.
    QuickTime: Windows troubleshooting tips
    Troubleshooting Tips
    Make sure your computer meets the system requirements.
    Try running ScanDisk to verify that the directory is OK. This is an important step to take before installing any software.
    Try running the stand-alone version of the QuickTime installer in "Safe Mode." It is available here. This can help to isolate issues with background applications, and some driver conflicts.
    Make certain you have installed the most recent drivers for your sound and video cards. Even if you have a "brand new" computer, it is not guaranteed to have the most recent software installed. Contact the manufacturer of your sound and video cards for additional information.
    Make certain you have installed a recent version of DirectX.
    Errors are usually related to software conflicts, unusable files, or incompatibilities. They can also be related to specific hardware combinations, and sometimes the way in which the hardware is configured. Keep in mind that an error message does not necessarily point to a particular cause or solution. Since there can be many different causes for a particular symptom, some suggestions may not work, and you may need to discover a solution on your own.
    Note: Please contact Microsoft Corporation or your computer vendor for help configuring Microsoft Windows.
    Thank you for visiting Apple Support Communities.
    Nubz

  • I have an ipod touch 4g it was just Fine and today i tried to plug it to my laptop to sync music and it suddenly turned off and it didn't work for 15 mins and then it worked but i can no longer sync apps or music plz help me as soon as you can

    I have an ipod touch 4g it was just Fine and today i tried to plug it to my laptop to sync music and it suddenly turned off and it didn't work for 15 mins and then it worked but i can no longer sync apps or music plz help me as soon as you can

    If you have not taken the iPod apart, Apple will exchange it for a refurbished one for $99. You can do it an an Apple store
    - Make an appointment at the Genius Bar of an Apple store.
      Apple Retail Store - Genius Bar
    Or sent it to Apple

  • Column should display comma seperated value.

    Hi All,
    Iam working on Reports6i.
    In my data model i have a query which gives some product names(only one column), i need to display those product names with a comma seperator.
    Just like Product1,Product2,....
    Can anybody guide me as this is very urgent.
    Thanks in Advance
    Chinni.

    something like this ?
    WITH DATA AS (SELECT 'X' product,1 order_id FROM DUAL
                  UNION ALL
                  SELECT 'Y' product,1 order_id FROM DUAL
                  UNION ALL
                  SELECT 'Z' product,1 order_id FROM DUAL
                  UNION ALL
                  SELECT 'XX' product,2 order_id FROM DUAL
                  UNION ALL
                  SELECT 'YY' product,2 order_id FROM DUAL
                  UNION ALL
                  SELECT 'ZZ' product,2 order_id FROM DUAL
    SELECT LTRIM(sys_connect_by_path(product,','), ',') PRODUCTS
      FROM (SELECT product,
                   order_id,
                   row_number()   OVER (partition by order_id order by product) RN,
                   count(product) OVER (partition by order_id) MAXROW
              FROM data) 
    WHERE RN=MAXROW CONNECT BY     PRIOR RN+1=RN
                                AND PRIOR ORDER_ID=ORDER_ID START WITH RN=1

  • Insert data into the column which is having null values.

    Hi,
    I have a column called "Classification_CD" .This column is having NULL values.I want to insert the data into this column.
    I tried to write the query as follows. But it is showing the mesg error "SQL Error: ORA-01400 cannot insert NULL into ("ABC"."A_CMP_W"."A_CMP_SEQ_NUM")"
    Can any one please help me out to write query to insert the dat afor this.
    Thanks.

    I think you are taking about updating the null value.So you can do this..
    SQL> select * from table_a;
            ID SCHEDULED MARK                       PRID
             5 07-NOV-10 T05                           7
             6 18-SEP-10 T06                           8
             4 31-JAN-11 T02                           2
             1 18-JAN-11 T01                           2
             2 18-JAN-11 T02
             3 18-JAN-11 T03                           1
    6 rows selected.See that prid is Null for id 2
    SQL> update table_a
      2  set prid =10
      3  where id =2;
    1 row updated.
    SQL> commit;
    Commit complete.
    SQL> select * from table_a;
            ID SCHEDULED MARK                       PRID
             5 07-NOV-10 T05                           7
             6 18-SEP-10 T06                           8
             4 31-JAN-11 T02                           2
             1 18-JAN-11 T01                           2
             2 18-JAN-11 T02                          10
             3 18-JAN-11 T03                           1
    6 rows selected.
    SQL> But remember while updating u should choose a primary key column in
    where condition so that only desired row or record is updated..
    Regards
    Umesh

  • Mapping a column with comma seperated values

    Hi,
    I have two tables
    1. Tasks (task_id, task_description)
    2. Task_assignment (username, task_assignment_value)
    the task_assignment_value has a comma seperated list of task_ids.
    What is the best ways to map the tables ?
    Thanks in advance.
    Moinuddin Mohammed

    I have a couple of attributes where I do this. From TopLink's perspective, I just map it as a String. Then, in my accessors for the attribute, I transform the primitive between the String and an Array or however the rest of the app wants to see the attribute.
    Here's an example that's actually more complicated than absolutely necessary. The mapped attributed is indicatorValueListString. It is lazily converted to an Array of Enums when it is first accessed. And it is converted back to a String in the preWriteEventCallback that is mapped in the TopLink descriptor.
    This implementation attempts to minimize the number of times the String<->Array conversion takes place, but if that's not a concern, it could be made much more simple. Also, at my company we privately manage collections with the Collection classes for dynamic allocation, but publicly exchange Arrays for type-safety. This could also be factored out. ValuedEnumUtils basically manages asking the enum for its delimiter and performing the actual conversion between a String and an Array or back.
    private String indicatorValueListString;
    private List indicatorValueSelections;
    private List indicatorValueSelections() {
            if (indicatorValueSelections == null) {
                    indicatorValueSelections = new ArrayList();
                    if (indicatorValueListString != null) {
                            indicatorValueSelections =
                                    java.util.Arrays.asList(ValuedEnumUtils.decodeEnumString(
                                         IndicatorValueEnum.class,indicatorValueListString));
            return indicatorValueSelections;
    private void indicatorValueSelections(List newIndicatorValueSelections) {
            indicatorValueSelections = newIndicatorValueSelections;
    public IndicatorValueEnum[] getIndicatorValueSelections() {
            return (IndicatorValueEnum[])indicatorValueSelections().toArray(new IndicatorValueEnum[0]);
    public void setIndicatorValueSelections(IndicatorValueEnum[] newIvSelections) {
            indicatorValueSelections(java.util.Arrays.asList(newIvSelections));
    public boolean addIndicatorValueSelection(IndicatorValueEnum anIvEnum) {
            return indicatorValueSelections().add(anIvEnum);
    public boolean removeIndicatorValueSelection(IndicatorValueEnum anIvEnum) {
            return indicatorValueSelections().remove(anIvEnum);
    public void preWriteEventCallback(DescriptorEvent aDescriptorEvent) {
            // Note: Not using accessor to avoid lazy initialization if no changes
            // are necessary.
            if (indicatorValueSelections != null) {
                    indicatorValueListString =
                            ValuedEnumUtils.encodeEnumString((ValuedEnum[])indicatorValueSelections.toArray());
    }

  • How to get the data by excluding the columns which are having null values

    I have a table with 10 columns , 3 columns are having all null values . I want to retrive the data by excluding these 3 columns. That means output table should contain only 7 columns .
    Can u give a query on this?
    Thanks,
    Mahesh

    select <list of column with not null values>
      from table_nameThat is you need to specify the column name.

  • Inserting comma seperated values

    I created a stored procedure that creates an order_id. Using this id, the products and their pricetag are inserted. Hereafter the garnishes are inserted for each product.
    Creating an order id and inserting the products and their pricetag are working. The problem is at the inserting of garnishes. 
    The data is received by parameters, and I have also created a user defined type: where garnishId holds the comma seperated ids.
    CREATE TYPE [dbo].[ppg] AS TABLE(
    [ProductId] [int] NULL,
    [PriceId] [int] NULL,
    [garnishId] [VARCHAR](MAX) NULL
    this is the stored procedure:
    ALTER PROCEDURE [dbo].[sp_create_order]
    (@userId uniqueidentifier, @productPriceGarnishes dbo.ppg READONLY, @comment varchar(250))
    AS
    BEGIN
    DECLARE @orderId int
    DECLARE @orderDetailId int
    INSERT INTO orders (user_id, confirmed,comment) values(@userId,0,@comment);
    --Select last inserted PK
    SELECT @orderId=SCOPE_IDENTITY()
    -- insert products and price tag using @orderId
    INSERT INTO order_detail (order_id, product_id,price_id)
    SELECT @orderId, p.ProductId,
    p.PriceId
    FROM @productPriceGarnishes p
    SELECT @orderDetailId=SCOPE_IDENTITY()
    -- insert garnishes using the orderDetailId
    INSERT INTO order_detail_garnish (order_detail_id,garnish_id)
    SELECT @orderDetailId, (SELECT * FROM SplitDelimiterString(p.garnishId))
    FROM @productPriceGarnishes p
    END
    RETURN @orderId
    I found a function that splits the string by a delimiter in this website:
    http://www.codeproject.com/Tips/586395/Split-comma-separated-IDs-to-ge
    Where you can retrieve the ids by this query:
    (SELECT * FROM SplitDelimiterString(p.garnishId)
    The problem is that I don't know how to add these ids with their corresponding orderDetailId, after each product is added.

    Unfortunately it appears you assume too much.  Presumably the reason you chose to define @productPriceGarnishes as a table is to support the creation of multiple rows. And you use these rows to insert into the order_detail table which has an identity
    column as the primary key (again, presumably).  So the question then becomes how do you get the identity values for ALL of the inserted rows?  You can't do that with SCOPE_IDENTITY - your code currently is designed with the assumption that there
    is only one row to be inserted.  To work around that limitation you need to use the output clause (examples can be found by searching). 
    Next comes another problem.  How do you know which identity value is assigned to which row of your table variable during the insert?  You need some sort of natural key to associate the inserted rows with the rows in the table variable.  Do
    you have one?  Before you think you do, you need to think about what restrictions are placed on the content of the table variable (if any).  Is it possible to have multiple rows with the same values for ProductId and PriceId?  Do not assume
    - you need to be certain that this is or is not a possibility.
    Assuming that the rows are unique (which simplifies things greatly), you associate the inserted order_detail rows to the table variable via something like:
    select ... from @ins_detail as ins inner join @productPriceGarnishes as ppg
    on ins.ProductId = ppg.ProductId and ins.PriceId = ppg.PriceId
    Note that @ins_detail is a table variable that you would declare and populate via the output clause. It will contain the identity values for each row that you inserted.  With that, you can then generate the rows that you need to insert into the garnish
    table by applying the results of your splitter function.  Which is a step that I'll skip for now since you have much reading and work to do. 
    Now some last comments.  I am suspicious of a column named PriceId.  That is not a good sign - price is an attribute of something and not the basis of a relationship between tables.  The use of identity columns (especially as primary keys)
    can be a problem - and this is one good example.  Based on what I've just written and its assumptions, the natural key for order_detail is (order_id, product_id, price_id) - why do you need an identity column?  Again, searching will find past
    discussions about identity columns and their usage.

Maybe you are looking for

  • Sort by birthday?

    I created a smart group which includes all cards with a birthdate field. I want to print the group showing just the birthdates (I know how to do this). Anyway I can sort the list by birthdate??? Actually I would like it sorted by month and day. Thank

  • My iphone is stuck in restore mode.  I plugged into macbook and ran a restore and it is still stuck

    iphone is stuck in restore mode when i did a rebook.  I hooked up to my macbook and ran a restore.   Itunes ran through the restore and now it is still stuck in restore mode.

  • How to Use this function

    I am not sure how to call this Function correctly and how to pass the IN parameter, I am still new and learning, please help! So far I have compiled it, and it compiled fine and saved it in my schema. It is supposed to be able to calculate the compre

  • Oracle 11g R2 Windows Installation issue

    Hey everybody, i was trying to install Oracle 11g R2 on a Windows Server 2008 64-bit machine. During the installation i am getting an error message multiple times (about 20 times) where it says it cannot find certain files like C:\app\ora11g\product\

  • Safari will not close

    Safari will not close even when I use command+Q. I cannot restart my computer because Safari is still open